Skip to content

Commit

Permalink
Differentiate between never fetched and nothing received
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesread committed Oct 1, 2024
1 parent 6689d21 commit d8b21c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion webui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<h1>Uncomplicated Alert Receiver</h1>
<progress id = "next-update" value = "0" max = "30" title = "Time until next update"></progress>
<span id = "last-updated" class = "critical">
Nothing received yet
Never updated
</span>
<a href = "https://github.com/jamesread/uncomplicated-alert-receiver" target = "_blank" class = "aside">
<img src = "images/icons/github.svg" alt = "GitHub Logo">
Expand Down
7 changes: 6 additions & 1 deletion webui/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ function fetchAlertList () {
}

renderLastUpdated(res)
}).catch(error => {
document.getElementById('last-updated').textContent = 'Fetch error'
document.getElementById('last-updated').classList.add('critical')
})
}

Expand All @@ -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')
}
}

Expand Down

0 comments on commit d8b21c2

Please sign in to comment.