Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions ui/scripts/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,19 @@
var mapRouterType = function (index, router) {
var routerType = _l('label.menu.system');

if (router.projectid) routerType = _l('label.project');
if (router.vpcid) routerType = _l('label.vpc');
if ("isredundantrouter" in router && router.isredundantrouter) routerType = routerType + " (" + router.redundantstate + ")";
if (router.projectid) {
routerType = _l('label.project');
router.account = router.project;
}

if (router.vpcid) {
routerType = _l('label.vpc');
router.guestnetworkname = router.vpcname;
}

if ("isredundantrouter" in router && router.isredundantrouter) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can use directly router.isredundantrouter here without needing to check if the property isredundantrouter exists in the object router; undefined is interpreted as false.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I get defensive writing code. I guess this is not be necessary here.

router.guestnetworkname = router.guestnetworkname + " (" + router.redundantstate + ")";
}

return $.extend(router, {
routerType: routerType
Expand Down Expand Up @@ -9479,6 +9489,12 @@
publicip: {
label: 'label.public.ip'
},
account: {
label: 'label.account'
},
guestnetworkname: {
label: 'label.network'
},
routerType: {
label: 'label.type'
},
Expand Down