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

Yu Xin Huo huoyuxin at linux.vnet.ibm.com
Mon Sep 29 09:25:16 UTC 2014


On 9/26/2014 1:47 PM, Wen Wang wrote:
> From: Wen Wang <wenwang at linux.vnet.ibm.com>
>
> 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 |    9 ++++++---
>   1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
> index 4f1f943..07e7fbe 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,7 +388,6 @@ 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'],
> @@ -399,6 +396,9 @@ kimchi.addPool = function(event) {
>                   cancel : i18n['KCHAPI6003M']
>               };
>               kimchi.confirm(settings, function() {
> +                $('input', '#form-pool-add').attr('disabled','disabled');
> +                $('#pool-doAdd').hide();
> +                $('#pool-loading').show();
>                   kimchi.createStoragePool(formData, function() {
>                       kimchi.doListStoragePools();
>                       kimchi.window.close();
> @@ -411,6 +411,9 @@ kimchi.addPool = function(event) {
>               }, function() {
>               });
>           } else {
> +            $('input', '#form-pool-add').attr('disabled','disabled');
> +            $('#pool-doAdd').hide();
> +            $('#pool-loading').show();
>               kimchi.createStoragePool(formData, function() {
>                   kimchi.doListStoragePools();
>                   kimchi.window.close();

duplicate content in the callback of kimchi.confirm and else branch, 
change it to below

var tempFunc = function(){
      $('input', '#form-pool-add').attr('disabled','disabled');
      $('#pool-doAdd').hide();
      $('#pool-loading').show();
      kimchi.createStoragePool(formData, function() {
            kimchi.doListStoragePools();
            kimchi.window.close();};

kimchi.confirm(settings, tempFunc

else {
	tempFunc
}







More information about the Kimchi-devel mailing list