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 3EAA4F12D for ; Thu, 11 Apr 2013 22:13:12 +0000 (UTC) Received: (qmail 93825 invoked by uid 500); 11 Apr 2013 22:13:09 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 93742 invoked by uid 500); 11 Apr 2013 22:13:09 -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 93522 invoked by uid 99); 11 Apr 2013 22:13:09 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Apr 2013 22:13:09 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 4D879880E82; Thu, 11 Apr 2013 22:13:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bfederle@apache.org To: commits@cloudstack.apache.org Date: Thu, 11 Apr 2013 22:13:14 -0000 Message-Id: <69d3644271464705b1a00216086dd406@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [06/48] git commit: updated refs/heads/ui-vm-affinity to 96999be CLOUDSTACK-1910: cloudstack UI - Regions menu - implement create GSLB action. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9a50d2bd Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9a50d2bd Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9a50d2bd Branch: refs/heads/ui-vm-affinity Commit: 9a50d2bd3b592a673d1a4aa1492a8282f5dfd737 Parents: ca8ac08 Author: Jessica Wang Authored: Thu Apr 11 11:14:04 2013 -0700 Committer: Jessica Wang Committed: Thu Apr 11 11:14:36 2013 -0700 ---------------------------------------------------------------------- ui/scripts/regions.js | 136 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 134 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a50d2bd/ui/scripts/regions.js ---------------------------------------------------------------------- diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index 0aaece0..129fc7a 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -216,6 +216,139 @@ fields: { name: { label: 'label.name' } }, + + //??? + actions: { + add: { + label: 'Add GSLB', + + messages: { + confirm: function(args) { + return 'Add GSLB'; + }, + notification: function(args) { + return 'Add GSLB'; + } + }, + + createForm: { + title: 'Add GSLB', + fields: { + name: { + label: 'label.name', + validation: { required: true } + }, + description: { + label: 'label.description' + }, + domainid: { + label: 'Domain', + select: function(args) { + if(isAdmin() || isDomainAdmin()) { + $.ajax({ + url: createURL('listDomains'), + data: { + listAll: true, + details: 'min' + }, + success: function(json) { + var array1 = [{id: '', description: ''}]; + var domains = json.listdomainsresponse.domain; + if(domains != null && domains.length > 0) { + for(var i = 0; i < domains.length; i++) { + array1.push({id: domains[i].id, description: domains[i].path}); + } + } + args.response.success({ + data: array1 + }); + } + }); + } + else { + args.response.success({ + data: null + }); + } + }, + isHidden: function(args) { + if(isAdmin() || isDomainAdmin()) + return false; + else + return true; + } + }, + account: { + label: 'Account', + isHidden: function(args) { + if(isAdmin() || isDomainAdmin()) + return false; + else + return true; + } + }, + gslblbmethod: { + label: 'Algorithm', + select: function(args) { + var array1 = [{id: 'roundrobin', description: 'roundrobin'}, {id: 'leastconn', description: 'leastconn'}, {id: 'proximity', description: 'proximity'}]; + args.response.success({ + data: array1 + }); + } + }, + gslbdomainname: { + label: 'Domain Name', + validation: { required: true } + }, + gslbservicetype: { + label: 'Service Type', + select: function(args) { + var array1 = [{id: 'tcp', description: 'tcp'}, {id: 'udp', description: 'udp'}]; + args.response.success({ + data: array1 + }); + }, + validation: { required: true } + } + } + }, + action: function(args) { + var data = { + name: args.data.name, + regionid: args.context.regions[0].id, + gslblbmethod: args.data.gslblbmethod, + gslbdomainname: args.data.gslbdomainname, + gslbservicetype: args.data.gslbservicetype + }; + if(args.data.description != null && args.data.description.length > 0) + $.extend(data, { description: args.data.description }); + if(args.data.domainid != null && args.data.domainid.length > 0) + $.extend(data, { domainid: args.data.domainid }); + if(args.data.account != null && args.data.account.length > 0) + $.extend(data, { account: args.data.account }); + + $.ajax({ + url: createURL('createGlobalLoadBalancerRule'), + data: data, + success: function(json) { + var item = json.creategloballoadbalancerruleresponse.globalloadbalancerrule; + args.response.success({data: item}); + }, + error: function(data) { + args.response.error(parseXMLHttpResponse(data)); + } + }); + }, + + notification: { + poll: function(args) { + args.complete(); + } + } + } + }, + //??? + dataProvider: function(args) { if('regions' in args.context) { var data = { @@ -224,8 +357,7 @@ $.ajax({ url: createURL('listGlobalLoadBalancerRules'), data: data, - success: function(json) { - debugger; + success: function(json) { var items = json.listgloballoadbalancerrulesresponse.globalloadbalancerrule; args.response.success({ data: items