Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward 431ea8e9c -> 9b9154132


CLOUDSTACK-6852: UI - attach volume action - VM dropdown - populate options 
based on whether module is included and whether service is enabled.


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

Branch: refs/heads/4.4-forward
Commit: 9b9154132dbd41acddf4365779fc8af13a2acc4c
Parents: 431ea8e
Author: Jessica Wang <[email protected]>
Authored: Thu Jun 5 13:44:57 2014 -0700
Committer: Jessica Wang <[email protected]>
Committed: Thu Jun 5 13:47:46 2014 -0700

----------------------------------------------------------------------
 ui/scripts/storage.js | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9b915413/ui/scripts/storage.js
----------------------------------------------------------------------
diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js
index 2660aa5..7e71448 100644
--- a/ui/scripts/storage.js
+++ b/ui/scripts/storage.js
@@ -901,6 +901,14 @@
                                                     });
                                                 }
 
+                                              
+                                                var drModuleIncluded = 
isModuleIncluded("dr");
+                                                var volumeDrEnabled = false;   
                                            
+                                                if (drModuleIncluded) {
+                                                    volumeDrEnabled = 
cloudStack.dr.sharedFunctions.isVolumeDrEnabled(args.context.volumes[0]);       
                                             
+                                                }    
+                                                
+                                                
                                                 $(['Running', 
'Stopped']).each(function() {
                                                     $.ajax({
                                                         url: 
createURL('listVirtualMachines'),
@@ -910,11 +918,21 @@
                                                         async: false,
                                                         success: 
function(json) {
                                                             var instanceObjs = 
json.listvirtualmachinesresponse.virtualmachine;
-                                                            
$(instanceObjs).each(function() {
-                                                                items.push({
-                                                                    id: 
this.id,
-                                                                    
description: this.displayname ? this.displayname : this.name
-                                                                });
+                                                            
$(instanceObjs).each(function() {                                               
                
+                                                                if 
(drModuleIncluded) {
+                                                                    var 
vmDrEnabled = cloudStack.dr.sharedFunctions.isVmDrEnabled(this);
+                                                                    if 
(vmDrEnabled == volumeDrEnabled) {
+                                                                        
items.push({
+                                                                            
id: this.id,
+                                                                            
description: this.displayname ? this.displayname : this.name
+                                                                        });
+                                                                    } 
+                                                                } else {
+                                                                    
items.push({
+                                                                        id: 
this.id,
+                                                                        
description: this.displayname ? this.displayname : this.name
+                                                                    });
+                                                                }              
                                                  
                                                             });
                                                         }
                                                     });
@@ -1989,7 +2007,7 @@
         }
 
         if (jsonObj.state != "Creating") {
-            if (jsonObj.type == "ROOT") {
+            if (jsonObj.type == "ROOT") {                
                 if (jsonObj.vmstate == "Stopped") {
                     allowedActions.push("createTemplate");
                 }

Reply via email to