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

Aline Manera alinefm at linux.vnet.ibm.com
Tue Jan 21 01:03:53 UTC 2014


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 01/20/2014 08:09 PM, Crístian Viana wrote:
> 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) {




More information about the Kimchi-devel mailing list