Updated Branches: refs/heads/master fd2ae034f -> 57167d2ca
CLOUDSTACK-2120: mixed zone management - UI - templates.js - remove obsolete code that has been replaced with new change in global function createURL(). Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/57167d2c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/57167d2c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/57167d2c Branch: refs/heads/master Commit: 57167d2ca6578e36843fc7fe535fec336170fdf9 Parents: fd2ae03 Author: Jessica Wang <[email protected]> Authored: Wed May 1 14:38:10 2013 -0700 Committer: Jessica Wang <[email protected]> Committed: Wed May 1 14:38:23 2013 -0700 ---------------------------------------------------------------------- ui/scripts/templates.js | 106 ++++++++++------------------------------- 1 files changed, 26 insertions(+), 80 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57167d2c/ui/scripts/templates.js ---------------------------------------------------------------------- diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index 52e1135..91038b9 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -116,27 +116,13 @@ dataType: "json", async: true, success: function(json) { - var zoneObjs; - if(args.context.zoneType == null || args.context.zoneType == '') { //all types - zoneObjs = []; - var items = json.listzonesresponse.zone; - if(items != null) { - for(var i = 0; i < items.length; i++) { - zoneObjs.push({id: items[i].id, description: items[i].name}); - } - } - } - 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({id: items[i].id, description: items[i].name}); - } - } + var zoneObjs= []; + var items = json.listzonesresponse.zone; + if(items != null) { + for(var i = 0; i < items.length; i++) { + zoneObjs.push({id: items[i].id, description: items[i].name}); } - } + } if (isAdmin() && !(cloudStack.context.projects && cloudStack.context.projects[0])){ zoneObjs.unshift({id: -1, description: "All Zones"}); } @@ -548,27 +534,14 @@ async: true, success: function(json) { var zoneObjs = []; - var items = json.listzonesresponse.zone; - if(args.context.zoneType == null || args.context.zoneType == '') { //all types - if(items != null) { - for(var i = 0; i < items.length; i++) { - if(items[i].id != args.context.templates[0].zoneid) { //destination zone must be different from source zone - zoneObjs.push({id: items[i].id, description: items[i].name}); - } - } + var items = json.listzonesresponse.zone; + if(items != null) { + for(var i = 0; i < items.length; i++) { + if(items[i].id != args.context.templates[0].zoneid) { //destination zone must be different from source zone + zoneObjs.push({id: items[i].id, description: items[i].name}); + } } - } - else { //Basic type or Advanced type - if(items != null) { - for(var i = 0; i < items.length; i++) { - if(items[i].networktype == args.context.zoneType) { //type must be matched - if(items[i].id != args.context.templates[0].zoneid) { //destination zone must be different from source zone - zoneObjs.push({id: items[i].id, description: items[i].name}); - } - } - } - } - } + } args.response.success({data: zoneObjs}); } }); @@ -894,27 +867,13 @@ dataType: "json", async: true, success: function(json) { - var zoneObjs; - if(args.context.zoneType == null || args.context.zoneType == '') { //all types - zoneObjs = []; - var items = json.listzonesresponse.zone; - if(items != null) { - for(var i = 0; i < items.length; i++) { - zoneObjs.push({id: items[i].id, description: items[i].name}); - } - } - } - 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({id: items[i].id, description: items[i].name}); - } - } + var zoneObjs = []; + var items = json.listzonesresponse.zone; + if(items != null) { + for(var i = 0; i < items.length; i++) { + zoneObjs.push({id: items[i].id, description: items[i].name}); } - } + } if (isAdmin() && !(cloudStack.context.projects && cloudStack.context.projects[0])){ zoneObjs.unshift({id: -1, description: "All Zones"}); } @@ -1224,27 +1183,14 @@ async: true, success: function(json) { var zoneObjs = []; - var items = json.listzonesresponse.zone; - if(args.context.zoneType == null || args.context.zoneType == '') { //all types - if(items != null) { - for(var i = 0; i < items.length; i++) { - if(items[i].id != args.context.isos[0].zoneid) { //destination zone must be different from source zone - zoneObjs.push({id: items[i].id, description: items[i].name}); - } - } + var items = json.listzonesresponse.zone; + if(items != null) { + for(var i = 0; i < items.length; i++) { + if(items[i].id != args.context.isos[0].zoneid) { //destination zone must be different from source zone + zoneObjs.push({id: items[i].id, description: items[i].name}); + } } - } - else { //Basic type or Advanced type - if(items != null) { - for(var i = 0; i < items.length; i++) { - if(items[i].networktype == args.context.zoneType) { //type must be matched - if(items[i].id != args.context.isos[0].zoneid) { //destination zone must be different from source zone - zoneObjs.push({id: items[i].id, description: items[i].name}); - } - } - } - } - } + } args.response.success({data: zoneObjs}); } });
