Merge "Bug 380 SwitchManager.getHardwareMAC() does not handle empty string case"
authorGiovanni Meo <gmeo@cisco.com>
Wed, 29 Jan 2014 05:38:31 +0000 (05:38 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 29 Jan 2014 05:38:31 +0000 (05:38 +0000)
opendaylight/web/root/src/main/resources/js/lib.js
opendaylight/web/troubleshoot/src/main/resources/js/page.js

index d32f60e..00eacdf 100644 (file)
@@ -27,15 +27,15 @@ one.lib.dashlet = {
         return $h4;
     },
     label : function(name, type) {
-       var $span = $(document.createElement('span'));
-       $span.addClass('label');
-       if (type !== undefined) {
-               $span.addClass(type);
-       } else if (type !== null) {
-               $span.addClass('label-info');
-       }
-       $span.append(name);
-       return $span;
+        var $span = $(document.createElement('span'));
+        $span.addClass('label');
+        if (type !== undefined) {
+            $span.addClass(type);
+        } else if (type !== null) {
+            $span.addClass('label-info');
+        }
+        $span.append(name);
+        return $span;
     },
     list : function(list) {
         var $ul = $(document.createElement('ul'));
@@ -371,6 +371,18 @@ one.lib.nav = {
     }
 }
 
+one.lib.helper = {
+    parseInt : function(value) {
+        return (value !== null && value !== '') ?
+            parseInt(value) : ''
+    },
+    parseFloat : function(value) {
+        return (value !== null && value !== '') ?
+            parseFloat(value) : ''
+    }
+}
+
+
 /** ALERT */
 one.lib.alert = function(alert) {
     $("#alert p").text(alert);
index 3ccec22..a8673b0 100644 (file)
@@ -207,13 +207,26 @@ one.f.troubleshooting.existingNodes = {
                             item["statistics"] = "<a href=\"javascript:one.f.troubleshooting.existingNodes.load.flows('" + item["nodeId"] + "');\">Flows</a>" + 
                             " <a href=\"javascript:one.f.troubleshooting.existingNodes.load.ports('" + item["nodeId"] + "');\">Ports</a>";
                         });
-
                     },
                     delay: 0
                 });
                 return source;
             },
             portsGrid: function(data) {
+                $.each(data.nodeData, function(index, item) {
+                    item.rxPkts = one.lib.helper.parseInt(item.rxPkts);
+                    item.txPkts = one.lib.helper.parseInt(item.txPkts);
+                    item.rxBytes = one.lib.helper.parseInt(item.rxBytes);
+                    item.txBytes = one.lib.helper.parseInt(item.txBytes);
+                    item.rxDrops = one.lib.helper.parseInt(item.rxDrops);
+                    item.txDrops = one.lib.helper.parseInt(item.txDrops);
+                    item.rxErrors = one.lib.helper.parseInt(item.rxErrors);
+                    item.txErrors = one.lib.helper.parseInt(item.txErrors);
+                    item.rxFrameErrors = one.lib.helper.parseInt(item.rxFrameErrors);
+                    item.rxOverRunErrors = one.lib.helper.parseInt(item.rxOverRunErrors);
+                    item.rxCRCErrors = one.lib.helper.parseInt(item.rxCRCErrors);
+                    item.collisions = one.lib.helper.parseInt(item.collisions);
+                });
                 var source = new StaticDataSource({
                     columns: [
                         {
@@ -311,6 +324,13 @@ one.f.troubleshooting.existingNodes = {
                 return result;
             },
             flowsGrid: function(data) {
+                $.each(data.nodeData, function(index, item) {
+                    item.byteCount = one.lib.helper.parseInt(item.byteCount);
+                    item.packetCount = one.lib.helper.parseInt(item.packetCount);
+                    item.durationSeconds = one.lib.helper.parseInt(item.durationSeconds);
+                    item.idleTimeout = one.lib.helper.parseInt(item.idleTimeout);
+                    item.priority = one.lib.helper.parseInt(item.priority);
+                });
                 var source = new StaticDataSource({
                     columns: [
                         {