From: Giovanni Meo Date: Wed, 29 Jan 2014 05:38:31 +0000 (+0000) Subject: Merge "Bug 380 SwitchManager.getHardwareMAC() does not handle empty string case" X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~563 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=3279791152f14435935d60e3abcb1c618ddc540f;hp=0311a6b45043fd14f741ceaf7f30c5afeeafc737 Merge "Bug 380 SwitchManager.getHardwareMAC() does not handle empty string case" --- diff --git a/opendaylight/web/root/src/main/resources/js/lib.js b/opendaylight/web/root/src/main/resources/js/lib.js index d32f60e68b..00eacdfce6 100644 --- a/opendaylight/web/root/src/main/resources/js/lib.js +++ b/opendaylight/web/root/src/main/resources/js/lib.js @@ -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); diff --git a/opendaylight/web/troubleshoot/src/main/resources/js/page.js b/opendaylight/web/troubleshoot/src/main/resources/js/page.js index 3ccec224ee..a8673b0031 100644 --- a/opendaylight/web/troubleshoot/src/main/resources/js/page.js +++ b/opendaylight/web/troubleshoot/src/main/resources/js/page.js @@ -207,13 +207,26 @@ one.f.troubleshooting.existingNodes = { item["statistics"] = "Flows" + " Ports"; }); - }, 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: [ {