[Kimchi-devel] [PATCH] [Kimchi 1/2] Fixed issue #1075 s390x : Edit Template storage tab Storage dropdown shows "default" text

Lucio Correia luciojhc at linux.vnet.ibm.com
Tue Nov 8 11:05:29 UTC 2016


Reviewed-By: Lucio Correia <luciojhc at linux.vnet.ibm.com>

On 08/11/2016 06:34, rajgupta at linux.vnet.ibm.com wrote:
> From: Rajat Gupta <rajat.triumph at gmail.com>
>
> 1. Removed hard code value "default" for storage dropdown
> 2. Initialize drop down with blank option
> 3. apply value to storage drop down and validate
>
> Signed-off-by: Rajat Gupta <rajat.triumph at gmail.com>
> ---
>  ui/js/src/kimchi.template_edit_main.js | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
> index 1a6e473..9992c93 100644
> --- a/ui/js/src/kimchi.template_edit_main.js
> +++ b/ui/js/src/kimchi.template_edit_main.js
> @@ -278,19 +278,17 @@ kimchi.template_edit_main = function() {
>                  $('.template-tab-body', '#form-template-storage').append(nodeStorage);
>                  var storageRow = '#storageRow' + storageData.storageIndex;
>
> -                var storageOptions = '';
> +                var storageOptions = '<option disabled="disabled" selected="selected" value=""></option>';
>                  $.each(storagePoolsInfo, function(poolName, value) {
>                      storageOptions += '<option value="' + poolName + '">' + poolName + '</option>';
>                  });
>
>                  $(storageRow + ' .selectStorageName').append(storageOptions);
>                  if (storageData.storageSource == 'pool') {
> -                    if (!$(storageRow + ' .selectStorageName option[value="' + storageData.storageName + '"]').length) {
> -                        var invalidOption = '<option disabled="disabled" selected="selected" value="' + storageData.storageName + '">' + storageData.storageName + '</option>';
> -                        $(storageRow + ' .selectStorageName').prepend(invalidOption);
> -                        $(storageRow + ' .selectStorageName').parent().addClass('has-error')
> -                    }
>                      $(storageRow + ' .selectStorageName').val(storageData.storageName);
> +                    if(!storageData.storageName){
> +                        $(storageRow + ' .selectStorageName').parent().addClass('has-error');
> +                    }
>                      $(storageRow + ' span.storage-pool').show();
>                      $(storageRow + ' span.storage-path').hide();
>                  } else {
> @@ -427,7 +425,7 @@ kimchi.template_edit_main = function() {
>                  storageID = storageID + 1;
>                  var storageNodeData = {
>                      storageSource: 'pool',
> -                    storageName: 'default',
> +                    storageName: '',
>                      storageType: 'dir',
>                      storageDisk: '10',
>                      storageDiskFormat: 'qcow2',
>


-- 
Lucio Correia
Software Engineer
IBM LTC Brazil




More information about the Kimchi-devel mailing list