]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Use loop to destroy graphs and tables 2444/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Mon, 27 Aug 2018 16:29:04 +0000 (19:29 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Mon, 27 Aug 2018 16:29:04 +0000 (19:29 +0300)
interface/js/app/rspamd.js

index 5472dc284982009f2b75b00ba2360f80fd868a3d..4cfc999540d5795a0cbfa38f10082fdf9d5e5194 100644 (file)
@@ -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();