Incorrect heading of a table column in the TroubleShooting GUI
[controller.git] / opendaylight / web / troubleshoot / src / main / resources / js / page.js
index 3f0dc9e81231b50dc098011f20dd53f11ffdcfeb..3ccec224ee90246b5a9e6d6563362b3dab4682b1 100644 (file)
@@ -90,13 +90,10 @@ one.f.troubleshooting.existingNodes = {
             modal: "one_f_troubleshooting_existingNodes_id_modal",
             existingNodesDataGrid: "one_f_troubleshooting_existingNodes_id_datagrid",
             portsDataGrid: "one_f_troubleshooting_existingNodes_id_portsDataGrid",
-            flowsDataGrid: "one_f_troubleshooting_existingNodes_id_flowsDataGrid"
-        },
-        // TODO: Make these values configurable.
-        autoRefreshInterval: {
-            flows: 10000,
-            ports: 10000,
-            refreshRateInterval: 5000
+            flowsDataGrid: "one_f_troubleshooting_existingNodes_id_flowsDataGrid",
+            refreshFlowsButton:"one_f_troubleshooting_existingNodes_id_refreshFlowsButton",
+            refreshPortsButton:"one_f_troubleshooting_existingNodes_id_refreshPortsButton"
+
         },
         load: {
             main: function($dashlet) {
@@ -119,13 +116,21 @@ one.f.troubleshooting.existingNodes = {
             },
             flows: function(nodeId) {
                 try {
-                    clearTimeout(one.f.troubleshooting.existingNodes.registry.refreshTimer);
+                    if(one.f.troubleshooting === undefined){
+                        return;
+                    }
                     $.getJSON(one.main.constants.address.prefix + "/troubleshoot/flowStats?nodeId=" + nodeId, function(content) {
                         $rightBottomDashlet = one.f.troubleshooting.rightBottomDashlet.get();
                         one.f.troubleshooting.rightBottomDashlet.setDashletHeader("Flows");
                         one.lib.dashlet.empty($rightBottomDashlet);
                         $rightBottomDashlet.append(one.lib.dashlet.header("Flow Details"));
-
+                        var button = one.lib.dashlet.button.single("Refresh",
+                                one.f.troubleshooting.existingNodes.id.refreshFlowsButton, "btn-primary", "btn-mini");
+                        var $button = one.lib.dashlet.button.button(button);
+                        $button.click(function() {
+                            one.f.troubleshooting.existingNodes.load.flows(nodeId);
+                        });
+                        $rightBottomDashlet.append($button);
                         var $gridHTML = one.lib.dashlet.datagrid.init(one.f.troubleshooting.existingNodes.id.flowsDataGrid, {
                             searchable: true,
                             filterable: false,
@@ -135,28 +140,26 @@ one.f.troubleshooting.existingNodes = {
                         $rightBottomDashlet.append($gridHTML);
                         var dataSource = one.f.troubleshooting.existingNodes.data.flowsGrid(content);
                         $("#" + one.f.troubleshooting.existingNodes.id.flowsDataGrid).datagrid({dataSource: dataSource});
-
-                        var numberOfFlows = content.nodeData.length;
-                        var refreshRate = one.f.troubleshooting.existingNodes.autoRefreshInterval.flows;
-                        if (numberOfFlows > 0) {
-                            refreshRate += Math.floor(numberOfFlows / 500) *
-                                one.f.troubleshooting.existingNodes.autoRefreshInterval.refreshRateInterval;
-                        }
-                        one.f.troubleshooting.existingNodes.registry.refreshTimer = setTimeout(
-                                one.f.troubleshooting.existingNodes.load.flows,
-                                refreshRate, nodeId);
                     });
                 } catch(e) {}
             },
             ports: function(nodeId) {
                 try {
-                    clearTimeout(one.f.troubleshooting.existingNodes.registry.refreshTimer);
+                    if(one.f.troubleshooting === undefined){
+                        return;
+                    }
                     $.getJSON(one.main.constants.address.prefix + "/troubleshoot/portStats?nodeId=" + nodeId, function(content) {
                         $rightBottomDashlet = one.f.troubleshooting.rightBottomDashlet.get();
                         one.f.troubleshooting.rightBottomDashlet.setDashletHeader("Ports");
                         one.lib.dashlet.empty($rightBottomDashlet);
                         $rightBottomDashlet.append(one.lib.dashlet.header("Port Details"));
-
+                        var button = one.lib.dashlet.button.single("Refresh",
+                                one.f.troubleshooting.existingNodes.id.refreshPortsButton, "btn-primary", "btn-mini");
+                        var $button = one.lib.dashlet.button.button(button);
+                        $button.click(function() {
+                            one.f.troubleshooting.existingNodes.load.ports(nodeId);
+                        });
+                        $rightBottomDashlet.append($button);
                         var $gridHTML = one.lib.dashlet.datagrid.init(one.f.troubleshooting.existingNodes.id.portsDataGrid, {
                             searchable: true,
                             filterable: false,
@@ -166,16 +169,6 @@ one.f.troubleshooting.existingNodes = {
                         $rightBottomDashlet.append($gridHTML);
                         var dataSource = one.f.troubleshooting.existingNodes.data.portsGrid(content);
                         $("#" + one.f.troubleshooting.existingNodes.id.portsDataGrid).datagrid({dataSource: dataSource});
-
-                        var numberOfPorts = content.nodeData.length;
-                        var refreshRate = one.f.troubleshooting.existingNodes.autoRefreshInterval.ports;
-                        if (numberOfPorts > 0) {
-                            refreshRate += Math.floor(numberOfPorts / 500) *
-                                one.f.troubleshooting.existingNodes.autoRefreshInterval.refreshRateInterval;
-                        }
-                        one.f.troubleshooting.existingNodes.registry.refreshTimer = setTimeout(
-                                one.f.troubleshooting.existingNodes.load.ports,
-                                refreshRate, nodeId);
                     });
                 } catch(e) {}
             } 
@@ -199,7 +192,7 @@ one.f.troubleshooting.existingNodes = {
                         },
                         {
                             property: 'nodeId',
-                            label: 'Static Route',
+                            label: 'Node ID',
                             sortable: true
                         },
                         {
@@ -290,7 +283,7 @@ one.f.troubleshooting.existingNodes = {
                         }
                     ],
                     data: data.nodeData,
-                    delay: 200
+                    delay: 0
                 });
                 return source;
             },
@@ -400,16 +393,6 @@ one.f.troubleshooting.existingNodes = {
                             label: 'Idle Timeout',
                             sortable: true
                         },
-                        {
-                            property: 'outPorts',
-                            label: 'Out Ports',
-                            sortable: true
-                        },
-                        {
-                            property: 'outVlanId',
-                            label: 'Out VlanId',
-                            sortable: true
-                        },
                         {
                             property: 'priority',
                             label: 'Priority',
@@ -442,8 +425,6 @@ one.f.troubleshooting.existingNodes = {
                     entry.push(value["packetCount"]);
                     entry.push(value["durationSeconds"]);
                     entry.push(value["idleTimeout"]);
-                    entry.push(value["outPorts"]);
-                    entry.push(value["outVlanId"]);
                     entry.push(value["priority"]);
                     tr.entry = entry;
                     result.push(tr);