aboutsummaryrefslogtreecommitdiffstats
path: root/interface
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2018-08-30 11:38:35 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2018-09-01 15:05:13 +0300
commitc9d823157837c2aff14e4db978109f6298e4409d (patch)
tree5699771ca05b63e5650b7d722284b8ee39be2591 /interface
parent7fcc91d400a3cce02787a059357e0398a335bc26 (diff)
downloadrspamd-c9d823157837c2aff14e4db978109f6298e4409d.tar.gz
rspamd-c9d823157837c2aff14e4db978109f6298e4409d.zip
[WebUI] Destroy summary table on disconnect
Diffstat (limited to 'interface')
-rw-r--r--interface/js/app/graph.js23
-rw-r--r--interface/js/app/rspamd.js4
2 files changed, 13 insertions, 14 deletions
diff --git a/interface/js/app/graph.js b/interface/js/app/graph.js
index 12e6b4676..a70f09f4c 100644
--- a/interface/js/app/graph.js
+++ b/interface/js/app/graph.js
@@ -28,7 +28,6 @@
define(["jquery", "d3evolution", "footable"],
function ($, D3Evolution) {
"use strict";
- var ft;
var rrd_pie_config = {
header: {},
@@ -139,7 +138,7 @@ define(["jquery", "d3evolution", "footable"],
}, []);
}
- function updateSummaryTable(data) {
+ function updateSummaryTable(tables, data) {
var total_messages = 0;
var rows = data.map(function (curr, i) {
total_messages += curr.value;
@@ -155,11 +154,11 @@ define(["jquery", "d3evolution", "footable"],
document.getElementById("rrd-total-value").innerHTML = total_messages;
- ft.rows.load(rows);
+ tables.rrd_summary.rows.load(rows);
}
- function initSummaryTable(data, unit) {
- return FooTable.init("#rrd-table", {
+ function initSummaryTable(tables, data, unit) {
+ tables.rrd_summary = FooTable.init("#rrd-table", {
sorting: {
enabled: true
},
@@ -173,24 +172,24 @@ define(["jquery", "d3evolution", "footable"],
],
on: {
"ready.ft.table": function () {
- updateSummaryTable(data);
+ updateSummaryTable(tables, data);
}
}
});
}
- function drawRrdTable(data, unit) {
- if (ft) {
- updateSummaryTable(data);
+ function drawRrdTable(tables, data, unit) {
+ if (Object.prototype.hasOwnProperty.call(tables, "rrd_summary")) {
+ updateSummaryTable(tables, data);
} else {
- ft = initSummaryTable(data, unit);
+ initSummaryTable(tables, data, unit);
}
}
var ui = {};
var prevUnit = "msg/s";
- ui.draw = function (rspamd, graphs, neighbours, checked_server, type) {
+ ui.draw = function (rspamd, graphs, tables, neighbours, checked_server, type) {
function updateWidgets(data) {
var rrd_summary = [];
var unit = "msg/s";
@@ -224,7 +223,7 @@ define(["jquery", "d3evolution", "footable"],
$(".unit").text(unit);
prevUnit = unit;
}
- drawRrdTable(rrd_summary, unit);
+ drawRrdTable(tables, rrd_summary, unit);
}
if (!graphs.graph) {
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js
index 4cfc99954..4e0e57841 100644
--- a/interface/js/app/rspamd.js
+++ b/interface/js/app/rspamd.js
@@ -84,14 +84,14 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
});
break;
case "#throughput_nav":
- tab_graph.draw(ui, graphs, neighbours, checked_server, selData);
+ tab_graph.draw(ui, graphs, tables, neighbours, checked_server, selData);
var autoRefresh = {
hourly: 60000,
daily: 300000
};
timer_id.throughput = Visibility.every(autoRefresh[selData] || 3600000, function () {
- tab_graph.draw(ui, graphs, neighbours, checked_server, selData);
+ tab_graph.draw(ui, graphs, tables, neighbours, checked_server, selData);
});
break;
case "#configuration_nav":