summaryrefslogtreecommitdiffstats
path: root/interface/js/app/stats.js
diff options
context:
space:
mode:
Diffstat (limited to 'interface/js/app/stats.js')
-rw-r--r--interface/js/app/stats.js64
1 files changed, 32 insertions, 32 deletions
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 = {