You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2012/08/07 01:00:34 UTC

git commit: cloudstack 3.0 UI - infrastructure - zone detail - network service providers - VPC Virtual Router - Instances tab - detailView - add ChangeService action.

Updated Branches:
  refs/heads/vpc 1e69966f7 -> 8da249e2a


cloudstack 3.0 UI - infrastructure - zone detail - network service providers - VPC Virtual Router - Instances tab - detailView - add ChangeService action.


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

Branch: refs/heads/vpc
Commit: 8da249e2a3a666da602439dde2a523c2e859aae9
Parents: 1e69966
Author: Jessica Wang <je...@citrix.com>
Authored: Mon Aug 6 15:38:28 2012 -0700
Committer: Jessica Wang <je...@citrix.com>
Committed: Mon Aug 6 16:00:05 2012 -0700

----------------------------------------------------------------------
 ui/scripts/system.js |   68 +++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 65 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8da249e2/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 52bb16b..c9134d6 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -2544,7 +2544,64 @@
                           poll: pollAsyncJobResult
                         }
                       },
-
+										
+											changeService: {
+												label: 'label.change.service.offering',
+												createForm: {
+													title: 'label.change.service.offering',
+													desc: '',
+													fields: {
+														serviceOfferingId: {
+															label: 'label.compute.offering',
+															select: function(args) {																															
+																$.ajax({
+																	url: createURL('listServiceOfferings'),
+																	data: {
+																	  issystem: true,
+																	  systemvmtype: 'domainrouter'
+																	},
+																	success: function(json) {																	 
+																		var serviceofferings = json.listserviceofferingsresponse.serviceoffering;
+																		var items = [];
+																		$(serviceofferings).each(function() {		
+																			if(this.id != args.context.routers[0].serviceofferingid) {
+																				items.push({id: this.id, description: this.name});  //default one (i.e. "System Offering For Software Router") doesn't have displaytext property. So, got to use name property instead.
+																			}
+																		});																	
+																		args.response.success({data: items});
+																	}
+																});
+															}
+														}
+													}
+												},
+												messages: {
+													notification: function(args) {
+														return 'label.change.service.offering';
+													}
+												},
+												action: function(args) {												  
+													$.ajax({
+														url: createURL("changeServiceForRouter&id=" + args.context.routers[0].id + "&serviceofferingid=" + args.data.serviceOfferingId),
+														dataType: "json",
+														async: true,
+														success: function(json) {
+															var jsonObj = json.changeserviceforrouterresponse.domainrouter;
+															args.response.success({data: jsonObj});
+														},
+														error: function(XMLHttpResponse) {
+															var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
+															args.response.error(errorMsg);
+														}
+													});
+												},
+												notification: {
+													poll: function(args) {
+														args.complete();
+													}
+												}
+											},											
+											
 											'remove': {
 												label: 'label.destroy.router',
 												messages: {
@@ -9557,7 +9614,10 @@
     if (jsonObj.state == 'Running') {
       allowedActions.push("stop");
       allowedActions.push("restart");
-      //allowedActions.push("changeService");
+			
+			if(jsonObj.vpcid != null) 
+        allowedActions.push("changeService");
+				
       allowedActions.push("viewConsole");
       if (isAdmin())
         allowedActions.push("migrate");
@@ -9565,7 +9625,9 @@
     else if (jsonObj.state == 'Stopped') {
       allowedActions.push("start");
 	    allowedActions.push("remove");
-      //allowedActions.push("changeService");
+			
+      if(jsonObj.vpcid != null)
+        allowedActions.push("changeService");
     }
     return allowedActions;
   }