public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Aaron Lauterer <a.lauterer@proxmox.com>
Subject: [pve-devel] applied: [PATCH manager] ui: lxc: resources: add Detach text for mountpoints
Date: Tue, 9 Nov 2021 11:08:26 +0100	[thread overview]
Message-ID: <c7bd8f70-f4bb-9ca3-35f3-7f2273aedb3e@proxmox.com> (raw)
In-Reply-To: <20211108095612.193819-1-a.lauterer@proxmox.com>

On 08.11.21 10:56, Aaron Lauterer wrote:
> Instead of showing 'Remove' for a mountpoint, change the text to
> 'Detach' and only show 'Remove' for unused volumes.
> 
> This aligns the behaviour with VMs and will make it clear, that a
> mountpoint first needs to be detached before it can be fully removed.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
> I took the code from the qemu/HardwareView.js and only made minor
> changes to the check if it is a used disk/volume.
> Since it is only a minor change, I did not go all the way to modernize
> it and also stayed with `var ...` instead of `let ...` when defining the
> `isUsedDisk` variable for consistency.
> 
>  www/manager6/lxc/Resources.js | 31 +++++++++++++++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)
> 
>

applied, thanks! albeit...

> @@ -191,12 +191,21 @@ Ext.define('PVE.lxc.RessourceView', {
>  
>  	var remove_btn = new Proxmox.button.Button({
>  	    text: gettext('Remove'),
> +	    defaultText: gettext('Remove'),
> +	    altText: gettext('Detach'),
>  	    selModel: me.selModel,
>  	    disabled: true,
>  	    dangerous: true,
>  	    confirmMsg: function(rec) {
> -		var msg = Ext.String.format(gettext('Are you sure you want to remove entry {0}'),
> -					    "'" + me.renderKey(rec.data.key, {}, rec) + "'");
> +		let warn = Ext.String.format(gettext('Are you sure you want to remove entry {0}'));
> +		if (this.text === this.altText) {
> +		    warn = gettext('Are you sure you want to detach entry {0}');
> +		}
> +
> +		let key = rec.data.key;

above was only used partially, i.e., in renderKey but not for the match which is actually
new vs. just copypasta'd code from the QEMU variant.

FYI: I dropped it completely and modernized the QEMU variant too in a followup.

> +
> +		let rendered = me.renderKey(key, {}, rec);
> +		let msg = Ext.String.format(warn, "'" + rendered + "'");
>  		if (rec.data.key.match(/^unused\d+$/)) {
>  		    msg += " " + gettext('This will permanently erase all data.');
>  		}




      reply	other threads:[~2021-11-09 10:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08  9:56 [pve-devel] " Aaron Lauterer
2021-11-09 10:08 ` Thomas Lamprecht [this message]

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=c7bd8f70-f4bb-9ca3-35f3-7f2273aedb3e@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=a.lauterer@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal