From d8b21c2e8081ce314e8edd2d8dc2cb7101732ed7 Mon Sep 17 00:00:00 2001 From: jamesread Date: Tue, 1 Oct 2024 17:21:03 +0100 Subject: [PATCH] Differentiate between never fetched and nothing received --- webui/index.html | 2 +- webui/js/main.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/webui/index.html b/webui/index.html index b379779..6e1a208 100644 --- a/webui/index.html +++ b/webui/index.html @@ -15,7 +15,7 @@

Uncomplicated Alert Receiver

- Nothing received yet + Never updated GitHub Logo diff --git a/webui/js/main.js b/webui/js/main.js index a7fbdfa..a154bc1 100644 --- a/webui/js/main.js +++ b/webui/js/main.js @@ -41,6 +41,9 @@ function fetchAlertList () { } renderLastUpdated(res) + }).catch(error => { + document.getElementById('last-updated').textContent = 'Fetch error' + document.getElementById('last-updated').classList.add('critical') }) } @@ -55,12 +58,14 @@ function renderLastUpdated (res) { if (deltaLastUpdated < -100) { document.getElementById('last-updated').classList.add('critical') - } else if (deltaLastUpdated > 0) { document.getElementById('last-updated').classList.add('info') } else { document.getElementById('last-updated').classList.remove('critical') } + } else if (res.LastUpdated === 0) { + document.getElementById('last-updated').textContent = 'Nothing received yet' + document.getElementById('last-updated').classList.add('critical') } }