[pve-devel] [PATCH manager 1/1] ui: dc/UserEdit: add warning for disabling users

Lorenz Stechauner l.stechauner at proxmox.com
Thu May 20 15:53:41 CEST 2021


see #3101

Signed-off-by: Lorenz Stechauner <l.stechauner at proxmox.com>
---
 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) {
+			let taskWarning = me.lookup('taskWarning');
+			taskWarning.setHidden(!(me.wasEnabled && !checkbox.value));
+		    },
+		},
 	    },
 	];
 
@@ -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,
+	    },
 	];
 
 	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);
-- 
2.20.1






More information about the pve-devel mailing list