From 1b2abc89c16858a487ef90c9417565dc89c0919d Mon Sep 17 00:00:00 2001 From: Stephan de Wit Date: Fri, 17 Jan 2025 11:25:02 +0100 Subject: [PATCH] system: handle privileges for notifications --- src/opnsense/www/js/opnsense_status.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/opnsense/www/js/opnsense_status.js b/src/opnsense/www/js/opnsense_status.js index fcbd646e6..8ed031049 100644 --- a/src/opnsense/www/js/opnsense_status.js +++ b/src/opnsense/www/js/opnsense_status.js @@ -33,7 +33,10 @@ class Status { updateStatus() { const fetch = new Promise((resolve, reject) => { - ajaxGet('/api/core/system/status', {path: window.location.pathname}, function (data) { + ajaxGet('/api/core/system/status', {path: window.location.pathname}, function (data, status) { + if (status !== "success") { + reject(status); + } resolve(data); }); }); @@ -43,6 +46,12 @@ class Status { data.subsystems = { }; } this.notify(data); + }, (reject) => { + // Either inaccessible or something went wrong on the backend. + $('#system_status').css({ + 'cursor': 'default', + 'pointer-events': 'none' + }); }); }