diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-07-08 19:27:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-08 19:27:43 +0100 |
commit | 99071239e4c40770dfcfa9cc1264e83e2469fe6c (patch) | |
tree | 2498c46e3b85d176c9b35e88c248e07b5f16b63f | |
parent | 4b6e9116cb35304948332c5d70bb74cf9451b612 (diff) | |
parent | 4d2b29abcbe0f61cdf89af0d92cec0003d325a81 (diff) | |
download | rspamd-99071239e4c40770dfcfa9cc1264e83e2469fe6c.tar.gz rspamd-99071239e4c40770dfcfa9cc1264e83e2469fe6c.zip |
Merge pull request #2331 from moisseev/eslint
[WebUI] Minor fixes
-rw-r--r-- | .eslintrc.json | 6 | ||||
-rw-r--r-- | interface/js/app/config.js | 4 | ||||
-rw-r--r-- | interface/js/app/graph.js | 4 | ||||
-rw-r--r-- | interface/js/app/history.js | 15 | ||||
-rw-r--r-- | interface/js/app/rspamd.js | 16 | ||||
-rw-r--r-- | interface/js/app/stats.js | 11 | ||||
-rw-r--r-- | interface/js/app/symbols.js | 2 | ||||
-rw-r--r-- | interface/js/main.js | 4 |
8 files changed, 38 insertions, 24 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index c5f2bc59c..32530cd18 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,6 +3,9 @@ "browser": true }, "extends": "eslint:all", + "globals": { + "define": false + }, "rules": { "array-bracket-newline": ["error", "consistent"], "camelcase": "off", @@ -72,13 +75,10 @@ "no-implicit-coercion": "off", "no-inline-comments": "off", "no-loop-func": "off", - "no-multi-assign": "off", "no-negated-condition": "off", "no-param-reassign": "off", "no-redeclare": "off", "no-shadow": "off", - "no-undef": "off", - "no-undefined": "off", "no-underscore-dangle": "off", "no-use-before-define": "off", "one-var-declaration-per-line": "off", diff --git a/interface/js/app/config.js b/interface/js/app/config.js index fe9d27a16..a64e8f3ab 100644 --- a/interface/js/app/config.js +++ b/interface/js/app/config.js @@ -22,6 +22,8 @@ THE SOFTWARE. */ +/* global $span:true, $tbody:true */ + define(["jquery"], function ($) { var interface = {}; @@ -240,7 +242,7 @@ define(["jquery"], $("#modalTitle").html(item.uri); $("#" + item.map).first().show(); $("#modalDialog .progress").hide(); - $("#modalDialog").modal(show = true, backdrop = true, keyboard = show); + $("#modalDialog").modal({backdrop: true, keyboard: "show", show: true}); if (item.editable === false) { $("#modalSave").hide(); $("#modalSaveAll").hide(); diff --git a/interface/js/app/graph.js b/interface/js/app/graph.js index de90c4a73..6a63500fc 100644 --- a/interface/js/app/graph.js +++ b/interface/js/app/graph.js @@ -23,6 +23,8 @@ THE SOFTWARE. */ +/* global d3:false */ + define(["jquery", "d3evolution", "footable"], function ($, D3Evolution) { var rrd_pie_config = { @@ -205,7 +207,7 @@ define(["jquery", "d3evolution", "footable"], drawRrdTable(rrd_summary, unit); } - if (graphs.graph === undefined) { + if (!graphs.graph) { graphs.graph = initGraph(); } diff --git a/interface/js/app/history.js b/interface/js/app/history.js index e89108185..8147c39a1 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -22,6 +22,8 @@ THE SOFTWARE. */ +/* global FooTable:false */ + define(["jquery", "footable", "humanize"], function ($, _, Humanize) { var interface = {}; @@ -39,13 +41,13 @@ define(["jquery", "footable", "humanize"], var htmlEscaper = /[&<>"'/`=]/g; var symbolDescriptions = {}; - EscapeHTML = function (string) { + var EscapeHTML = function (string) { return ("" + string).replace(htmlEscaper, function (match) { return htmlEscapes[match]; }); }; - escape_HTML_array = function (arr) { + var escape_HTML_array = function (arr) { arr.forEach(function (d, i) { arr[i] = EscapeHTML(d); }); }; @@ -137,7 +139,8 @@ define(["jquery", "footable", "humanize"], return (l > rcpt_lim) ? " … (" + l + ")" : ""; } function format_rcpt(smtp, mime) { - var full = shrt = ""; + var full = ""; + var shrt = ""; if (smtp) { full = "[" + item.rcpt_smtp.join(", ") + "] "; shrt = "[" + item.rcpt_smtp.slice(0, rcpt_lim).join(",​") + more("rcpt_smtp") + "]"; @@ -612,7 +615,7 @@ define(["jquery", "footable", "humanize"], }); } else if (ft.history) { ft.history.destroy(); - ft.history = undefined; + delete ft.history; } }); } @@ -676,11 +679,11 @@ define(["jquery", "footable", "humanize"], } if (ft.history) { ft.history.destroy(); - ft.history = undefined; + delete ft.history; } if (ft.errors) { ft.errors.destroy(); - ft.errors = undefined; + delete ft.errors; } if (checked_server === "All SERVERS") { rspamd.queryNeighbours("errors", function () { diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index c60c5889d..b935cf6c2 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -22,6 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* global jQuery:false, Visibility:false */ + define(["jquery", "d3pie", "visibility", "app/stats", "app/graph", "app/config", "app/symbols", "app/history", "app/upload"], function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, @@ -47,27 +50,27 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, function disconnect() { if (graphs.chart) { graphs.chart.destroy(); - graphs.chart = undefined; + delete graphs.chart; } if (graphs.rrd_pie) { graphs.rrd_pie.destroy(); - graphs.rrd_pie = undefined; + delete graphs.rrd_pie; } if (graphs.graph) { graphs.graph.destroy(); - graphs.graph = undefined; + delete graphs.graph; } if (tables.history) { tables.history.destroy(); - tables.history = undefined; + delete tables.history; } if (tables.errors) { tables.errors.destroy(); - tables.errors = undefined; + delete tables.errors; } if (tables.symbols) { tables.symbols.destroy(); - tables.symbols = undefined; + delete tables.symbols; } stopTimers(); @@ -144,7 +147,6 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, $("#historyLog tbody").remove(); $("#errorsLog tbody").remove(); $("#symbolsTable tbody").remove(); - password = ""; } function isLogged() { diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js index c75b20441..a074d47f8 100644 --- a/interface/js/app/stats.js +++ b/interface/js/app/stats.js @@ -27,12 +27,13 @@ define(["jquery", "d3pie", "humanize"], // @ ms to date function msToTime(seconds) { /* eslint-disable no-bitwise */ - years = seconds / 31536000 >> 0; // 3600*24*365 - months = seconds % 31536000 / 2628000 >> 0; // 3600*24*365/12 - days = seconds % 31536000 % 2628000 / 86400 >> 0; // 24*3600 - hours = seconds % 31536000 % 2628000 % 86400 / 3600 >> 0; - minutes = seconds % 31536000 % 2628000 % 86400 % 3600 / 60 >> 0; + var years = seconds / 31536000 >> 0; // 3600*24*365 + var months = seconds % 31536000 / 2628000 >> 0; // 3600*24*365/12 + var days = seconds % 31536000 % 2628000 / 86400 >> 0; // 24*3600 + var hours = seconds % 31536000 % 2628000 % 86400 / 3600 >> 0; + var minutes = seconds % 31536000 % 2628000 % 86400 % 3600 / 60 >> 0; /* eslint-enable no-bitwise */ + var out; if (years > 0) { if (months > 0) { out = years + "yr " + months + "mth"; diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js index 358deb0e5..a639127f4 100644 --- a/interface/js/app/symbols.js +++ b/interface/js/app/symbols.js @@ -22,6 +22,8 @@ THE SOFTWARE. */ +/* global FooTable:false */ + define(["jquery", "footable"], function ($) { var interface = {}; diff --git a/interface/js/main.js b/interface/js/main.js index af7c63b83..515645667 100644 --- a/interface/js/main.js +++ b/interface/js/main.js @@ -1,3 +1,5 @@ +/* global d3:false, require:false, requirejs:false */ // eslint-disable-line no-unused-vars + requirejs.config({ baseUrl: "js/lib", paths: { @@ -26,7 +28,7 @@ document.title = window.location.hostname + " - Rspamd Web Interface"; define("d3.global", ["d3"], function (_) { - d3 = _; + d3 = _; // eslint-disable-line no-global-assign }); // Load main UI |