all lists on 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>,
	Fabian Ebner <f.ebner@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager 2/2] ui: backup: protect button: use dynamic protect/unprotect text
Date: Wed, 16 Mar 2022 17:36:15 +0100	[thread overview]
Message-ID: <c26f2013-5449-599b-df24-0dfa86a939d8@proxmox.com> (raw)
In-Reply-To: <20211112112834.40892-2-f.ebner@proxmox.com>

On 12.11.21 12:28, Fabian Ebner wrote:
> Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
>  www/manager6/grid/BackupView.js    | 22 +++++++++++++++++++++-
>  www/manager6/storage/BackupView.js | 24 +++++++++++++++++++++++-
>  2 files changed, 44 insertions(+), 2 deletions(-)
> 
> diff --git a/www/manager6/grid/BackupView.js b/www/manager6/grid/BackupView.js
> index c08fb67d..cbdac02e 100644
> --- a/www/manager6/grid/BackupView.js
> +++ b/www/manager6/grid/BackupView.js
> @@ -12,6 +12,7 @@ Ext.define('PVE.grid.BackupView', {
>  	let me = this;
>  
>  	me.down('#removeButton').updateStatus(record);
> +	me.down('#protectButton').updateStatus(record);
>      },
>  
>      initComponent: function() {
> @@ -314,8 +315,14 @@ Ext.define('PVE.grid.BackupView', {
>  		    },
>  		    {
>  			xtype: 'proxmoxButton',
> -			text: gettext('Change Protection'),
> +			text: gettext('Protect'),
> +			defaultText: gettext('Protect'),
> +			altText: gettext('Unprotect'),
>  			disabled: true,
> +			itemId: 'protectButton',
> +			updateStatus: function(record) {
> +			    this.setText(record?.data.protected ? this.altText : this.defaultText);
> +			},
>  			handler: function(button, event, record) {
>  			    const volid = record.data.volid;
>  			    const storage = storagesel.getValue();
> @@ -330,6 +337,19 @@ Ext.define('PVE.grid.BackupView', {
>  				success: (response) => reload(),
>  			    });
>  			},
> +			listeners: {
> +			    render: function(btn) {
> +				// HACK: calculate the max button width on first render to avoid
> +				// toolbar glitches
> +				let defSize = btn.getSize().width;
> +
> +				btn.setText(btn.altText);
> +				let altSize = btn.getSize().width;
> +
> +				btn.setText(btn.defaultText);
> +				btn.setSize({ width: altSize > defSize ? altSize : defSize });

with this we'd have that behavior three times (ct/vm resource/hw are the existing two),
so maybe we should move it out in a new separate, from proxmoxButton derived, component?





      reply	other threads:[~2022-03-16 16:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12 11:28 [pve-devel] [PATCH manager 1/2] ui: backup: disable remove button when backup is protected Fabian Ebner
2021-11-12 11:28 ` [pve-devel] [PATCH manager 2/2] ui: backup: protect button: use dynamic protect/unprotect text Fabian Ebner
2022-03-16 16:36   ` 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=c26f2013-5449-599b-df24-0dfa86a939d8@proxmox.com \
    --to=t.lamprecht@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