[Kimchi-devel] [PATCH V3] Bugfix:#424 Edit Template, "Disk (GB)" is changing with storage pool

Wen Wang wenwang at linux.vnet.ibm.com
Tue Sep 23 09:23:11 UTC 2014


From: Wen Wang <wenwang at linux.vnet.ibm.com>

V2 -> V3:
Make the value of "Disk(GB)" inputbox consistent with user input. If
choosing iSCSI or SCSI, inputbox is disabled and value of "Disk(GB)" is
refreshed with the system. If changing back, the value stays the same
with user last input.

V1 -> V2:
Considering iSCSI and SCSI situation that we need to have the input box
disabled when choosing iSCSI and SCSI for storage pool and enable when
choosing others.

This patch fix the bug that value of "Disk(GB)" input box is changing
with the item of "Storage Pool" in "Templates" --> "Actions" --> "Edit"
-->"Edit Templates" dialogue. This might be comfusing to user when
changing the "Storage Pool", "Disk(GB)" is changed with it without even
notice. This might confuse the users and is not necessary. Solved by
removing the change.

Signed-off-by: Wen Wang <wenwang at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.template_edit_main.js |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index cb43091..d2bbe23 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -40,6 +40,7 @@ kimchi.template_edit_main = function() {
         }
         var disks = template.disks;
         $('input[name="disks"]').val(disks[0].size);
+        kimchi.templateDiskSize = $('input[name="disks"]').val();
         if (disks[0].volume) {
             var spool_value = $('#form-template-edit [name="storagepool"]').val();
             $('input[name="storagepool"]', templateEditForm).val(spool_value + '/' + disks[0].volume);
@@ -128,19 +129,16 @@ kimchi.template_edit_main = function() {
                 $('input[name="disks"]', templateEditForm).attr('disabled','disabled');
                 return false;
             }, function (err) {
+                $('input[name="disks"]', templateEditForm).val(kimchi.templateDiskSize);
                 kimchi.message.error(err.responseJSON.reason);
             });
         } else {
-            if (origPool == storagepool) {
-                // Previous disk size value
-                $('input[name="disks"]', templateEditForm).val(origDisks[0].size);
-            } else {
-                // Default disk size value
-                $('input[name="disks"]', templateEditForm).val(10);
-            }
             $('input[name="disks"]', templateEditForm).removeAttr('disabled');
         }
     });
+    $('input[name="disks"]', templateEditForm).keyup(function() {
+        kimchi.templateDiskSize = $('input[name="disks"]', templateEditForm).val();
+    });
 
     $('#tmpl-edit-button-save').on('click', function() {
         var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks', 'graphics'];
-- 
1.7.1




More information about the Kimchi-devel mailing list