aboutsummaryrefslogtreecommitdiffstats
path: root/interface
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2017-02-21 11:51:48 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2017-02-21 11:51:48 +0300
commit85719f70c71fb5239f1c890bc20984170ada900b (patch)
treeb4d621b9df0f9ed9d238fd18f7d4d4fccae99e84 /interface
parent3480e172837207c3204a62405573250df9a8ef3f (diff)
downloadrspamd-85719f70c71fb5239f1c890bc20984170ada900b.tar.gz
rspamd-85719f70c71fb5239f1c890bc20984170ada900b.zip
[WebUI] Fix graph dataset selector initialization
Diffstat (limited to 'interface')
-rw-r--r--interface/js/app/graph.js43
-rw-r--r--interface/js/app/rspamd.js4
2 files changed, 22 insertions, 25 deletions
diff --git a/interface/js/app/graph.js b/interface/js/app/graph.js
index 86f7ca352..70a510bc3 100644
--- a/interface/js/app/graph.js
+++ b/interface/js/app/graph.js
@@ -82,12 +82,13 @@ function($, D3Evolution, unused) {
}
};
+ // Get selectors' current state
+ function getSelector(id) {
+ var e = document.getElementById(id);
+ return e.options[e.selectedIndex].value;
+ }
+
function initGraph() {
- // Get selectors' current state
- function getSelector(id) {
- var e = document.getElementById(id);
- return e.options[e.selectedIndex].value;
- }
var graph = new D3Evolution("graph", $.extend({}, graph_options, {
type: getSelector("selType"),
interpolate: getSelector("selInterpolate"),
@@ -148,16 +149,6 @@ function($, D3Evolution, unused) {
});
}
- // Handling mouse events on overlapping elements
- $("#rrd-pie").mouseover(function () {
- $("#rrd-pie").css("z-index", "200");
- $("#rrd-table_toggle").css("z-index", "300");
- });
- $("#rrd-table_toggle").mouseover(function () {
- $("#rrd-pie").css("z-index", "0");
- $("#rrd-table_toggle").css("z-index", "0");
- });
-
var interface = {};
interface.draw = function(rspamd, graphs, neighbours, checked_server, type) {
@@ -180,14 +171,6 @@ function($, D3Evolution, unused) {
graphs.graph = initGraph();
}
- if (type === undefined) {
- function getSelector(id) {
- var e = document.getElementById(id);
- return e.options[e.selectedIndex].value;
- }
- type = getSelector("selData");
- }
-
if (checked_server === "All SERVERS") {
rspamd.queryNeighbours("graph", function (req_data) {
var neighbours_data = req_data
@@ -257,5 +240,19 @@ function($, D3Evolution, unused) {
});
};
+ interface.setup = function() {
+ // Handling mouse events on overlapping elements
+ $("#rrd-pie").mouseover(function () {
+ $("#rrd-pie").css("z-index", "200");
+ $("#rrd-table_toggle").css("z-index", "300");
+ });
+ $("#rrd-table_toggle").mouseover(function () {
+ $("#rrd-pie").css("z-index", "0");
+ $("#rrd-table_toggle").css("z-index", "0");
+ });
+
+ return getSelector("selData");
+ };
+
return interface;
});
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js
index 13ffaba49..598112e9b 100644
--- a/interface/js/app/rspamd.js
+++ b/interface/js/app/rspamd.js
@@ -181,7 +181,6 @@ define(['jquery', 'd3pie', 'visibility', 'app/stats', 'app/graph', 'app/config',
// Public functions
interface.alertMessage = alertMessage;
interface.setup = function() {
- // Bind event handlers to selectors
$("#selData").change(function () {
selData = this.value;
tabClick("#throughput_nav");
@@ -221,7 +220,8 @@ define(['jquery', 'd3pie', 'visibility', 'app/stats', 'app/graph', 'app/config',
tab_config.setup(interface);
tab_symbols.setup(interface, tables);
tab_history.setup(interface, tables);
- tab_upload.setup(interface)
+ tab_upload.setup(interface);
+ selData = tab_graph.setup();
};
interface.connect = function() {