diff --git a/src/opnsense/www/js/opnsense_status.js b/src/opnsense/www/js/opnsense_status.js index 0220acdee3..fa1bb55e16 100644 --- a/src/opnsense/www/js/opnsense_status.js +++ b/src/opnsense/www/js/opnsense_status.js @@ -207,28 +207,37 @@ class StatusBanner { } update(status) { + let bannerSubject = null; + for (let [name, subject] of Object.entries(status.subsystems)) { if (subject.status == "OK") continue; if (subject.isBanner) { - if (!this.bannerActive) { - $('.page-content-main > .container-fluid > .row').prepend($(` -
-
- ${subject.message} -
-
- `)); - this.bannerActive = true; - break; - } else { - $('#notification-banner').text(subject.message); - $('#notification-banner').removeClass().addClass(`alert ${this.parseStatusBanner(subject.status)}`); - } + bannerSubject = subject; + break; } } + + if (bannerSubject) { + if (!this.bannerActive) { + $('.page-content-main > .container-fluid > .row').prepend($(` +
+
+ ${bannerSubject.message} +
+
+ `)); + this.bannerActive = true; + } else { + $('#notification-banner').text(bannerSubject.message); + $('#notification-banner').removeClass().addClass(`alert ${this.parseStatusBanner(bannerSubject.status)}`); + } + } else if (this.bannerActive) { + $('#notification-banner-container').remove(); + this.bannerActive = false; + } } parseStatusBanner(statusCode) {