feat: add discovered sensors table to debug tab

Display discovered sensors in a parsed table format showing type,
description, OID, value with unit, and state description for state
sensors.
This commit is contained in:
Graham McIntire 2026-01-21 17:18:44 -06:00
parent 74c9544688
commit 605f8c09ec
No known key found for this signature in database

View file

@ -937,6 +937,67 @@
</div>
<% end %>
<%= if Map.get(@snmp_device.raw_discovery_data, "discovered_sensors") do %>
<h4 class="text-sm font-medium text-gray-900 dark:text-white mt-6 mb-3">
Discovered Sensors
</h4>
<div class="overflow-hidden rounded-lg border border-gray-200 dark:border-white/10">
<table class="min-w-full divide-y divide-gray-200 dark:divide-white/10">
<thead class="bg-gray-50 dark:bg-gray-800/75">
<tr>
<th class="px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
Type
</th>
<th class="px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
Description
</th>
<th class="px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
OID
</th>
<th class="px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
Value
</th>
<th class="px-3 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
State
</th>
</tr>
</thead>
<tbody class="bg-white dark:bg-gray-800/50 divide-y divide-gray-200 dark:divide-white/10">
<%= for sensor <- Map.get(@snmp_device.raw_discovery_data, "discovered_sensors", []) do %>
<tr>
<td class="px-3 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white">
{sensor["type"]}
</td>
<td class="px-3 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-white">
{sensor["descr"]}
</td>
<td class="px-3 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400 font-mono">
{sensor["oid"]}
</td>
<td class="px-3 py-4 text-sm text-gray-900 dark:text-white">
<code class="text-xs">{sensor["value"]}</code>
<%= if sensor["unit"] && sensor["unit"] != "" do %>
<span class="text-gray-500 dark:text-gray-400 ml-1">
{sensor["unit"]}
</span>
<% end %>
</td>
<td class="px-3 py-4 text-sm text-gray-900 dark:text-white">
<%= if sensor["state_descr"] do %>
<span class="inline-flex items-center rounded-full px-2 py-1 text-xs font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300">
{sensor["state_descr"]}
</span>
<% else %>
<span class="text-gray-400">-</span>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>
<h4 class="text-sm font-medium text-gray-900 dark:text-white mt-6 mb-3">
Copyable Debug Data
</h4>