From e514ce57b5dfba541564828ef6373c0912a9f7cd Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Sun, 8 Jul 2018 10:47:56 +0300 Subject: [PATCH] [WebUI] Avoid using "undefined" property of the global object --- .eslintrc.json | 1 - interface/js/app/graph.js | 2 +- interface/js/app/history.js | 6 +++--- interface/js/app/rspamd.js | 12 ++++++------ 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index c5f2bc59c..71e2b443d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -78,7 +78,6 @@ "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/graph.js b/interface/js/app/graph.js index de90c4a73..c5fba91b1 100644 --- a/interface/js/app/graph.js +++ b/interface/js/app/graph.js @@ -205,7 +205,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..7677550bd 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -612,7 +612,7 @@ define(["jquery", "footable", "humanize"], }); } else if (ft.history) { ft.history.destroy(); - ft.history = undefined; + delete ft.history; } }); } @@ -676,11 +676,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..9b29ffd6d 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -47,27 +47,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(); -- 2.39.5