Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 072ECFD31 for ; Mon, 15 Apr 2013 23:35:51 +0000 (UTC) Received: (qmail 35080 invoked by uid 500); 15 Apr 2013 23:35:50 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 35051 invoked by uid 500); 15 Apr 2013 23:35:50 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 35044 invoked by uid 99); 15 Apr 2013 23:35:50 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Apr 2013 23:35:50 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 6F9CF1BC82; Mon, 15 Apr 2013 23:35:50 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jessicawang@apache.org To: commits@cloudstack.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/ui-mixed-zone-management to 6c2f2d3 Date: Mon, 15 Apr 2013 23:35:50 +0000 (UTC) Updated Branches: refs/heads/ui-mixed-zone-management 9e392d25b -> 6c2f2d3a9 CLOUDSTACK-2038: cloudstack UI - mixed zone management - template menu - copy template 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/6c2f2d3a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6c2f2d3a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6c2f2d3a Branch: refs/heads/ui-mixed-zone-management Commit: 6c2f2d3a9de1d255854afcce8bd2fc3519696498 Parents: 9e392d2 Author: Jessica Wang Authored: Mon Apr 15 16:35:07 2013 -0700 Committer: Jessica Wang Committed: Mon Apr 15 16:35:07 2013 -0700 ---------------------------------------------------------------------- ui/scripts/templates.js | 30 +++++++++++++++++++++++------- 1 files changed, 23 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c2f2d3a/ui/scripts/templates.js ---------------------------------------------------------------------- diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index b924841..c1e01c1 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -547,13 +547,29 @@ dataType: "json", async: true, success: function(json) { - var zoneObjs = json.listzonesresponse.zone; - var items = []; - $(zoneObjs).each(function() { - if(this.id != args.context.templates[0].zoneid) - items.push({id: this.id, description: this.name}); - }); - args.response.success({data: items}); + 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}); + } + } + } + } + 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}); } }); }