[Kimchi-devel] [PATCH] Bug 431 Fix

huoyuxin at linux.vnet.ibm.com huoyuxin at linux.vnet.ibm.com
Tue Sep 23 09:34:18 UTC 2014


From: Yu Xin Huo <huoyuxin at linux.vnet.ibm.com>

Signed-off-by: Yu Xin Huo <huoyuxin at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.storage_main.js |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
index 28b2b58..9a45b65 100644
--- a/ui/js/src/kimchi.storage_main.js
+++ b/ui/js/src/kimchi.storage_main.js
@@ -21,7 +21,7 @@ kimchi.doListStoragePools = function() {
         if (result && result.length) {
             var listHtml = '';
             $.each(result, function(index, value) {
-                value.usage = parseInt(value.allocated / value.capacity * 100) || 0;
+                value.usage = Math.round(value.allocated / value.capacity * 100) || 0;
                 value.capacity = kimchi.changetoProperUnit(value.capacity,1);
                 value.allocated = kimchi.changetoProperUnit(value.allocated,1);
                 value.enableExt = value.type==="logical" ? "" : "hide-content";
@@ -313,7 +313,12 @@ kimchi.initLogicalPoolExtend = function() {
                 $("input[type='checkbox']:checked", "#logicalPoolExtend").each(function(){
                     devicePaths.push($(this).prop('value'));
                 })
-                kimchi.updateStoragePool($("#logicalPoolExtend").dialog("option", "poolName"),{disks: devicePaths});
+                kimchi.updateStoragePool($("#logicalPoolExtend").dialog("option", "poolName"),{disks: devicePaths},function(data){
+                    var item = $("#"+$("#logicalPoolExtend").dialog("option", "poolName"));
+                    $(".usage", $(".storage-name", item)).text((Math.round(data.allocated/data.capacity*100)||0)+"%");
+                    $(".storage-text", $(".storage-capacity", item)).text(kimchi.changetoProperUnit(data.capacity,1));
+                    $(".storage-text", $(".storage-allocate", item)).text(kimchi.changetoProperUnit(data.allocated,1));
+                });
                 $(this).dialog("close");
             }
         }]
-- 
1.7.1




More information about the Kimchi-devel mailing list