[pve-devel] [PATCH v6 manager 3/5] ui: lxc/qemu: add disk reassign and action submenu

Fabian Ebner f.ebner at proxmox.com
Thu Apr 7 14:23:38 CEST 2022


Am 05.04.22 um 14:30 schrieb Aaron Lauterer:
> @@ -264,6 +303,7 @@ Ext.define('PVE.lxc.RessourceView', {
>  
>  	    var pending = rec.data.delete || me.hasPendingChanges(key);
>  	    var isDisk = rowdef.tdCls === 'pve-itype-icon-storage';

Pre-existing: this is very brittle and actually broke with commit
fa7980c2bd59612c5cdaa6c4e586b86d30b614c0
I sent a fix, and since there is another small issue and another nit,
see below, you probably want to wait for that and rebase on top for v7.

> +	    let isRootFS = rec.data.key === 'rootfs';
>  	    var isUnusedDisk = key.match(/^unused\d+/);
>  	    var isUsedDisk = isDisk && !isUnusedDisk;
>  

(...)

> diff --git a/www/manager6/qemu/HDReassign.js b/www/manager6/qemu/HDReassign.js
> new file mode 100644
> index 00000000..b6c67964
> --- /dev/null
> +++ b/www/manager6/qemu/HDReassign.js
> @@ -0,0 +1,272 @@
> +Ext.define('PVE.window.HDReassign', {
> +    extend: 'Proxmox.window.Edit',
> +    mixins: ['Proxmox.Mixin.CBind'],
> +
> +    resizable: false,
> +    modal: true,
> +    width: 350,
> +    border: false,
> +    layout: 'fit',
> +    showReset: false,
> +    showProgress: true,
> +    method: 'POST',
> +
> +    viewModel: {
> +	data: {
> +	    mpType: '',
> +	},
> +	formulas: {
> +	    mpMaxCount: get => get('mpType') === 'mp'
> +		? PVE.Utils.mp_counts.mps - 1

Should be .mp.
Or better, the whole expression could now be (untested)
    PVE.Utils.mp_counts[get('mpType')] - 1

> +		: PVE.Utils.mp_counts.unused - 1,
> +	},
> +    },
> +

(...)

> @@ -572,9 +609,15 @@ Ext.define('PVE.qemu.HardwareView', {
>  	    edit_btn.setDisabled(
>  	        deleted || !row.editor || isCloudInit || (isCDRom && !cdromCap) || (isDisk && !diskCap));
>  
> -	    resize_btn.setDisabled(pending || !isUsedDisk || !diskCap);
> -
> -	    move_btn.setDisabled(pending || !(isUsedDisk || isEfi || tpmMoveable) || !diskCap);
> +	    diskaction_btn.setDisabled(
> +		pending ||
> +		!diskCap ||
> +		isCloudInit ||
> +		!(isDisk || isEfi || tpmMoveable),
> +	    );
> +	    move_menuitem.setDisabled(isUnusedDisk);
> +	    reassign_menuitem.setDisabled(pending || (isEfi || tpmMoveable));
> +	    resize_menuitem.setDisabled(pending || !isUsedDisk);

Nit: pending can be dropped from the two expressions for the menu items,
because the whole menu is already disabled if pending is true.

>  
>  	    revert_btn.setDisabled(!pending);
>  	};





More information about the pve-devel mailing list