diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-09-11 20:31:27 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-09-11 20:31:27 +0300 |
commit | 78b16fb4bac326a6897b6fa4341e0568b26dc72c (patch) | |
tree | fb2c2d332b88d92f7f7a7a4405c874948ed8ee90 /interface | |
parent | 86e0d6c14dde85306c7053d2ddac7624c3af21e1 (diff) | |
download | rspamd-78b16fb4bac326a6897b6fa4341e0568b26dc72c.tar.gz rspamd-78b16fb4bac326a6897b6fa4341e0568b26dc72c.zip |
[WebUI] Notify user on module loading failure
Diffstat (limited to 'interface')
-rw-r--r-- | interface/css/rspamd.css | 4 | ||||
-rw-r--r-- | interface/js/main.js | 15 |
2 files changed, 19 insertions, 0 deletions
diff --git a/interface/css/rspamd.css b/interface/css/rspamd.css index 0628a25bc..14bb4e669 100644 --- a/interface/css/rspamd.css +++ b/interface/css/rspamd.css @@ -526,6 +526,10 @@ td.maps-cell { } /* Some spacing tweaks */ +.notification-area div > button:not(.close) { + margin-right: 9px; +} + #learning p > button { margin-top: 10px; } diff --git a/interface/js/main.js b/interface/js/main.js index 5ed33137d..db9c52942 100644 --- a/interface/js/main.js +++ b/interface/js/main.js @@ -32,6 +32,21 @@ define("d3.global", ["d3"], function (d3global) { // eslint-disable-line strict d3 = d3global; }); +// Notify user on module loading failure +requirejs.onError = function (e) { + "use strict"; + document.getElementsByClassName("notification-area")[0].innerHTML = + "<div class=\"alert alert-error\">" + + "<strong>Module loading error: " + e.requireType + ", module: " + e.requireModules + "</strong>" + + "<button type=\"button\" class=\"btn btn-info btn-xs pull-right\" " + + "onClick=\"window.location.reload(); this.parentNode.parentNode.removeChild(this.parentNode);\" " + + "title=\"Reload current page\">" + + "<i class=\"glyphicon glyphicon-repeat\"></i> Reload" + + "</button>" + + "</div>"; + throw e; +}; + // Load main UI require(["app/rspamd"], function (rspamd) { |