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/ui-vm-affinity to 35681f3
Date Sat, 20 Apr 2013 00:38:11 GMT
Updated Branches:
  refs/heads/ui-vm-affinity b03fb208a -> 35681f3e0


CLOUDSTACK-2074: cloudstack UI - Affinity - Instances page - Change Affinity action - implement
API call.


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

Branch: refs/heads/ui-vm-affinity
Commit: 35681f3e06fc17e2a499e76a0c3694aac995c328
Parents: b03fb20
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Fri Apr 19 17:37:22 2013 -0700
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Fri Apr 19 17:37:22 2013 -0700

----------------------------------------------------------------------
 ui/scripts/instances.js |   40 ++++++++++++++++++++++++++++++++++------
 1 files changed, 34 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35681f3e/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index 8699b4d..b497a78 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -679,20 +679,48 @@
                     }
                   }
                 },
-                action: function(args) {
-                  args.response.success();
+                action: function(args) {                  
+									var affinityGroupIdArray = [];
+									if(args.context.affinityGroups != null) {
+									  for(var i = 0; i < args.context.affinityGroups.length; i++) {										  
+											if(args.context.affinityGroups[i]._isSelected == true) {
+											  affinityGroupIdArray.push(args.context.affinityGroups[i].id);
+											}
+										}
+									}									
+									var data = {
+									  id: args.context.instances[0].id,
+										affinitygroupids: affinityGroupIdArray.join(",")
+									};									
+									$.ajax({
+									  url: createURL('updateVMAffinityGroup'),
+										data: data,
+										success: function(json) {										  
+											var jid = json.updatevirtualmachineresponse.jobid;											
+											args.response.success(
+												{_custom:
+												 {jobId: jid,
+													getUpdatedItem: function(json) {													  
+														return json.queryasyncjobresultresponse.jobresult.virtualmachine;
+													},
+													getActionFilter: function() {
+														return vmActionfilter;
+													}
+												 }
+												}
+											);												
+										}
+									});			
                 }
               })
             },
             messages: {
               notification: function(args) {
-                return 'label.action.enable.static.NAT';
+                return 'Change affinity';
               }
             },
             notification: {
-              poll: function(args) {
-                args.complete();
-              }
+              poll: pollAsyncJobResult
             }
           },
 


Mime
View raw message