[PATCH V2] Bugfix: Cancel option not working properly in New Storage Define

From: Wen Wang <wenwang@linux.vnet.ibm.com> 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@linux.vnet.ibm.com> --- ui/js/src/kimchi.storagepool_add_main.js | 6 +++--- 1 files changed, 3 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..c167acd 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-loading').show(); + $('#pool-doAdd').hide(); kimchi.createStoragePool(formData, function() { kimchi.doListStoragePools(); kimchi.window.close(); -- 1.7.1

On 09/25/2014 05:20 AM, Wen Wang wrote:
From: Wen Wang <wenwang@linux.vnet.ibm.com>
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@linux.vnet.ibm.com> --- ui/js/src/kimchi.storagepool_add_main.js | 6 +++--- 1 files changed, 3 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..c167acd 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');
Keep it here, as it can work for multiple type of pools. (see more details below)
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-loading').show(); + $('#pool-doAdd').hide(); kimchi.createStoragePool(formData, function() { kimchi.doListStoragePools(); kimchi.window.close();
The confirmation dialog is only used for "logical" pools. As we want to continue displaying "Please wait..." in the others type of pools (specially for NFS as the pool takes some time to be created), we also need to do the same: + $('#pool-loading').show(); + $('#pool-doAdd').hide(); In the "else" statement. if logical: if confirmed: $('#pool-loading').show(); $('#pool-doAdd').hide(); // There isn't a confirmation dialog so we can change the button message when user selects the "Add" button else: $('#pool-loading').show(); $('#pool-doAdd').hide();

ACK On 09/25/2014 09:07 PM, Aline Manera wrote:
On 09/25/2014 05:20 AM, Wen Wang wrote:
From: Wen Wang <wenwang@linux.vnet.ibm.com>
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@linux.vnet.ibm.com> --- ui/js/src/kimchi.storagepool_add_main.js | 6 +++--- 1 files changed, 3 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..c167acd 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');
Keep it here, as it can work for multiple type of pools. (see more details below)
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-loading').show(); + $('#pool-doAdd').hide(); kimchi.createStoragePool(formData, function() { kimchi.doListStoragePools(); kimchi.window.close();
The confirmation dialog is only used for "logical" pools. As we want to continue displaying "Please wait..." in the others type of pools (specially for NFS as the pool takes some time to be created), we also need to do the same:
+ $('#pool-loading').show(); + $('#pool-doAdd').hide();
In the "else" statement.
if logical: if confirmed: $('#pool-loading').show(); $('#pool-doAdd').hide();
// There isn't a confirmation dialog so we can change the button message when user selects the "Add" button else: $('#pool-loading').show(); $('#pool-doAdd').hide();
-- ======================================================= Best Regards Wang Wen
participants (2)
-
Aline Manera
-
Wen Wang