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.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ba7e49f1 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ba7e49f1 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ba7e49f1 Branch: refs/heads/master Commit: ba7e49f11cd1c482ced8f814a518539ee153b040 Parents: 6544879 Author: Jessica Wang <[email protected]> Authored: Mon Apr 15 15:14:42 2013 -0700 Committer: Jessica Wang <[email protected]> Committed: Mon Apr 15 15:14:42 2013 -0700 ---------------------------------------------------------------------- ui/scripts/storage.js | 44 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 35 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ba7e49f1/ui/scripts/storage.js ---------------------------------------------------------------------- diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js index 54605e2..9f7baf0 100644 --- a/ui/scripts/storage.js +++ b/ui/scripts/storage.js @@ -88,9 +88,22 @@ url: createURL("listZones&available=true"), dataType: "json", async: true, - success: function(json) { - var items = json.listzonesresponse.zone; - args.response.success({descriptionField: 'name', data: items}); + success: function(json) { + var zoneObjs; + if(args.context.zoneType == null || args.context.zoneType == '') { //all types + zoneObjs = json.listzonesresponse.zone; + } + else { //Basic type or Advanced type + zoneObjs = []; + var items = json.listzonesresponse.zone; + if(items != null) { + for(var i = 0; i < items.length; i++) { + if(items[i].networktype == args.context.zoneType) + zoneObjs.push(items[i]); + } + } + } + args.response.success({descriptionField: 'name', data: zoneObjs}); } }); } @@ -208,16 +221,29 @@ availabilityZone: { label: 'label.availability.zone', docID: 'helpUploadVolumeZone', - select: function(args) { - $.ajax({ + select: function(args) { + $.ajax({ url: createURL("listZones&available=true"), dataType: "json", async: true, - success: function(json) { - var items = json.listzonesresponse.zone; - args.response.success({descriptionField: 'name', data: items}); + success: function(json) { + var zoneObjs; + if(args.context.zoneType == null || args.context.zoneType == '') { //all types + zoneObjs = json.listzonesresponse.zone; + } + else { //Basic type or Advanced type + zoneObjs = []; + var items = json.listzonesresponse.zone; + if(items != null) { + for(var i = 0; i < items.length; i++) { + if(items[i].networktype == args.context.zoneType) + zoneObjs.push(items[i]); + } + } + } + args.response.success({descriptionField: 'name', data: zoneObjs}); } - }); + }); } }, format: {
