From: Alexander Moisseev Date: Mon, 27 Aug 2018 16:29:04 +0000 (+0300) Subject: [Minor] Use loop to destroy graphs and tables X-Git-Tag: 1.8.0~201^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F2444%2Fhead;p=rspamd.git [Minor] Use loop to destroy graphs and tables --- 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();