Skip to content
Open
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
24 changes: 14 additions & 10 deletions lib/phoenix/live_dashboard/pages/os_mon_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@ defmodule Phoenix.LiveDashboard.OSMonPage do

@impl true
def handle_refresh(socket) do
os_mon = SystemInfo.fetch_os_mon_info(socket.assigns.page.node)

socket =
assign(socket,
cpu: calculate_cpu_data(os_mon),
mem_usages: calculate_memory_usage(os_mon.system_mem),
disk_usages: calculate_disk_usage(os_mon.disk)
)

{:noreply, socket}
case SystemInfo.fetch_os_mon_info(socket.assigns.page.node) do
os_mon when is_map(os_mon) ->
socket =
assign(socket,
cpu: calculate_cpu_data(os_mon),
mem_usages: calculate_memory_usage(os_mon.system_mem),
disk_usages: calculate_disk_usage(os_mon.disk)
)

{:noreply, socket}

_ ->
{:noreply, socket}
end
end

defp calculate_cpu_data(%{cpu_avg1: num1, cpu_avg5: num5, cpu_avg15: num15} = os_mon)
Expand Down
Loading