Skip to content

Commit ba7e49f

Browse files
author
Jessica Wang
committed
CLOUDSTACK-2038: cloudstack UI - mixed zone management - storage menu - volume section - Add volume action, Upload volume action - populate zone dropdown upon selected zone type on top menu.
1 parent 6544879 commit ba7e49f

1 file changed

Lines changed: 35 additions & 9 deletions

File tree

‎ui/scripts/storage.js‎

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,22 @@
8888
url: createURL("listZones&available=true"),
8989
dataType: "json",
9090
async: true,
91-
success: function(json) {
92-
var items = json.listzonesresponse.zone;
93-
args.response.success({descriptionField: 'name', data: items});
91+
success: function(json) {
92+
var zoneObjs;
93+
if(args.context.zoneType == null || args.context.zoneType == '') { //all types
94+
zoneObjs = json.listzonesresponse.zone;
95+
}
96+
else { //Basic type or Advanced type
97+
zoneObjs = [];
98+
var items = json.listzonesresponse.zone;
99+
if(items != null) {
100+
for(var i = 0; i < items.length; i++) {
101+
if(items[i].networktype == args.context.zoneType)
102+
zoneObjs.push(items[i]);
103+
}
104+
}
105+
}
106+
args.response.success({descriptionField: 'name', data: zoneObjs});
94107
}
95108
});
96109
}
@@ -208,16 +221,29 @@
208221
availabilityZone: {
209222
label: 'label.availability.zone',
210223
docID: 'helpUploadVolumeZone',
211-
select: function(args) {
212-
$.ajax({
224+
select: function(args) {
225+
$.ajax({
213226
url: createURL("listZones&available=true"),
214227
dataType: "json",
215228
async: true,
216-
success: function(json) {
217-
var items = json.listzonesresponse.zone;
218-
args.response.success({descriptionField: 'name', data: items});
229+
success: function(json) {
230+
var zoneObjs;
231+
if(args.context.zoneType == null || args.context.zoneType == '') { //all types
232+
zoneObjs = json.listzonesresponse.zone;
233+
}
234+
else { //Basic type or Advanced type
235+
zoneObjs = [];
236+
var items = json.listzonesresponse.zone;
237+
if(items != null) {
238+
for(var i = 0; i < items.length; i++) {
239+
if(items[i].networktype == args.context.zoneType)
240+
zoneObjs.push(items[i]);
241+
}
242+
}
243+
}
244+
args.response.success({descriptionField: 'name', data: zoneObjs});
219245
}
220-
});
246+
});
221247
}
222248
},
223249
format: {

0 commit comments

Comments
 (0)