diff --git a/assets/js/app.ts b/assets/js/app.ts index 05105329..9dfcb56b 100644 --- a/assets/js/app.ts +++ b/assets/js/app.ts @@ -658,7 +658,10 @@ const NetworkMap = { selector: 'node', style: { 'background-color': function(ele: any) { - return deviceColors[ele.data('type')] || deviceColors.unknown + const status = ele.data('status') + if (status === 'down') return '#ef4444' // red + if (status === 'unknown') return '#eab308' // yellow + return '#22c55e' // green (up/online) }, 'label': 'data(label)', 'color': isDark ? '#fff' : '#000', @@ -671,9 +674,10 @@ const NetworkMap = { 'height': 40, 'border-width': 2, 'border-color': function(ele: any) { - if (ele.data('status') === 'down') return '#ef4444' - if (ele.data('status') === 'unknown') return '#6b7280' - return deviceColors[ele.data('type')] || deviceColors.unknown + const status = ele.data('status') + if (status === 'down') return '#dc2626' // darker red + if (status === 'unknown') return '#ca8a04' // darker yellow + return '#16a34a' // darker green } } }, @@ -689,7 +693,6 @@ const NetworkMap = { { selector: 'node.down', style: { - 'border-color': '#ef4444', 'border-width': 3 } }, diff --git a/lib/towerops_web/live/device_live/show.ex b/lib/towerops_web/live/device_live/show.ex index 225e21e5..25d5058a 100644 --- a/lib/towerops_web/live/device_live/show.ex +++ b/lib/towerops_web/live/device_live/show.ex @@ -618,19 +618,6 @@ defmodule ToweropsWeb.DeviceLive.Show do format_duration(diff) <> " ago" end - defp format_relative_time(nil), do: "never" - - defp format_relative_time(datetime) do - diff = DateTime.diff(DateTime.utc_now(), datetime, :second) - - cond do - diff < 60 -> "just now" - diff < 3600 -> "#{div(diff, 60)} min ago" - diff < 86_400 -> "#{div(diff, 3600)} hours ago" - true -> format_duration(diff) <> " ago" - end - end - defp format_event_type(event_type) do event_type |> String.replace("_", " ") diff --git a/lib/towerops_web/live/network_map_live.html.heex b/lib/towerops_web/live/network_map_live.html.heex index 2ad5a6af..6d4ff3cb 100644 --- a/lib/towerops_web/live/network_map_live.html.heex +++ b/lib/towerops_web/live/network_map_live.html.heex @@ -199,26 +199,18 @@
-
-
- Router -
-
-
- Switch -
- Wireless + Online
-
- Server -
-
-
+
Unknown
+
+
+ Offline +
Discovered (Not Added)