You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/04/25 20:08:50 UTC

[32/43] git commit: updated refs/heads/master to 5ce2890

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/master
Commit: 35681f3e06fc17e2a499e76a0c3694aac995c328
Parents: b03fb20
Author: Jessica Wang <je...@citrix.com>
Authored: Fri Apr 19 17:37:22 2013 -0700
Committer: Jessica Wang <je...@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
             }
           },