all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: Fabian Ebner <f.ebner@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH v4 manager 2/6] ui: lxc/qemu: add disk reassign and action submenu
Date: Thu, 24 Mar 2022 11:46:06 +0100	[thread overview]
Message-ID: <2fcb8f65-8b36-e425-d955-3ff5557c18b6@proxmox.com> (raw)
In-Reply-To: <7055bba6-b945-9845-04fc-072d74711151@proxmox.com>

Thanks for the nits. Especially regarding the button (de)activation logic.

I can send a follow-up patch or a new version of the whole series, or just this patch.

Whatever is preferred :)

On 3/22/22 12:18, Fabian Ebner wrote:
> Am 14.03.22 um 10:35 schrieb Aaron Lauterer:
>> @@ -227,14 +246,34 @@ Ext.define('PVE.lxc.RessourceView', {
>>   	    },
>>   	});
>>   
>> -	var move_btn = new Proxmox.button.Button({
>> +	let reassign_menuitem = new Ext.menu.Item({
>> +	    text: gettext('Reassign Volume'),
>> +	    tooltip: gettext('Reassign volume to another CT'),
> 
> 
> Nit: if there is a tooltip for reassign maybe there should also be one
> for move? Otherwise, it feels inconsistent from the perspective of a new
> user ;) Same for VMs.
> 
>> +	    handler: run_reassign,
>> +	    reference: 'reassing_item',
>> +	    disabled: true,
>> +	});
>> +
>> +	let move_menuitem = new Ext.menu.Item({
>>   	    text: gettext('Move Volume'),
>>   	    selModel: me.selModel,
>>   	    disabled: true,
>> -	    dangerous: true,
>>   	    handler: run_move,
>>   	});
>>   
> 
> (...)
> 
>> @@ -265,9 +305,12 @@ Ext.define('PVE.lxc.RessourceView', {
>>   	    }
>>   	    edit_btn.setDisabled(noedit);
>>   
>> -	    remove_btn.setDisabled(!isDisk || rec.data.key === 'rootfs' || !diskCap || pending);
>> -	    resize_btn.setDisabled(!isDisk || !diskCap || isUnusedDisk);
>> -	    move_btn.setDisabled(!isDisk || !diskCap);
>> +	    volumeaction_btn.setDisabled(!isDisk);
> 
> Shouldn't this also check for diskCap?
> 
>> +	    reassign_menuitem.setDisabled(isRootFS);
>> +
>> +	    remove_btn.setDisabled(!isDisk || isRootFS || !diskCap || pending);
>> +	    resize_menuitem.setDisabled(!isDisk || !diskCap || isUnusedDisk);
>> +	    move_menuitem.setDisabled(!isDisk || !diskCap);
> 
> Nit: please group the menu and menuitems together. And since the whole
> menu is disabled if !isDisk, you don't need to repeat that for the
> menuitems (like you already don't for reassign ;)).
> 
>>   	    revert_btn.setDisabled(!pending);
>>   
>>   	    remove_btn.setText(isUsedDisk ? remove_btn.altText : remove_btn.defaultText);
> 
> (...)
> 
>> diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
>> index 6cea4287..af84fb3f 100644
>> --- a/www/manager6/qemu/HardwareView.js
>> +++ b/www/manager6/qemu/HardwareView.js
>> @@ -400,8 +400,8 @@ Ext.define('PVE.qemu.HardwareView', {
>>   	    win.on('destroy', me.reload, me);
>>   	};
>>   
>> -	var run_move = function() {
>> -	    var rec = sm.getSelection()[0];
>> +	let run_move = function() {
>> +	    let rec = sm.getSelection()[0];
>>   	    if (!rec) {
>>   		return;
>>   	    }
> 
> Nit: While it is an improvement, it doesn't actually interact with
> anything else in the patch, and hence doesn't really belong here.
> 
> (...)
> 
>> @@ -611,9 +648,15 @@ Ext.define('PVE.qemu.HardwareView', {
>>   	        (isDisk && !diskCap),
>>   	    );
>>   
>> -	    resize_btn.setDisabled(pending || !isUsedDisk || !diskCap);
>> +	    resize_menuitem.setDisabled(pending || !isUsedDisk || !diskCap);
>> +	    reassign_menuitem.setDisabled(pending || (isEfi || tpmMoveable));
>>   
>> -	    move_btn.setDisabled(pending || !(isUsedDisk || isEfi || tpmMoveable) || !diskCap);
>> +	    diskaction_btn.setDisabled(
>> +		pending ||
>> +		isCloudInit ||
>> +		!(isDisk || isEfi || tpmMoveable) ||
>> +		!diskCap,
>> +	    );
> 
> Here you are using the fact that "move action disabled" implies "resize
> and reassign action disabled". Might be worth giving the following a
> shot hoping it's cleaner:
> 
> if pending || !diskCap || other common criteria
>    disable menu
> else
>    enable menu
>    disable resize based on resize-specific criteria (here the common
> criteria don't need to be repeated)
>    disable reassign based on reassign-specific criteria
>    disable move based on move-specific criteria
> 
> and if the common criteria are collected correctly, there should never
> be a case where all entries are disabled but the menu isn't.
> 
>>   
>>   	    revert_btn.setDisabled(!pending);
>>   	};




  reply	other threads:[~2022-03-24 10:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14  9:35 [pve-devel] [PATCH v4 manager 0/6] ui: lxc/qemu: add reassign for disks and volumes Aaron Lauterer
2022-03-14  9:35 ` [pve-devel] [PATCH v4 manager 1/6] ui: utils: add nextFreeMP Aaron Lauterer
2022-03-14  9:35 ` [pve-devel] [PATCH v4 manager 2/6] ui: lxc/qemu: add disk reassign and action submenu Aaron Lauterer
2022-03-22 11:18   ` Fabian Ebner
2022-03-24 10:46     ` Aaron Lauterer [this message]
2022-03-14  9:35 ` [pve-devel] [PATCH v4 manager 3/6] ui: lxc/qemu: disk/volume action simplify menu items Aaron Lauterer
2022-03-24 11:08   ` Thomas Lamprecht
2022-03-14  9:35 ` [pve-devel] [PATCH v4 manager 4/6] ui: BusTypeSelector: change noVirtIO to withVirtIO Aaron Lauterer
2022-03-14  9:35 ` [pve-devel] [PATCH v4 manager 5/6] ui: hdmove: modernize/refactor Aaron Lauterer
2022-03-14  9:35 ` [pve-devel] [PATCH v4 manager 6/6] ui: util: refactor mps to mp Aaron Lauterer
2022-03-22 11:18   ` Fabian Ebner
2022-03-24 10:44     ` Aaron Lauterer
2022-03-22 11:18 ` [pve-devel] [PATCH v4 manager 0/6] ui: lxc/qemu: add reassign for disks and volumes Fabian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2fcb8f65-8b36-e425-d955-3ff5557c18b6@proxmox.com \
    --to=a.lauterer@proxmox.com \
    --cc=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal