From 6355777ab36fe560728612701a2e099deec5bbf6 Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Fri, 14 Jan 2022 17:10:44 +0100 Subject: [PATCH] improved monitor config absence notification granularity - this primarily takes existing alerts into account - unfortunately there is still a chance for the notification to be misleading - especially in case of offline devices Changelog: None Signed-off-by: Manuel Zedel --- .../__snapshots__/monitoring.test.js.snap | 65 ++++++++++++------- .../devices/device-details/monitoring.js | 13 ++-- 2 files changed, 49 insertions(+), 29 deletions(-) diff --git a/src/js/components/devices/device-details/__snapshots__/monitoring.test.js.snap b/src/js/components/devices/device-details/__snapshots__/monitoring.test.js.snap index fb9585105e..bdb1c204d7 100644 --- a/src/js/components/devices/device-details/__snapshots__/monitoring.test.js.snap +++ b/src/js/components/devices/device-details/__snapshots__/monitoring.test.js.snap @@ -5,7 +5,7 @@ exports[`DeviceMonitoring Component renders correctly 1`] = ` class="margin-bottom " >
-
+
-

- No alert monitor is currently configured for this device. -
- Please - - - see the documentation - + + Device offline + +

+ Last check-in over + 24 - for a description on how to configure different kinds of monitors. -

+ hours + ago +
setOpen(!open) : undefined; + const toggleOpen = hasMonitorsDefined ? () => setOpen(!open) : undefined; return ( - ) : ( + hasMonitorsDefined || isOffline ? ( <> - {!latestAlerts.length && } + {hasMonitorsDefined && !latestAlerts.length && } {!open && latestAlerts.map(alert => ( ))} {isOffline && } - {!open && show more} + {!!(!isOffline || alerts.length || latestAlerts.length) && !open && show more} + ) : ( + ) } isAddOn