You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/12/07 08:14:30 UTC

[03/17] git commit: updated refs/heads/master to f30fbe9

CLOUDSTACK-9101: add UI support for root volume resize


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

Branch: refs/heads/master
Commit: d6e21f74163212b198731ddf23dd48bc4c787b84
Parents: 119b27b
Author: Wei Zhou <w....@tech.leaseweb.com>
Authored: Thu Dec 3 11:53:42 2015 +0100
Committer: Wei Zhou <w....@tech.leaseweb.com>
Committed: Thu Dec 3 14:54:47 2015 +0100

----------------------------------------------------------------------
 ui/scripts/storage.js | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6e21f74/ui/scripts/storage.js
----------------------------------------------------------------------
diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js
index 77bd002..599802a 100644
--- a/ui/scripts/storage.js
+++ b/ui/scripts/storage.js
@@ -1536,14 +1536,27 @@
                                 },
                                 createForm: {
                                     title: 'label.action.resize.volume',
+                                    preFilter: function(args) {
+                                        if (args.context.volumes != null && args.context.volumes[0].type == 'ROOT') {
+                                            args.$form.find('.form-item[rel=newdiskoffering]').hide();
+                                        } else {
+                                            args.$form.find('.form-item[rel=newsize]').hide();
+                                        }
+                                    },
                                     fields: {
                                         newdiskoffering: {
                                             label: 'label.resize.new.offering.id',
                                             select: function(args) {
+                                                if (args.context.volumes != null && args.context.volumes[0].type == 'ROOT') {
+                                                    args.response.success({
+                                                        data: []
+                                                    });
+                                                    return;
+                                                }
+
                                                 $.ajax({
                                                     url: createURL("listDiskOfferings"),
                                                     dataType: "json",
-                                                    async: false,
                                                     success: function(json) {
                                                         diskofferingObjs = json.listdiskofferingsresponse.diskoffering;
                                                         var items = [];
@@ -1605,8 +1618,7 @@
                                             validation: {
                                                 required: true,
                                                 number: true
-                                            },
-                                            isHidden: true
+                                            }
                                         },
                                         shrinkok: {
                                             label: 'label.resize.shrink.ok',
@@ -1640,7 +1652,7 @@
 
                                     var newDiskOffering = args.data.newdiskoffering;
                                     var newSize;
-                                    if (selectedDiskOfferingObj.iscustomized == true) {
+                                    if (selectedDiskOfferingObj == null || selectedDiskOfferingObj.iscustomized == true) {
                                         newSize = args.data.newsize;
                                     }
                                     if (newDiskOffering != null && newDiskOffering.length > 0) {
@@ -1651,9 +1663,9 @@
                                     }
 
                                     var minIops;
-                                    var maxIops
+                                    var maxIops;
 
-                                    if (selectedDiskOfferingObj.iscustomizediops == true) {
+                                    if (selectedDiskOfferingObj != null && selectedDiskOfferingObj.iscustomizediops == true) {
                                         minIops = args.data.minIops;
                                         maxIops = args.data.maxIops;
                                     }
@@ -2338,11 +2350,14 @@
                 allowedActions.push("takeSnapshot");
                 allowedActions.push("recurringSnapshot");
             }
+        }
 
-            if (jsonObj.type == "DATADISK") {
+        if (jsonObj.hypervisor == "KVM" || jsonObj.hypervisor == "XenServer" || jsonObj.hypervisor == "VMware") {
+            if (jsonObj.state == "Ready" || jsonObj.state == "Allocated") {
                 allowedActions.push("resize");
             }
         }
+
         if (jsonObj.state != "Allocated") {
             if ((jsonObj.vmstate == "Stopped" || jsonObj.virtualmachineid == null) && jsonObj.state == "Ready") {
                 allowedActions.push("downloadVolume");