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/4.2 to 98af560
Date Mon, 07 Oct 2013 17:21:33 GMT
Updated Branches:
  refs/heads/4.2 b63270f1d -> 98af560e9


CLOUDSTACK-4796: UI > Instances > detailView > add new action "Assign Instance to
Another Account".


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

Branch: refs/heads/4.2
Commit: 98af560e9e16ec05bda9df5a8ee3488b52df89bc
Parents: b63270f
Author: Jessica Wang <jessicawang@apache.org>
Authored: Mon Oct 7 10:20:16 2013 -0700
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Mon Oct 7 10:21:19 2013 -0700

----------------------------------------------------------------------
 ui/scripts/instances.js | 81 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 77 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af560e/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index f450702..5eb72a1 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -1336,8 +1336,6 @@
                                         });
                                     }
                                 }
-
-
                             }
                         },
 
@@ -1378,9 +1376,79 @@
                         notification: {
                             poll: pollAsyncJobResult
                         }
-
                     },
-
+                   
+                    assignVmToAnotherAccount: {
+                        label: 'Assign Instance to Another Account',
+                        createForm: {
+                            title: 'Assign Instance to Another Account',
+                            fields: {                                
+                            	domainid: {
+                				    label: 'label.domain',
+                				    validation: {
+                                        required: true
+                                    },
+                				    select: function(args) {	
+                				    	$.ajax({
+            				                url: createURL('listDomains'),
+            				                data: {
+            				                    listAll: true,
+            				                    details: 'min'
+            				                },
+            				                success: function(json) {
+            				                    var array1 = [];
+            				                    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
+            				                    });
+            				                }
+            				            });				                   				                 
+                				    }
+                				},
+                				account: {
+                				    label: 'label.account',
+                				    validation: {
+                                        required: true
+                                    }
+                				}		
+                            }
+                        },
+                        action: function(args) {                            
+                            $.ajax({
+                                url: createURL('assignVirtualMachine&virtualmachine'),
+                                data: {
+                                    virtualmachineid: args.context.instances[0].id,
+                                    domainid: args.data.domainid,
+                                    account: args.data.account
+                                },                                
+                                success: function(json) {   
+                                    var item = json.virtualmachine.virtualmachine;      
                              
+                                    args.response.success({
+                                        data: item
+                                    });                                    
+                                }
+                            });
+                        },
+                        messages: {
+                            notification: function(args) {
+                                return 'Assign Instance to Another Account';
+                            }
+                        },
+                        notification: {
+                            poll: function(args) {
+                                args.complete();
+                            }
+                        }
+                    },                    
+                    
                     viewConsole: {
                         label: 'label.view.console',
                         action: {
@@ -1936,6 +2004,11 @@
             if (jsonObj.hypervisor == "BareMetal") {
                 allowedActions.push("createTemplate");
             }
+            
+            if (isAdmin() || isDomainAdmin()) {
+                allowedActions.push("assignVmToAnotherAccount");
+            }
+            
         } else if (jsonObj.state == 'Starting') {
             //  allowedActions.push("stop");
         } else if (jsonObj.state == 'Error') {


Mime
View raw message