cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: updated refs/heads/master to 9a50d2b
Date Thu, 11 Apr 2013 18:15:00 GMT
Updated Branches:
  refs/heads/master ca8ac08cf -> 9a50d2bd3


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/master
Commit: 9a50d2bd3b592a673d1a4aa1492a8282f5dfd737
Parents: ca8ac08
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Thu Apr 11 11:14:04 2013 -0700
Committer: Jessica Wang <jessica.wang@citrix.com>
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


Mime
View raw message