fix: access interface stats through latest_stat association

The template accessed if_in_octets/if_out_octets directly on the
Interface struct, but these fields live on InterfaceStat. Access
through interface.latest_stat with nil guard to prevent KeyError
when the association is not loaded.
This commit is contained in:
Graham McIntire 2026-03-06 13:02:21 -06:00
parent 9aec87636b
commit cc53dd6a64
No known key found for this signature in database

View file

@ -1393,13 +1393,13 @@
<span :if={!interface.if_phys_address} class="text-gray-400">-</span>
</td>
<td class="px-3 py-2 text-right font-mono text-xs text-gray-600 dark:text-gray-400">
{if interface.if_in_octets,
do: format_bytes(interface.if_in_octets),
{if interface.latest_stat && interface.latest_stat.if_in_octets,
do: format_bytes(interface.latest_stat.if_in_octets),
else: "-"}
</td>
<td class="px-3 py-2 text-right font-mono text-xs text-gray-600 dark:text-gray-400">
{if interface.if_out_octets,
do: format_bytes(interface.if_out_octets),
{if interface.latest_stat && interface.latest_stat.if_out_octets,
do: format_bytes(interface.latest_stat.if_out_octets),
else: "-"}
</td>
</tr>