diff options
-rw-r--r-- | .eslintrc.json | 3 | ||||
-rw-r--r-- | interface/js/app/config.js | 2 | ||||
-rw-r--r-- | interface/js/app/graph.js | 2 | ||||
-rw-r--r-- | interface/js/app/history.js | 330 | ||||
-rw-r--r-- | interface/js/app/rspamd.js | 106 | ||||
-rw-r--r-- | interface/js/app/stats.js | 40 | ||||
-rw-r--r-- | interface/js/app/symbols.js | 46 | ||||
-rw-r--r-- | interface/js/app/upload.js | 4 |
8 files changed, 266 insertions, 267 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index 1805d192c..4231abb4b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -34,7 +34,7 @@ "prefer-arrow-callback": "off", "prefer-destructuring": "off", "prefer-template": "off", - // "quote-props" : ["error", "consistent-as-needed"], + "quote-props" : ["error", "consistent-as-needed"], "require-jsdoc": "off", "space-before-function-paren": ["error", { "anonymous": "always", @@ -84,7 +84,6 @@ "no-use-before-define": "off", "one-var-declaration-per-line": "off", "prefer-spread": "off", - "quote-props": "off", "sort-keys": "off", "sort-vars": "off", "strict": "off" diff --git a/interface/js/app/config.js b/interface/js/app/config.js index 02f54c7f0..4f910ae8e 100644 --- a/interface/js/app/config.js +++ b/interface/js/app/config.js @@ -269,7 +269,7 @@ define(["jquery"], var id = $(form).attr("id"); var data = $("#" + id).find("textarea").val(); rspamd.queryNeighbours(action, save_map_success, save_map_error, "POST", { - "Map": id, + Map: id, }, { data: data, dataType: "text", diff --git a/interface/js/app/graph.js b/interface/js/app/graph.js index f5258c5ab..9418c7cfb 100644 --- a/interface/js/app/graph.js +++ b/interface/js/app/graph.js @@ -263,7 +263,7 @@ define(["jquery", "d3evolution", "footable"], url: neighbours[checked_server].url + "graph", jsonp: false, data: { - "type": type + type: type }, beforeSend: function (xhr) { xhr.setRequestHeader("Password", rspamd.getPassword()); diff --git a/interface/js/app/history.js b/interface/js/app/history.js index 6df033530..b6399894a 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -102,10 +102,10 @@ define(["jquery", "footable", "humanize"], } item.score = { - "options": { - "sortValue": item.score + options: { + sortValue: item.score }, - "value": score_content + value: score_content }; if (item.user == null) { @@ -179,18 +179,18 @@ define(["jquery", "footable", "humanize"], .map(function (e) { return e.str; }) .join("<br>\n"); item.time = { - "value": unix_time_format(item.unix_time), - "options": { - "sortValue": item.unix_time + value: unix_time_format(item.unix_time), + options: { + sortValue: item.unix_time } }; var scan_time = item.time_real.toFixed(3) + " / " + item.time_virtual.toFixed(3); item.scan_time = { - "options": { - "sortValue": item.time_real + options: { + sortValue: item.time_real }, - "value": scan_time + value: scan_time }; item.id = item["message-id"]; @@ -221,15 +221,15 @@ define(["jquery", "footable", "humanize"], item.time = unix_time_format(item.unix_time); preprocess_item(item); item.scan_time = { - "options": { - "sortValue": item.scan_time + options: { + sortValue: item.scan_time }, - "value": item.scan_time + value: item.scan_time }; item.time = { - "value": unix_time_format(item.unix_time), - "options": { - "sortValue": item.unix_time + value: unix_time_format(item.unix_time), + options: { + sortValue: item.unix_time } }; @@ -241,9 +241,9 @@ define(["jquery", "footable", "humanize"], function columns_v2() { return [{ - "name": "id", - "title": "ID", - "style": { + name: "id", + title: "ID", + style: { "font-size": "11px", "minWidth": 130, "overflow": "hidden", @@ -252,106 +252,106 @@ define(["jquery", "footable", "humanize"], "whiteSpace": "normal" } }, { - "name": "ip", - "title": "IP address", - "breakpoints": "xs sm md", - "style": { + name: "ip", + title: "IP address", + breakpoints: "xs sm md", + style: { "font-size": "11px", "minWidth": 88 } }, { - "name": "sender_mime", - "title": "[Envelope From] From", - "breakpoints": "xs sm md", - "style": { + name: "sender_mime", + title: "[Envelope From] From", + breakpoints: "xs sm md", + style: { "font-size": "11px", "minWidth": 100, "maxWidth": 200, "word-wrap": "break-word" } }, { - "name": "rcpt_mime_short", - "title": "[Envelope To] To/Cc/Bcc", - "breakpoints": "xs sm md", - "style": { + name: "rcpt_mime_short", + title: "[Envelope To] To/Cc/Bcc", + breakpoints: "xs sm md", + style: { "font-size": "11px", "minWidth": 100, "maxWidth": 200, "word-wrap": "break-word" } }, { - "name": "rcpt_mime", - "title": "[Envelope To] To/Cc/Bcc", - "breakpoints": "all", - "style": { + name: "rcpt_mime", + title: "[Envelope To] To/Cc/Bcc", + breakpoints: "all", + style: { "font-size": "11px", "word-wrap": "break-word" } }, { - "name": "subject", - "title": "Subject", - "breakpoints": "xs sm md", - "style": { + name: "subject", + title: "Subject", + breakpoints: "xs sm md", + style: { "font-size": "11px", "word-break": "break-all", "minWidth": 150 } }, { - "name": "action", - "title": "Action", - "style": { + name: "action", + title: "Action", + style: { "font-size": "11px", "minwidth": 82 } }, { - "name": "score", - "title": "Score", - "style": { + name: "score", + title: "Score", + style: { "font-size": "11px", "maxWidth": 110 }, - "sortValue": function (val) { return Number(val.options.sortValue); } + sortValue: function (val) { return Number(val.options.sortValue); } }, { - "name": "symbols", - "title": "Symbols", - "breakpoints": "all", - "style": { + name: "symbols", + title: "Symbols", + breakpoints: "all", + style: { "font-size": "11px", "width": 550, "maxWidth": 550 } }, { - "name": "size", - "title": "Msg size", - "breakpoints": "xs sm md", - "style": { + name: "size", + title: "Msg size", + breakpoints: "xs sm md", + style: { "font-size": "11px", "minwidth": 50, }, - "formatter": Humanize.compactInteger + formatter: Humanize.compactInteger }, { - "name": "scan_time", - "title": "Scan time", - "breakpoints": "xs sm md", - "style": { + name: "scan_time", + title: "Scan time", + breakpoints: "xs sm md", + style: { "font-size": "11px", "maxWidth": 72 }, - "sortValue": function (val) { return Number(val.options.sortValue); } + sortValue: function (val) { return Number(val.options.sortValue); } }, { - "sorted": true, - "direction": "DESC", - "name": "time", - "title": "Time", - "style": { + sorted: true, + direction: "DESC", + name: "time", + title: "Time", + style: { "font-size": "11px" }, - "sortValue": function (val) { return Number(val.options.sortValue); } + sortValue: function (val) { return Number(val.options.sortValue); } }, { - "name": "user", - "title": "Authenticated user", - "breakpoints": "xs sm md", - "style": { + name: "user", + title: "Authenticated user", + breakpoints: "xs sm md", + style: { "font-size": "11px", "minWidth": 100, "maxWidth": 130, @@ -362,9 +362,9 @@ define(["jquery", "footable", "humanize"], function columns_legacy() { return [{ - "name": "id", - "title": "ID", - "style": { + name: "id", + title: "ID", + style: { "font-size": "11px", "width": 300, "maxWidth": 300, @@ -374,72 +374,72 @@ define(["jquery", "footable", "humanize"], "whiteSpace": "nowrap" } }, { - "name": "ip", - "title": "IP address", - "breakpoints": "xs sm", - "style": { + name: "ip", + title: "IP address", + breakpoints: "xs sm", + style: { "font-size": "11px", "width": 150, "maxWidth": 150 } }, { - "name": "action", - "title": "Action", - "style": { + name: "action", + title: "Action", + style: { "font-size": "11px", "width": 110, "maxWidth": 110 } }, { - "name": "score", - "title": "Score", - "style": { + name: "score", + title: "Score", + style: { "font-size": "11px", "maxWidth": 110 }, - "sortValue": function (val) { return Number(val.options.sortValue); } + sortValue: function (val) { return Number(val.options.sortValue); } }, { - "name": "symbols", - "title": "Symbols", - "breakpoints": "all", - "style": { + name: "symbols", + title: "Symbols", + breakpoints: "all", + style: { "font-size": "11px", "width": 550, "maxWidth": 550 } }, { - "name": "size", - "title": "Message size", - "breakpoints": "xs sm", - "style": { + name: "size", + title: "Message size", + breakpoints: "xs sm", + style: { "font-size": "11px", "width": 120, "maxWidth": 120 }, - "formatter": Humanize.compactInteger + formatter: Humanize.compactInteger }, { - "name": "scan_time", - "title": "Scan time", - "breakpoints": "xs sm", - "style": { + name: "scan_time", + title: "Scan time", + breakpoints: "xs sm", + style: { "font-size": "11px", "maxWidth": 80 }, - "sortValue": function (val) { return Number(val.options.sortValue); } + sortValue: function (val) { return Number(val.options.sortValue); } }, { - "sorted": true, - "direction": "DESC", - "name": "time", - "title": "Time", - "style": { + sorted: true, + direction: "DESC", + name: "time", + title: "Time", + style: { "font-size": "11px" }, - "sortValue": function (val) { return Number(val.options.sortValue); } + sortValue: function (val) { return Number(val.options.sortValue); } }, { - "name": "user", - "title": "Authenticated user", - "breakpoints": "xs sm", - "style": { + name: "user", + title: "Authenticated user", + breakpoints: "xs sm", + style: { "font-size": "11px", "width": 200, "maxWidth": 200 @@ -448,13 +448,13 @@ define(["jquery", "footable", "humanize"], } var process_functions = { - "2": process_history_v2, - "legacy": process_history_legacy + 2: process_history_v2, + legacy: process_history_legacy }; var columns = { - "2": columns_v2, - "legacy": columns_legacy + 2: columns_v2, + legacy: columns_legacy }; function process_history_data(data) { @@ -495,14 +495,14 @@ define(["jquery", "footable", "humanize"], $create : function () { this._super(); var self = this, $form_grp = $("<div/>", { - "class" : "form-group" + class : "form-group" }).append($("<label/>", { - "class" : "sr-only", + class : "sr-only", text : "Action" })).prependTo(self.$form); self.$action = $("<select/>", { - "class" : "form-control" + class : "form-control" }).on("change", { self : self }, self._onStatusDropdownChanged).append( @@ -546,9 +546,9 @@ define(["jquery", "footable", "humanize"], // Update symbol description tooltips $.each(symbolDescriptions, function (key, description) { $("abbr[data-sym-key=" + key + "]").tooltip({ - "placement": "bottom", - "html": true, - "title": description + placement: "bottom", + html: true, + title: description }); }); }; @@ -585,25 +585,25 @@ define(["jquery", "footable", "humanize"], var items = process_history_data(data); ft.history = FooTable.init("#historyTable", { - "columns": get_history_columns(data), - "rows": items, - "paging": { - "enabled": true, - "limit": 5, - "size": 25 + columns: get_history_columns(data), + rows: items, + paging: { + enabled: true, + limit: 5, + size: 25 }, - "filtering": { - "enabled": true, - "position": "left", - "connectors": false + filtering: { + enabled: true, + position: "left", + connectors: false }, - "sorting": { - "enabled": true + sorting: { + enabled: true }, - "components": { - "filtering": FooTable.actionFilter + components: { + filtering: FooTable.actionFilter }, - "on": { + on: { "ready.ft.table": drawTooltips, "after.ft.sorting": drawTooltips, "after.ft.paging": drawTooltips, @@ -630,25 +630,25 @@ define(["jquery", "footable", "humanize"], success: function (data) { var items = process_history_data(data); ft.history = FooTable.init("#historyTable", { - "columns": get_history_columns(data), - "rows": items, - "paging": { - "enabled": true, - "limit": 5, - "size": 25 + columns: get_history_columns(data), + rows: items, + paging: { + enabled: true, + limit: 5, + size: 25 }, - "filtering": { - "enabled": true, - "position": "left", - "connectors": false + filtering: { + enabled: true, + position: "left", + connectors: false }, - "sorting": { - "enabled": true + sorting: { + enabled: true }, - "components": { - "filtering": FooTable.actionFilter + components: { + filtering: FooTable.actionFilter }, - "on": { + on: { "ready.ft.table": drawTooltips, "after.ft.sorting": drawTooltips, "after.ft.paging": drawTooltips, @@ -717,27 +717,27 @@ define(["jquery", "footable", "humanize"], ); }); ft.errors = FooTable.init("#errorsLog", { - "columns": [ - {"sorted": true, "direction": "DESC", "name":"ts", "title":"Time", "style":{"font-size":"11px", "width":300, "maxWidth":300}}, - {"name":"type", "title":"Worker type", "breakpoints":"xs sm", "style":{"font-size":"11px", "width":150, "maxWidth":150}}, - {"name":"pid", "title":"PID", "breakpoints":"xs sm", "style":{"font-size":"11px", "width":110, "maxWidth":110}}, - {"name":"module", "title":"Module", "style":{"font-size":"11px"}}, - {"name":"id", "title":"Internal ID", "style":{"font-size":"11px"}}, - {"name":"message", "title":"Message", "breakpoints":"xs sm", "style":{"font-size":"11px"}}, + columns: [ + {sorted: true, direction: "DESC", name:"ts", title:"Time", style:{"font-size":"11px", "width":300, "maxWidth":300}}, + {name:"type", title:"Worker type", breakpoints:"xs sm", style:{"font-size":"11px", "width":150, "maxWidth":150}}, + {name:"pid", title:"PID", breakpoints:"xs sm", style:{"font-size":"11px", "width":110, "maxWidth":110}}, + {name:"module", title:"Module", style:{"font-size":"11px"}}, + {name:"id", title:"Internal ID", style:{"font-size":"11px"}}, + {name:"message", title:"Message", breakpoints:"xs sm", style:{"font-size":"11px"}}, ], - "rows": data, - "paging": { - "enabled": true, - "limit": 5, - "size": 25 + rows: data, + paging: { + enabled: true, + limit: 5, + size: 25 }, - "filtering": { - "enabled": true, - "position": "left", - "connectors": false + filtering: { + enabled: true, + position: "left", + connectors: false }, - "sorting": { - "enabled": true + sorting: { + enabled: true } }); } diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 0a69fca99..c60c5889d 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -466,79 +466,79 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, } else { obj = new d3pie(id, $.extend({}, { - "header": { - "title": { - "text": "Rspamd filter stats", - "fontSize": 24, - "font": "open sans" + header: { + title: { + text: "Rspamd filter stats", + fontSize: 24, + font: "open sans" }, - "subtitle": { - "color": "#999999", - "fontSize": 12, - "font": "open sans" + subtitle: { + color: "#999999", + fontSize: 12, + font: "open sans" }, - "titleSubtitlePadding": 9 + titleSubtitlePadding: 9 }, - "footer": { - "color": "#999999", - "fontSize": 10, - "font": "open sans", - "location": "bottom-left" + footer: { + color: "#999999", + fontSize: 10, + font: "open sans", + location: "bottom-left" }, - "size": { - "canvasWidth": 600, - "canvasHeight": 400, - "pieInnerRadius": "20%", - "pieOuterRadius": "85%" + size: { + canvasWidth: 600, + canvasHeight: 400, + pieInnerRadius: "20%", + pieOuterRadius: "85%" }, - "data": { + data: { // "sortOrder": "value-desc", - "content": data.filter(function (elt) { + content: data.filter(function (elt) { return elt.value > 0; }) }, - "labels": { - "outer": { - "hideWhenLessThanPercentage": 1, - "pieDistance": 30 + labels: { + outer: { + hideWhenLessThanPercentage: 1, + pieDistance: 30 }, - "inner": { - "hideWhenLessThanPercentage": 4 + inner: { + hideWhenLessThanPercentage: 4 }, - "mainLabel": { - "fontSize": 14 + mainLabel: { + fontSize: 14 }, - "percentage": { - "color": "#eeeeee", - "fontSize": 14, - "decimalPlaces": 0 + percentage: { + color: "#eeeeee", + fontSize: 14, + decimalPlaces: 0 }, - "lines": { - "enabled": true + lines: { + enabled: true }, - "truncation": { - "enabled": true + truncation: { + enabled: true } }, - "tooltips": { - "enabled": true, - "type": "placeholder", - "string": "{label}: {value} ({percentage}%)" + tooltips: { + enabled: true, + type: "placeholder", + string: "{label}: {value} ({percentage}%)" }, - "effects": { - "pullOutSegmentOnClick": { - "effect": "back", - "speed": 400, - "size": 8 + effects: { + pullOutSegmentOnClick: { + effect: "back", + speed: 400, + size: 8 }, - "load": { - "effect": "none" + load: { + effect: "none" } }, - "misc": { - "gradient": { - "enabled": true, - "percentage": 100 + misc: { + gradient: { + enabled: true, + percentage: 100 } } }, conf)); diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js index c76f51945..c75b20441 100644 --- a/interface/js/app/stats.js +++ b/interface/js/app/stats.js @@ -143,30 +143,30 @@ define(["jquery", "d3pie", "humanize"], 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 : "#66CC00", + label : "Clean", + data : data.clean, + value : data.clean }, { - "color" : "#BF8040", - "label" : "Temporarily rejected", - "data" : data.soft_reject, - "value" : data.soft_reject + 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 : "#FFAD00", + label : "Probable spam", + data : data.probable, + value : data.probable }, { - "color" : "#436EEE", - "label" : "Greylisted", - "data" : data.greylist, - "value" : data.greylist + color : "#436EEE", + label : "Greylisted", + data : data.greylist, + value : data.greylist }, { - "color" : "#FF0000", - "label" : "Rejected", - "data" : data.reject, - "value" : data.reject + color : "#FF0000", + label : "Rejected", + data : data.reject, + value : data.reject }]; return rspamd.drawPie(pie, "chart", new_data); diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js index f0bd71be9..8b8160913 100644 --- a/interface/js/app/symbols.js +++ b/interface/js/app/symbols.js @@ -175,14 +175,14 @@ define(["jquery", "footable"], $create : function () { this._super(); var self = this, $form_grp = $("<div/>", { - "class" : "form-group" + class : "form-group" }).append($("<label/>", { - "class" : "sr-only", + class : "sr-only", text : "Group" })).prependTo(self.$form); self.$group = $("<select/>", { - "class" : "form-control" + class : "form-control" }).on("change", { self : self }, self._onStatusDropdownChanged).append( @@ -214,33 +214,33 @@ define(["jquery", "footable"], } }); ft.symbols = FooTable.init("#symbolsTable", { - "columns": [ - {"sorted": true, "direction": "ASC", "name":"group", "title":"Group", "style":{"font-size":"11px"}}, - {"name":"symbol", "title":"Symbol", "style":{"font-size":"11px"}}, - {"name":"description", "title":"Description", "breakpoints":"xs sm", "style":{"font-size":"11px"}}, - {"name":"weight", "title":"Score", "style":{"font-size":"11px"}}, - {"name":"frequency", "title":"Frequency", "breakpoints":"xs sm", "style":{"font-size":"11px"}, "sortValue": function (value) { return Number(value).toFixed(2); }}, - {"name":"time", "title":"Avg. time", "breakpoints":"xs sm", "style":{"font-size":"11px"}}, - {"name":"save", "title":"Save", "style":{"font-size":"11px"}}, + columns: [ + {sorted: true, direction: "ASC", name:"group", title:"Group", style:{"font-size":"11px"}}, + {name:"symbol", title:"Symbol", style:{"font-size":"11px"}}, + {name:"description", title:"Description", breakpoints:"xs sm", style:{"font-size":"11px"}}, + {name:"weight", title:"Score", style:{"font-size":"11px"}}, + {name:"frequency", title:"Frequency", breakpoints:"xs sm", style:{"font-size":"11px"}, sortValue: function (value) { return Number(value).toFixed(2); }}, + {name:"time", title:"Avg. time", breakpoints:"xs sm", style:{"font-size":"11px"}}, + {name:"save", title:"Save", style:{"font-size":"11px"}}, ], - "rows": items[0], - "paging": { - "enabled": true, - "limit": 5, - "size": 25 + rows: items[0], + paging: { + enabled: true, + limit: 5, + size: 25 }, - "filtering": { - "enabled": true, - "position": "left", - "connectors": false + filtering: { + enabled: true, + position: "left", + connectors: false }, - "sorting": { - "enabled": true + sorting: { + enabled: true }, components: { filtering: FooTable.groupFilter }, - "on": { + on: { "ready.ft.table": function () { if (rspamd.read_only) { $(".mb-disabled").attr("disabled", true); diff --git a/interface/js/app/upload.js b/interface/js/app/upload.js index 655a5dfb2..648ee3620 100644 --- a/interface/js/app/upload.js +++ b/interface/js/app/upload.js @@ -140,8 +140,8 @@ define(["jquery"], // Show tooltips $.each(sym_desc, function (k, v) { $("#" + k).tooltip({ - "placement": "bottom", - "title": v + placement: "bottom", + title: v }); }); $("html, body").animate({ |