From 86b6050c322aeb881d68e2235ee91fecbd1d974b Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Thu, 10 Aug 2017 01:03:35 +0200 Subject: [PATCH] CLOUDSTACK-10042: Properly show ICMP SecGroup Rules (#2233) A simple if-statement would fail if either the type or code were 0 as that if-statement failed them. By checking if they are defined and casting them to a String afterwards this makes the if-statement properly resolve and show the rule as it should. Signed-off-by: Wido den Hollander --- ui/scripts/network.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 569e31db58d..6b9257a2e79 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -26,11 +26,19 @@ tags: elem.tags }; + if (typeof elem.icmptype != 'undefined') { + var icmptype = elem.icmptype.toString() + } + + if (typeof elem.icmpcode != 'undefined') { + var icmpcode = elem.icmpcode.toString() + } + if (elemData.startport == 0 && elemData.endport) { elemData.startport = '0'; - } else if (elem.icmptype && elem.icmpcode) { - elemData.startport = elem.icmptype; - elemData.endport = elem.icmpcode; + } else if (icmptype && icmpcode) { + elemData.startport = icmptype; + elemData.endport = icmpcode; } return elemData;