diff --git a/lib/nerves_hub_web/components/device_page/details.ex b/lib/nerves_hub_web/components/device_page/details.ex index c6352dd3e..0ef1ca7b0 100644 --- a/lib/nerves_hub_web/components/device_page/details.ex +++ b/lib/nerves_hub_web/components/device_page/details.ex @@ -17,6 +17,18 @@ defmodule NervesHubWeb.Components.DevicePage.Details do alias NervesHubWeb.Components.NewUI.DeviceLocation + @manual_metrics [ + "cpu_temp", + "cpu_usage_percent", + "mem_used_mb", + "mem_size_mb", + "mem_used_percent", + "load_1min", + "load_5min", + "load_15min", + "timestamp" + ] + def update(%{latest_metrics: latest_metrics}, socket) do socket |> assign(:latest_metrics, latest_metrics) @@ -153,6 +165,10 @@ defmodule NervesHubWeb.Components.DevicePage.Details do Not reported +
+ {key_label(key)} + {nice_round(value)} +
<.link class="text-xs font-normal text-zinc-400 hover:text-neutral-50" href="https://github.com/nerves-hub/nerves_hub_link?tab=readme-ov-file#configure-health"> @@ -603,4 +619,20 @@ defmodule NervesHubWeb.Components.DevicePage.Details do defp has_description?(description) do is_binary(description) and byte_size(description) > 0 end + + defp custom_metrics(metrics) do + metrics + |> Enum.reject(fn {key, _value} -> + key in @manual_metrics + end) + end + + defp nice_round(val) when is_float(val), do: Float.round(val, 1) + defp nice_round(val), do: val + + defp key_label(key) do + key + |> String.replace("_", " ") + |> String.capitalize() + end end