[pve-devel] [PATCH manager] refactor HDEdit form change handler
Dietmar Maurer
dietmar at proxmox.com
Tue May 17 06:05:48 CEST 2016
comments inline:
> On May 10, 2016 at 2:25 PM Dominik Csapak <d.csapak at proxmox.com> wrote:
>
>
> the old method of doing this was ugly and error-prone,
> now one can clearly see what the code does
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> www/manager6/qemu/HDEdit.js | 49
> ++++++++++++++++++++-------------------------
> 1 file changed, 22 insertions(+), 27 deletions(-)
>
> diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
> index 36c9206..5543afa 100644
> --- a/www/manager6/qemu/HDEdit.js
> +++ b/www/manager6/qemu/HDEdit.js
> @@ -31,35 +31,30 @@ Ext.define('PVE.qemu.HDInputPanel', {
> }
> var me = this.getView();
> var rec = f.store.getById(value);
> - if (rec.data.type === 'iscsi') {
> - me.hdfilesel.setStorage(value);
> - me.hdfilesel.setDisabled(false);
> - me.formatsel.setValue('raw');
> - me.formatsel.setDisabled(true);
> - me.hdfilesel.setVisible(true);
> - me.hdsizesel.setDisabled(true);
> - me.hdsizesel.setVisible(false);
> - } else if (rec.data.type === 'lvm' ||
> - rec.data.type === 'lvmthin' ||
> - rec.data.type === 'drbd' ||
> - rec.data.type === 'rbd' ||
> - rec.data.type === 'sheepdog' ||
> - rec.data.type === 'zfs' ||
> - rec.data.type === 'zfspool') {
> - me.hdfilesel.setDisabled(true);
> - me.hdfilesel.setVisible(false);
> + var filesel = false;
> + var sizesel = true;
> + var formatsel = true;
> + var rawArray = ['lvm', 'lvmthin', 'drbd', 'rbd', 'sheepdog', 'zfs',
> 'zfspool', 'iscsi'];
> + me.formatsel.setValue('qcow2');
I am not sure this is a good idea. This changes values when user switch storage,
and this is not obvious when switching between file based storages.
More information about the pve-devel
mailing list