[Kimchi-devel] [PATCH V4] Bugfix: Cancel option not working properly in New Storage Define

Yu Xin Huo huoyuxin at linux.vnet.ibm.com
Mon Sep 29 10:07:14 UTC 2014


Reviewed By Yu Xin Huo.

On 9/29/2014 6:03 PM, Wen Wang wrote:
> From: Wen Wang <wenwang at linux.vnet.ibm.com>
>
> V3 -> V4:
> Move the duplicate part to a function that reduce the duplication.
>
> V2 -> V3:
> Make the button style change properly with different storage pool types.
>
> V1 -> V2:
> Make the "Create" button change style and disable the input box only
> when clicked on "ok" in "confirm" diaguage. The button and the input
> style stay the same if user cancel the creating job.
>
> This bug fix the defect that when adding a new logical storage pool, a
> confrim message box show up and when canceling it, the inputbox as well
> as button "Create" is still disabled.
>
> Signed-off-by: Wen Wang <wenwang at linux.vnet.ibm.com>
> ---
>   ui/js/src/kimchi.storagepool_add_main.js |   37 +++++++++++++-----------------
>   1 files changed, 16 insertions(+), 21 deletions(-)
>
> diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
> index 4f1f943..ffe8fb6 100644
> --- a/ui/js/src/kimchi.storagepool_add_main.js
> +++ b/ui/js/src/kimchi.storagepool_add_main.js
> @@ -352,8 +352,6 @@ kimchi.validateLogicalForm = function () {
>
>   kimchi.addPool = function(event) {
>       if (kimchi.validateForm()) {
> -        $('#pool-doAdd').hide();
> -        $('#pool-loading').show();
>           var formData = $('#form-pool-add').serializeObject();
>           delete formData.authname;
>           var poolType = $('#poolTypeId').selectMenu('value');
> @@ -390,16 +388,11 @@ kimchi.addPool = function(event) {
>           } else if (poolType === 'scsi'){
>               formData.source = { adapter_name: $('#scsiAdapter').selectMenu('value') };
>           }
> -        $('input', '#form-pool-add').attr('disabled','disabled');
> -        if (poolType === 'logical') {
> -            var settings = {
> -                title : i18n['KCHAPI6001M'],
> -                content : i18n['KCHPOOL6003M'],
> -                confirm : i18n['KCHAPI6002M'],
> -                cancel : i18n['KCHAPI6003M']
> -            };
> -            kimchi.confirm(settings, function() {
> -                kimchi.createStoragePool(formData, function() {
> +        var storagePoolAddingFunc = function() {
> +            $('input', '#form-pool-add').attr('disabled','disabled');
> +            $('#pool-doAdd').hide();
> +            $('#pool-loading').show();
> +            kimchi.createStoragePool(formData, function() {
>                       kimchi.doListStoragePools();
>                       kimchi.window.close();
>                   }, function(err) {
> @@ -408,18 +401,20 @@ kimchi.addPool = function(event) {
>                       $('#pool-loading').hide();
>                       $('#pool-doAdd').show();
>                   });
> +        };
> +        if (poolType === 'logical') {
> +            var settings = {
> +                title : i18n['KCHAPI6001M'],
> +                content : i18n['KCHPOOL6003M'],
> +                confirm : i18n['KCHAPI6002M'],
> +                cancel : i18n['KCHAPI6003M']
> +            };
> +            kimchi.confirm(settings, function() {
> +                storagePoolAddingFunc();
>               }, function() {
>               });
>           } else {
> -            kimchi.createStoragePool(formData, function() {
> -                kimchi.doListStoragePools();
> -                kimchi.window.close();
> -            }, function(err) {
> -                kimchi.message.error(err.responseJSON.reason);
> -                $('input', '#form-pool-add').removeAttr('disabled');
> -                $('#pool-loading').hide();
> -                $('#pool-doAdd').show();
> -            });
> +            storagePoolAddingFunc();
>           }
>       }
>   };





More information about the Kimchi-devel mailing list