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>,
	Lorenz Stechauner <l.stechauner@proxmox.com>
Subject: Re: [pve-devel] [PATCH v2 manager 1/1] ui: dc/UserEdit: add warning for disabling users
Date: Wed, 23 Jun 2021 11:32:29 +0200	[thread overview]
Message-ID: <f5323526-a6ef-09cd-a23f-d4e6f2d7398b@proxmox.com> (raw)
In-Reply-To: <20210623073714.1156009-2-l.stechauner@proxmox.com>

On 23.06.21 09:37, Lorenz Stechauner wrote:
> see #3101
> 
> Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
> ---

I should have given this a closer look when commenting on the docs v1 patch, sorry.

In general this would miss for removal and when the expiry date would be set to the
past, but it may make sense to place a API call for running tasks from the user and
only show the warning if there are any.

But, with the docs change applied it's at least clearly documented, so IMO not a very
pressing matter.

>  www/manager6/dc/UserEdit.js | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/www/manager6/dc/UserEdit.js b/www/manager6/dc/UserEdit.js
> index b637cd53..65a612fd 100644
> --- a/www/manager6/dc/UserEdit.js
> +++ b/www/manager6/dc/UserEdit.js
> @@ -73,6 +73,12 @@ Ext.define('PVE.dc.UserEdit', {
>  		uncheckedValue: 0,
>  		defaultValue: 1,
>  		checked: true,
> +		listeners: {
> +		    change: function(checkbox) {

the change listener gives you the new value as second parameter, please us that one.

https://docs.sencha.com/extjs/6.0.1/classic/Ext.form.field.Checkbox.html#event-change

> +			let taskWarning = me.lookup('taskWarning');
> +			taskWarning.setHidden(!(me.wasEnabled && !checkbox.value));

for single use, where we are sure that the variable isn't undefined/null, it's often nicer
to just use chaining, e.g., here:

me.lookup('taskWarning').setHidden(!(me.wasEnabled && !value));

also 


> +		    },
> +		},
>  	    },
>  	];
>  
> @@ -93,6 +99,13 @@ Ext.define('PVE.dc.UserEdit', {
>  		fieldLabel: gettext('E-Mail'),
>  		vtype: 'proxmoxMail',
>  	    },
> +	    {
> +		xtype: 'displayfield',
> +		reference: 'taskWarning',
> +		userCls: 'pmx-hint',
> +		value: gettext('Note: Already running tasks of user will not be terminated automatically!'),
> +		hidden: true,
> +	    },

I'd move that to the end of (non-advanced) columnB, looks better there IMO.

>  	];
>  
>  	if (me.isCreate) {
> @@ -161,6 +174,7 @@ Ext.define('PVE.dc.UserEdit', {
>  		success: function(response, options) {
>  		    var data = response.result.data;
>  		    me.setValues(data);
> +		    me.wasEnabled = data.enable;
>  		    if (data.keys) {
>  			if (data.keys === 'x!oath' || data.keys === 'x!u2f') {
>  			    me.down('[name="keys"]').setDisabled(1);
> 





  reply	other threads:[~2021-06-23  9:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23  7:37 [pve-devel] [PATCH-SERIES v2 manager/docs] " Lorenz Stechauner
2021-06-23  7:37 ` [pve-devel] [PATCH v2 manager 1/1] ui: dc/UserEdit: " Lorenz Stechauner
2021-06-23  9:32   ` Thomas Lamprecht [this message]
2021-06-23  7:37 ` [pve-devel] [PATCH v2 docs 1/1] pveum: add warning for disabling or deleting users Lorenz Stechauner
2021-06-23  9:21   ` [pve-devel] applied: " Thomas Lamprecht

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=f5323526-a6ef-09cd-a23f-d4e6f2d7398b@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=l.stechauner@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