]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Fix graph dataset selector initialization 1443/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Tue, 21 Feb 2017 08:51:48 +0000 (11:51 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Tue, 21 Feb 2017 08:51:48 +0000 (11:51 +0300)
interface/js/app/graph.js
interface/js/app/rspamd.js

index 86f7ca3521924d74a59e87ed619b04228dd84a54..70a510bc3466580253aa204c4695c35fa17c09db 100644 (file)
@@ -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;
 });
index 13ffaba49dcdff5b83d2a0e4c6d7bd40744700f4..598112e9baa9df908e1774a6589d4c633a2107d9 100644 (file)
@@ -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() {