Skip to content

Commit 6c2f2d3

Browse files
author
Jessica Wang
committed
CLOUDSTACK-2038: cloudstack UI - mixed zone management - template menu - copy template action - populate zone dropdown upon selected zone type on top menu.
1 parent 9e392d2 commit 6c2f2d3

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

ui/scripts/templates.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,29 @@
547547
dataType: "json",
548548
async: true,
549549
success: function(json) {
550-
var zoneObjs = json.listzonesresponse.zone;
551-
var items = [];
552-
$(zoneObjs).each(function() {
553-
if(this.id != args.context.templates[0].zoneid)
554-
items.push({id: this.id, description: this.name});
555-
});
556-
args.response.success({data: items});
550+
var zoneObjs = [];
551+
var items = json.listzonesresponse.zone;
552+
if(args.context.zoneType == null || args.context.zoneType == '') { //all types
553+
if(items != null) {
554+
for(var i = 0; i < items.length; i++) {
555+
if(items[i].id != args.context.templates[0].zoneid) { //destination zone must be different from source zone
556+
zoneObjs.push({id: items[i].id, description: items[i].name});
557+
}
558+
}
559+
}
560+
}
561+
else { //Basic type or Advanced type
562+
if(items != null) {
563+
for(var i = 0; i < items.length; i++) {
564+
if(items[i].networktype == args.context.zoneType) { //type must be matched
565+
if(items[i].id != args.context.templates[0].zoneid) { //destination zone must be different from source zone
566+
zoneObjs.push({id: items[i].id, description: items[i].name});
567+
}
568+
}
569+
}
570+
}
571+
}
572+
args.response.success({data: zoneObjs});
557573
}
558574
});
559575
}

0 commit comments

Comments
 (0)