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:
parent
9aec87636b
commit
cc53dd6a64
1 changed files with 4 additions and 4 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue