Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change health section to not show boxes for non-reported default values #1651

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions lib/nerves_hub_web/live/devices/show.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@

<%= if (!Enum.any?(Map.values(@latest_metrics)) or !Enum.any?(Map.values(@latest_custom_metrics))) do %>
<div class="display-box">
No health information have been received for this device.
No health information has been received for this device.
</div>
<% end %>
<div>
Expand All @@ -127,23 +127,13 @@
<div class="help-text label">Memory used</div>
<%= round(@latest_metrics.used_mb) %>MB (<%= round(@latest_metrics.used_percent) %>%)
</div>
<% else %>
<div class="callout">
<div class="help-text label">Memory used</div>
Not reported
</div>
<% end %>

<%= if @latest_metrics.cpu_temp do %>
<div class={"callout #{Utils.cpu_temp_to_status(@latest_metrics.cpu_temp)}"}>
<div class="help-text label">CPU</div>
<%= round(@latest_metrics.cpu_temp) %>°
</div>
<% else %>
<div class="callout">
<div class="help-text label">CPU</div>
Not reported
</div>
<% end %>

<%= for {key, val} <- @latest_custom_metrics do %>
Expand Down
4 changes: 1 addition & 3 deletions test/nerves_hub_web/live/devices/show_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ defmodule NervesHubWeb.Live.Devices.ShowTest do
|> visit("/org/#{org.name}/#{product.name}/devices/#{device.identifier}")
|> assert_has("h1", text: device.identifier)
|> assert_has("div", text: "Health")
|> assert_has("div", text: "No health information have been received for this device.")
|> assert_has("div", text: "No health information has been received for this device.")
end

test "full set of information", %{
Expand Down Expand Up @@ -289,8 +289,6 @@ defmodule NervesHubWeb.Live.Devices.ShowTest do
|> assert_has("div", text: "0.0 | 0.0 | 0.0")
|> assert_has("div", text: "Memory used")
|> assert_has("div", text: "100MB (60%)")
|> assert_has("div", text: "CPU")
|> assert_has("div", text: "Not reported")
|> assert_has("span", text: "Last reported :")
|> assert_has("time", text: "ago")
end
Expand Down
Loading