You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/02/06 06:45:20 UTC

[19/27] git commit: refs/heads/vim51_win8 - Summary: resizeVolume needs to be available in UI

Summary: resizeVolume needs to be available in UI

Detail: Adds UI element for resizing a volume

BUG-ID: CLOUDSTACK-644
Reported-by: hongtu_zang@tcloudcomputing.com
Signed-off-by: Marcus Sorensen <ma...@betterservers.com> 1360091087 -0700


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

Branch: refs/heads/vim51_win8
Commit: 4f274d0b8ed9ad57bd9621bb0c9fc46c10990534
Parents: 750fb2c
Author: Marcus Sorensen <ma...@betterservers.com>
Authored: Tue Feb 5 12:04:47 2013 -0700
Committer: Marcus Sorensen <ma...@betterservers.com>
Committed: Tue Feb 5 12:04:47 2013 -0700

----------------------------------------------------------------------
 .../WEB-INF/classes/resources/messages.properties  |    6 +
 .../classes/resources/messages_fr_FR.properties    |    6 +
 .../classes/resources/messages_ja.properties       |    8 +-
 .../classes/resources/messages_pt_BR.properties    |    6 +
 .../classes/resources/messages_ru_RU.properties    |    8 ++
 .../classes/resources/messages_zh_CN.properties    |    6 +
 ui/css/cloudstack3.css                             |    2 +
 ui/dictionary.jsp                                  |    6 +-
 ui/scripts/storage.js                              |   99 +++++++++++++++
 9 files changed, 145 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f274d0b/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index eda0778..bb845d8 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -1545,3 +1545,9 @@ label.nicira.controller.address=Controller Address
 label.nicira.transportzoneuuid=Transport Zone Uuid
 label.nicira.l3gatewayserviceuuid=L3 Gateway Service Uuid
 
+#resizeVolumes
+label.resize.new.size=New Size(GB)
+label.action.resize.volume=Resize Volume
+label.action.resize.volume.processing=Resizing Volume....
+label.resize.new.offering.id=New Offering
+label.resize.shrink.ok=Shrink OK
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f274d0b/client/WEB-INF/classes/resources/messages_fr_FR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_fr_FR.properties b/client/WEB-INF/classes/resources/messages_fr_FR.properties
index 4ba3c72..51bf95f 100644
--- a/client/WEB-INF/classes/resources/messages_fr_FR.properties
+++ b/client/WEB-INF/classes/resources/messages_fr_FR.properties
@@ -1510,3 +1510,9 @@ error.menu.select=Echec de l\'action car il n\'y a aucun 
 error.mgmt.server.inaccessible=Le serveur de management est indisponible. Essayez plus tard.
 error.session.expired=Votre session a expir�.
 error.unresolved.internet.name=Votre nom internet ne peut pas �tre r�solu.
+#resizeVolumes
+label.resize.new.size=New Size(GB)
+label.action.resize.volume=Resize Volume
+label.action.resize.volume.processing=Resizing Volume....
+label.resize.new.offering.id=New Offering
+label.resize.shrink.ok=Shrink OK
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f274d0b/client/WEB-INF/classes/resources/messages_ja.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ja.properties b/client/WEB-INF/classes/resources/messages_ja.properties
index 7555b83..8397a8d 100644
--- a/client/WEB-INF/classes/resources/messages_ja.properties
+++ b/client/WEB-INF/classes/resources/messages_ja.properties
@@ -1509,4 +1509,10 @@ error.login=ユーザー名/パスワードが記録と一致しません。
 error.menu.select=項目が選択されていないため操作を実行できません。
 error.mgmt.server.inaccessible=管理サーバーにアクセスできません。後で再実行してください。
 error.session.expired=セッションの有効期限が切れました。
