diff options
-rw-r--r-- | .eslintrc.json | 3 | ||||
-rw-r--r-- | interface/js/app/history.js | 2 | ||||
-rw-r--r-- | interface/js/app/stats.js | 64 |
3 files changed, 35 insertions, 34 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index fe3ace7c3..8f33f636c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -43,6 +43,7 @@ "padded-blocks": "off", "prefer-arrow-callback": "off", "prefer-destructuring": "off", + "prefer-spread": "off", "prefer-template": "off", "quote-props" : ["error", "consistent-as-needed"], "require-jsdoc": "off", @@ -57,7 +58,6 @@ // Temporarily disabled rules "array-callback-return": "off", "array-element-newline": "off", - "consistent-return": "off", "consistent-this": "off", "func-style": "off", "function-paren-newline": "off", @@ -69,7 +69,6 @@ "no-invalid-this": "off", "no-underscore-dangle": "off", "one-var-declaration-per-line": "off", - "prefer-spread": "off", "sort-keys": "off", "sort-vars": "off" } diff --git a/interface/js/app/history.js b/interface/js/app/history.js index 0cd5675c0..265894188 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -615,6 +615,7 @@ define(["jquery", "footable", "humanize"], waitForRowsDisplayed(callback, i); }, 500); } + return null; } rspamd.query("history", { @@ -628,6 +629,7 @@ define(["jquery", "footable", "humanize"], "Neighbours history backend versions do not match. Cannot display history."); return true; } + return false; } var neighbours_data = req_data diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js index e9f0b8f2d..c7b0228c0 100644 --- a/interface/js/app/stats.js +++ b/interface/js/app/stats.js @@ -67,7 +67,7 @@ define(["jquery", "d3pie", "humanize"], $.each(data, function (i, item) { var widget = ""; - if (i === "auth" || i === "error") { return true; } // Skip to the next iteration + if (i === "auth" || i === "error") return; // Skip to the next iteration if (i === "version") { widget = "<div class=\"left\"><strong>" + item + "</strong>" + i + "</div>"; @@ -136,37 +136,37 @@ define(["jquery", "d3pie", "humanize"], function getChart(rspamd, pie, checked_server) { var creds = JSON.parse(sessionStorage.getItem("Credentials")); - if (creds && creds[checked_server]) { - var data = creds[checked_server].data; - var new_data = [{ - color: "#66CC00", - label: "Clean", - data: data.clean, - value: data.clean - }, { - color: "#BF8040", - label: "Temporarily rejected", - data: data.soft_reject, - value: data.soft_reject - }, { - color: "#FFAD00", - label: "Probable spam", - data: data.probable, - value: data.probable - }, { - color: "#436EEE", - label: "Greylisted", - data: data.greylist, - value: data.greylist - }, { - color: "#FF0000", - label: "Rejected", - data: data.reject, - value: data.reject - }]; - - return rspamd.drawPie(pie, "chart", new_data); - } + if (!creds || !creds[checked_server]) return null; + + var data = creds[checked_server].data; + var new_data = [{ + color: "#66CC00", + label: "Clean", + data: data.clean, + value: data.clean + }, { + color: "#BF8040", + label: "Temporarily rejected", + data: data.soft_reject, + value: data.soft_reject + }, { + color: "#FFAD00", + label: "Probable spam", + data: data.probable, + value: data.probable + }, { + color: "#436EEE", + label: "Greylisted", + data: data.greylist, + value: data.greylist + }, { + color: "#FF0000", + label: "Rejected", + data: data.reject, + value: data.reject + }]; + + return rspamd.drawPie(pie, "chart", new_data); } // Public API var ui = { |