From 0ef945420a91e09c89a11831685a9b051051ef5b Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Mon, 27 Aug 2018 19:29:04 +0300 Subject: [PATCH] [Minor] Use loop to destroy graphs and tables --- interface/js/app/rspamd.js | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 5472dc284..4cfc99954 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -53,30 +53,12 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, } function disconnect() { - if (graphs.chart) { - graphs.chart.destroy(); - delete graphs.chart; - } - if (graphs.rrd_pie) { - graphs.rrd_pie.destroy(); - delete graphs.rrd_pie; - } - if (graphs.graph) { - graphs.graph.destroy(); - delete graphs.graph; - } - if (tables.history) { - tables.history.destroy(); - delete tables.history; - } - if (tables.errors) { - tables.errors.destroy(); - delete tables.errors; - } - if (tables.symbols) { - tables.symbols.destroy(); - delete tables.symbols; - } + [graphs, tables].forEach(function (o) { + Object.keys(o).forEach(function (key) { + o[key].destroy(); + delete o[key]; + }); + }); stopTimers(); cleanCredentials(); -- 2.39.5