-error.unresolved.internet.name=インターネット名を解決できません。
+
+#resizeVolumes
+label.resize.new.size=New Size(GB)
+label.action.resize.volume=Resize Volume
+label.action.resize.volume.processing=Resizing Volume....
+label.resize.new.offering.id=New Offering
+label.resize.shrink.ok=Shrink OK
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f274d0b/client/WEB-INF/classes/resources/messages_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_pt_BR.properties b/client/WEB-INF/classes/resources/messages_pt_BR.properties
index 3bc435b..23ba5b9 100644
--- a/client/WEB-INF/classes/resources/messages_pt_BR.properties
+++ b/client/WEB-INF/classes/resources/messages_pt_BR.properties
@@ -1510,3 +1510,9 @@ error.menu.select=N
 error.mgmt.server.inaccessible=O servidor de gerenciamento está inacessível. Tente novamente mais tarde.
 error.session.expired=Sua sessão expirou.
 error.unresolved.internet.name=Impossível resolver DNS
+#resizeVolumes
+label.resize.new.size=New Size(GB)
+label.action.resize.volume=Resize Volume
+label.action.resize.volume.processing=Resizing Volume....
+label.resize.new.offering.id=New Offering
+label.resize.shrink.ok=Shrink OK
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f274d0b/client/WEB-INF/classes/resources/messages_ru_RU.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ru_RU.properties b/client/WEB-INF/classes/resources/messages_ru_RU.properties
index dd7e746..024b552 100644
--- a/client/WEB-INF/classes/resources/messages_ru_RU.properties
+++ b/client/WEB-INF/classes/resources/messages_ru_RU.properties
@@ -1510,3 +1510,11 @@ error.menu.select=Не удается выполнить действие из-
 error.mgmt.server.inaccessible=Сервер управления недоступна. Попробуйте обратиться к нему позже.
 error.session.expired=Ваша сессия была завершена
 error.unresolved.internet.name=Ваше интернет-имя определить не удалось
+
+#resizeVolumes
+label.resize.new.size=New Size(GB)
+label.action.resize.volume=Resize Volume
+label.action.resize.volume.processing=Resizing Volume....
+label.resize.new.offering.id=New Offering
+label.resize.shrink.ok=Shrink OK
+

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f274d0b/client/WEB-INF/classes/resources/messages_zh_CN.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_zh_CN.properties b/client/WEB-INF/classes/resources/messages_zh_CN.properties
index 62160d9..2e2e725 100644
--- a/client/WEB-INF/classes/resources/messages_zh_CN.properties
+++ b/client/WEB-INF/classes/resources/messages_zh_CN.properties
@@ -1511,3 +1511,9 @@ error.mgmt.server.inaccessible=无法访问管理服务器。请稍后再试。
 error.session.expired=您的会话已过期。
 error.unresolved.internet.name=无法解析您的 Internet 名称。
 
+#resizeVolumes
+label.resize.new.size=New Size(GB)
+label.action.resize.volume=Resize Volume
+label.action.resize.volume.processing=Resizing Volume....
+label.resize.new.offering.id=New Offering
+label.resize.shrink.ok=Shrink OK
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f274d0b/ui/css/cloudstack3.css
----------------------------------------------------------------------
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css
index eb42843..6cb82f2 100644
--- a/ui/css/cloudstack3.css
+++ b/ui/css/cloudstack3.css
@@ -11159,10 +11159,12 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it
   background-position: -100px -614px;
 }
 
+.resize .icon,
 .updateResourceCount .icon {
   background-position: -167px -66px;
 }
 
+.resize:hover .icon,
 .updateResourceCount:hover .icon {
   background-position: -167px -648px;
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f274d0b/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index 77dfdc9..d2cb67f 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -1432,6 +1432,10 @@ dictionary = {
 'label.delete.NiciraNvp': '<fmt:message key="label.delete.NiciraNvp" />',
 'label.nicira.controller.address': '<fmt:message key="label.nicira.controller.address" />',
 'label.nicira.transportzoneuuid': '<fmt:message key="label.nicira.transportzoneuuid" />',
-'label.nicira.l3gatewayserviceuuid': '<fmt:message key="label.nicira.l3gatewayserviceuuid" />'
+'label.nicira.l3gatewayserviceuuid': '<fmt:message key="label.nicira.l3gatewayserviceuuid" />',
+'label.resize.new.size': '<fmt:message key="label.resize.new.size" />',
+'label.action.resize.volume': '<fmt:message key="label.action.resize.volume" />',
+'label.resize.new.offering.id': '<fmt:message key="label.resize.new.offering.id" />',
+'label.resize.shrink.ok': '<fmt:message key="label.resize.shrink.ok" />'
 };
 </script>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f274d0b/ui/scripts/storage.js
----------------------------------------------------------------------
diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js
index dd81378..73a496e 100644
--- a/ui/scripts/storage.js
+++ b/ui/scripts/storage.js
@@ -1005,6 +1005,102 @@
                     args.complete();
                   }
                 }
