From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.ebner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id C0489B953
 for <pve-devel@lists.proxmox.com>; Thu,  7 Apr 2022 14:23:40 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id B77644D93
 for <pve-devel@lists.proxmox.com>; Thu,  7 Apr 2022 14:23:40 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 866064D82
 for <pve-devel@lists.proxmox.com>; Thu,  7 Apr 2022 14:23:39 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 599B441F42
 for <pve-devel@lists.proxmox.com>; Thu,  7 Apr 2022 14:23:39 +0200 (CEST)
Message-ID: <ac19c81a-1d27-d85e-28d6-1ec4e537bebf@proxmox.com>
Date: Thu, 7 Apr 2022 14:23:38 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.7.0
Content-Language: en-US
To: pve-devel@lists.proxmox.com, Aaron Lauterer <a.lauterer@proxmox.com>
References: <20220405123016.2911726-1-a.lauterer@proxmox.com>
 <20220405123016.2911726-4-a.lauterer@proxmox.com>
From: Fabian Ebner <f.ebner@proxmox.com>
In-Reply-To: <20220405123016.2911726-4-a.lauterer@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 1.541 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -2.873 Looks like a legit reply (A)
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: Re: [pve-devel] [PATCH v6 manager 3/5] ui: lxc/qemu: add disk
 reassign and action submenu
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 07 Apr 2022 12:23:40 -0000

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);
>  	};