Skip to content

Commit

Permalink
better IT status detection
Browse files Browse the repository at this point in the history
  • Loading branch information
mart2070 committed Feb 3, 2025
1 parent 6e60b94 commit 30eae62
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tdx-enhanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,10 @@
let statusTime = statusLink.querySelector("#statusTime")
let statusText = statusLink.querySelector("#statusText")

let operationalText = "All Systems Operational"
let operationalText = "All systems operational."
//check the first 5 words. do they contain operational or green?
//since the default message can vary sometimes
let operationalRegex = /^(?=(?:\w+\s){0,5}?(?:operational|green)\b(?!-))(\w+(?:\s\w+){0,5})/gm

if (statusData) {
if (statusData.msg.length==0) {
Expand All @@ -1046,7 +1049,7 @@
}
}

if (statusData.msg != operationalText) {
if (!operationalRegex.test(statusData.msg)) {
statusIcon.classList = ("fa-solid fa-triangle-exclamation")
} else {
statusIcon.classList = ("fa-solid fa-check")
Expand Down

0 comments on commit 30eae62

Please sign in to comment.