[Kimchi-devel] [PATCH 5/5] storagepool: Use callback functions when deleting a pool

Crístian Viana vianac at linux.vnet.ibm.com
Mon Jan 20 22:09:38 UTC 2014


After deleting a storage pool, the page may update the pool list even if
the operation has not been finished. That results in inconsistent
information in the UI, like duplicate or missing entries. Also, if there
is an error during this operation, nothing is displayed to the user.

Make sure the storage pool list is updated only after the delete
operation finishes successfully, and display an error message if
something goes wrong.

Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.storage_main.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
index 169e32a..5605f4b 100644
--- a/ui/js/src/kimchi.storage_main.js
+++ b/ui/js/src/kimchi.storage_main.js
@@ -86,9 +86,12 @@ kimchi.storageBindClick = function() {
         };
         kimchi.confirm(settings, function() {
             var poolName = $pool.data('name');
-            kimchi.deleteStoragePool(poolName);
-            kimchi.doListStoragePools();
-        }, null);
+            kimchi.deleteStoragePool(poolName, function() {
+                kimchi.doListStoragePools();
+            }, function(err) {
+                kimchi.message.error(err.responseJSON.reason);
+            });
+        });
     });
 
     $('.pool-activate').on('click', function(event) {
-- 
1.8.4.2




More information about the Kimchi-devel mailing list