You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2012/10/06 00:32:45 UTC

[25/49] git commit: cloudstack UI - advanced search - dropdown field - check API permission before making API call.

cloudstack UI - advanced search - dropdown field - check API permission before making API call.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/c812a505
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/c812a505
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/c812a505

Branch: refs/heads/maven-to-rpm
Commit: c812a505495b4a3d641f07cf3d1e5a8899471271
Parents: 20183aa
Author: Jessica Wang <je...@citrix.com>
Authored: Thu Oct 4 17:16:06 2012 -0700
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Sat Oct 6 00:30:27 2012 +0200

----------------------------------------------------------------------
 ui/scripts/events.js    |   43 ++++++++++++--------
 ui/scripts/instances.js |   41 +++++++++++--------
 ui/scripts/network.js   |   90 +++++++++++++++++++++++++----------------
 ui/scripts/projects.js  |   45 ++++++++++++--------
 ui/scripts/storage.js   |   91 +++++++++++++++++++++++++-----------------
 5 files changed, 185 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c812a505/ui/scripts/events.js
----------------------------------------------------------------------
diff --git a/ui/scripts/events.js b/ui/scripts/events.js
index a8e7085..820bb70 100644
--- a/ui/scripts/events.js
+++ b/ui/scripts/events.js
@@ -56,28 +56,36 @@
 								});
 							}
 						},					
+						
 						domainid: {					
 							label: 'Domain',					
 							select: function(args) {
-								$.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});
+								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
+											});
 										}
-										args.response.success({
-											data: array1
-										});
-									}
-								});
+									});
+								}
+								else {
+									args.response.success({
+										data: null
+									});
+								}
 							},
 							isHidden: function(args) {
 								if(isAdmin() || isDomainAdmin())
@@ -86,6 +94,7 @@
 									return true;
 							}
 						},		
+						
 						account: { 
 							label: 'Account',
 							isHidden: function(args) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c812a505/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index baa4b72..22bbbfd 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -86,25 +86,32 @@
 				domainid: {					
 				  label: 'Domain',					
 					select: function(args) {
-						$.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});
+					  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
+									});
 								}
-								args.response.success({
-									data: array1
-								});
-							}
-						});
+							});
+						}
+						else {
+						  args.response.success({
+								data: null
+							});
+						}
 					},
 					isHidden: function(args) {
 					  if(isAdmin() || isDomainAdmin())

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c812a505/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index a4f4a4d..49644c2 100644
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -464,28 +464,36 @@
 								});
 							}						
 						},	
-            domainid: {					
+            						
+						domainid: {					
 							label: 'Domain',					
 							select: function(args) {
-								$.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});
+								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
+											});
 										}
-										args.response.success({
-											data: array1
-										});
-									}
-								});
+									});
+								}
+								else {
+									args.response.success({
+										data: null
+									});
+								}
 							},
 							isHidden: function(args) {
 								if(isAdmin() || isDomainAdmin())
@@ -494,6 +502,7 @@
 									return true;
 							}
 						},		
+						
 						account: { 
 							label: 'Account',
 							isHidden: function(args) {
@@ -3681,28 +3690,36 @@
 								});
 							}						
 						},
-            domainid: {					
+            
+						domainid: {					
 							label: 'Domain',					
 							select: function(args) {
-								$.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});
+								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
+											});
 										}
-										args.response.success({
-											data: array1
-										});
-									}
-								});
+									});
+								}
+								else {
+									args.response.success({
+										data: null
+									});
+								}
 							},
 							isHidden: function(args) {
 								if(isAdmin() || isDomainAdmin())
@@ -3711,6 +3728,7 @@
 									return true;
 							}
 						},		
+						
 						account: { 
 							label: 'Account',
 							isHidden: function(args) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c812a505/ui/scripts/projects.js
----------------------------------------------------------------------
diff --git a/ui/scripts/projects.js b/ui/scripts/projects.js
index ff47ac8..4ad032d 100644
--- a/ui/scripts/projects.js
+++ b/ui/scripts/projects.js
@@ -647,28 +647,36 @@
 								});
 							}						
 						},	
-            domainid: {					
+            
+						domainid: {					
 							label: 'Domain',					
 							select: function(args) {
-								$.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});
+								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
+											});
 										}
-										args.response.success({
-											data: array1
-										});
-									}
-								});
+									});
+								}
+								else {
+									args.response.success({
+										data: null
+									});
+								}
 							},
 							isHidden: function(args) {
 								if(isAdmin() || isDomainAdmin())
@@ -677,6 +685,7 @@
 									return true;
 							}
 						},		
+						
 						account: { 
 							label: 'Account',
 							isHidden: function(args) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c812a505/ui/scripts/storage.js
----------------------------------------------------------------------
diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js
index 827cf4e..5b47b70 100644
--- a/ui/scripts/storage.js
+++ b/ui/scripts/storage.js
@@ -293,29 +293,36 @@
 								});
 							}						
 						},		
-
+						
 						domainid: {					
 							label: 'Domain',					
 							select: function(args) {
-								$.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});
+								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
+											});
 										}
-										args.response.success({
-											data: array1
-										});
-									}
-								});
+									});
+								}
+								else {
+									args.response.success({
+										data: null
+									});
+								}
 							},
 							isHidden: function(args) {
 								if(isAdmin() || isDomainAdmin())
@@ -323,7 +330,8 @@
 								else
 									return true;
 							}
-						},		
+						},								
+						
 						account: { 
 							label: 'Account',
 							isHidden: function(args) {
@@ -1114,28 +1122,36 @@
 
 					advSearchFields: {
 					  name: { label: 'Name' },	
-            domainid: {					
+            
+						domainid: {					
 							label: 'Domain',					
 							select: function(args) {
-								$.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});
+								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
+											});
 										}
-										args.response.success({
-											data: array1
-										});
-									}
-								});
+									});
+								}
+								else {
+									args.response.success({
+										data: null
+									});
+								}
 							},
 							isHidden: function(args) {
 								if(isAdmin() || isDomainAdmin())
@@ -1144,6 +1160,7 @@
 									return true;
 							}
 						},		
+						
 						account: { 
 							label: 'Account',
 							isHidden: function(args) {