Skip to content

Commit 86b6050

Browse files
widoyadvr
authored andcommitted
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 <wido@widodh.nl>
1 parent a577813 commit 86b6050

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

ui/scripts/network.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,19 @@
2626
tags: elem.tags
2727
};
2828

29+
if (typeof elem.icmptype != 'undefined') {
30+
var icmptype = elem.icmptype.toString()
31+
}
32+
33+
if (typeof elem.icmpcode != 'undefined') {
34+
var icmpcode = elem.icmpcode.toString()
35+
}
36+
2937
if (elemData.startport == 0 && elemData.endport) {
3038
elemData.startport = '0';
31-
} else if (elem.icmptype && elem.icmpcode) {
32-
elemData.startport = elem.icmptype;
33-
elemData.endport = elem.icmpcode;
39+
} else if (icmptype && icmpcode) {
40+
elemData.startport = icmptype;
41+
elemData.endport = icmpcode;
3442
}
3543

3644
return elemData;

0 commit comments

Comments
 (0)