+              },
+              
+              resize: {
+                label: 'label.action.resize.volume',
+                messages: {
+                  notification: function(args) {
+                    return 'label.action.resize.volume';
+                  }
+                },
+                createForm: {
+                  title: 'label.action.resize.volume',
+                  fields: {
+                    newdiskoffering: {
+                      label: 'label.resize.new.offering.id',
+                      select: function(args) {
+                        $.ajax({
+                          url: createURL("listDiskOfferings"),
+                          dataType: "json",
+                          async: false,
+                          success: function(json) {
+                            diskofferingObjs = json.listdiskofferingsresponse.diskoffering;
+                            var items = [];
+                            $(diskofferingObjs).each(function(){
+                              items.push({id: this.id, description: this.displaytext});
+                            });
+                            args.response.success({data: items});
+                          }
+                        });
+
+                        args.$select.change(function() {
+                          var diskOfferingId = $(this).val();
+                          $(diskofferingObjs).each(function(){
+                            if(this.id == diskOfferingId) {
+                              selectedDiskOfferingObj = this;
+                              return false; //break the $.each() loop
+                            }
+                          });
+                          if(selectedDiskOfferingObj == null)
+                            return;
+
+                          var $form = $(this).closest('form');
+                          var $newsize = $form.find('.form-item[rel=newsize]');
+                          if (selectedDiskOfferingObj.iscustomized == true) {
+                            $newsize.css('display', 'inline-block');
+                          }
+                          else {
+                            $newsize.hide();
+                          }
+                        });
+                      }
+                    },
+                    newsize: {
+                      label: 'label.resize.new.size',
+                      validation: { required: true, number: true },
+                      isHidden: true
+                    },
+                    shrinkok: {label: 'label.resize.shrink.ok', isBoolean: true, isChecked: false}
+                  }
+                },
+                action: function(args){
+                  var array1 = [];
+                  array1.push("&shrinkok=" + (args.data.shrinkok == "on"));
+                  var newDiskOffering = args.data.newdiskoffering;
+                  var newSize;
+                  if (selectedDiskOfferingObj.iscustomized == true) {
+                    newSize = args.data.newsize;
+                  }
+                  if (newDiskOffering != null && newDiskOffering.length > 0){
+                    array1.push("&diskofferingid=" + todb(newDiskOffering));
+                  }
+                  if (newSize != null && newSize.length > 0){
+                    array1.push("&size=" + todb(newSize));
+                  }
+                  $.ajax({
+                    url: createURL("resizeVolume&id=" + args.context.volumes[0].id + array1.join("")),
+                    dataType: "json",
+                    async: true,
+                    success: function(json){
+                    var jid = json.resizevolumeresponse.jobid;
+                      args.response.success(
+                        {_custom:
+                          {jobId: jid,
+                            getUpdatedItem: function(json) {
+                              return json.queryasyncjobresultresponse.jobresult.volume;
+                            },
+                            getActionFilter: function() {
+                              return volumeActionfilter;
+                            }
+                          }
+                        });
+                    }
+                  });
+                },
+                notification: {
+                  poll: pollAsyncJobResult
+                }
               }
             },
             tabs: {
@@ -1430,6 +1526,9 @@
     if(jsonObj.hypervisor != "Ovm" && jsonObj.state == "Ready") {
       allowedActions.push("takeSnapshot");
       allowedActions.push("recurringSnapshot");
+      if((jsonObj.hypervisor == "XenServer" || jsonObj.hypervisor == "KVM" || jsonObj.hypervisor == "VMware") && jsonObj.type == "DATADISK") {
+    	  allowedActions.push("resize");
+      }
     }
     if(jsonObj.state != "Allocated") {
       if((jsonObj.vmstate == "Stopped" || jsonObj.virtualmachineid == null) && jsonObj.state == "Ready") {