[pve-devel] [PATCH manager 2/7] www: use UserSelector from wtk

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Nov 9 12:27:09 CET 2021


Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 www/manager6/dc/ACLView.js        |  2 +-
 www/manager6/dc/TokenEdit.js      |  2 +-
 www/manager6/dc/UserView.js       |  2 +-
 www/manager6/form/UserSelector.js | 83 ++++---------------------------
 4 files changed, 14 insertions(+), 75 deletions(-)

diff --git a/www/manager6/dc/ACLView.js b/www/manager6/dc/ACLView.js
index 65abd8cd..a5776ac6 100644
--- a/www/manager6/dc/ACLView.js
+++ b/www/manager6/dc/ACLView.js
@@ -32,7 +32,7 @@ Ext.define('PVE.dc.ACLAdd', {
 	} else if (me.aclType === 'user') {
 	    me.subject = gettext("User Permission");
 	    items.push({
-		xtype: 'pveUserSelector',
+		xtype: 'pmxUserSelector',
 		name: 'users',
 		fieldLabel: gettext('User'),
 	    });
diff --git a/www/manager6/dc/TokenEdit.js b/www/manager6/dc/TokenEdit.js
index 7039249c..3b25c739 100644
--- a/www/manager6/dc/TokenEdit.js
+++ b/www/manager6/dc/TokenEdit.js
@@ -37,7 +37,7 @@ Ext.define('PVE.dc.TokenEdit', {
 		},
 		submitValue: true,
 		editConfig: {
-		    xtype: 'pveUserSelector',
+		    xtype: 'pmxUserSelector',
 		    allowBlank: false,
 		},
 		name: 'userid',
diff --git a/www/manager6/dc/UserView.js b/www/manager6/dc/UserView.js
index ef394bdb..9c84bf7d 100644
--- a/www/manager6/dc/UserView.js
+++ b/www/manager6/dc/UserView.js
@@ -15,7 +15,7 @@ Ext.define('PVE.dc.UserView', {
 
 	var store = new Ext.data.Store({
             id: "users",
-	    model: 'pve-users',
+	    model: 'pmx-users',
 	    sorters: {
 		property: 'userid',
 		order: 'DESC',
diff --git a/www/manager6/form/UserSelector.js b/www/manager6/form/UserSelector.js
index 2d4c8c22..8fb31d7e 100644
--- a/www/manager6/form/UserSelector.js
+++ b/www/manager6/form/UserSelector.js
@@ -1,74 +1,13 @@
-Ext.define('PVE.form.UserSelector', {
-    extend: 'Proxmox.form.ComboGrid',
-    alias: ['widget.pveUserSelector'],
-
-    allowBlank: false,
-    autoSelect: false,
-    valueField: 'userid',
-    displayField: 'userid',
-
-    editable: true,
-    anyMatch: true,
-    forceSelection: true,
-
-    initComponent: function() {
-	var me = this;
-
-	var store = new Ext.data.Store({
-	    model: 'pve-users',
-	    sorters: [{
-		property: 'userid',
-	    }],
-	});
-
-	Ext.apply(me, {
-	    store: store,
-            listConfig: {
-		columns: [
-		    {
-			header: gettext('User'),
-			sortable: true,
-			dataIndex: 'userid',
-			renderer: Ext.String.htmlEncode,
-			flex: 1,
-		    },
-		    {
-			header: gettext('Name'),
-			sortable: true,
-			renderer: PVE.Utils.render_full_name,
-			dataIndex: 'firstname',
-			flex: 1,
-		    },
-		    {
-			header: gettext('Comment'),
-			sortable: false,
-			dataIndex: 'comment',
-			renderer: Ext.String.htmlEncode,
-			flex: 1,
-		    },
-		],
-	    },
-	});
-
-        me.callParent();
-
-	store.load({ params: { enabled: 1 } });
+Ext.define('pmx-users', {
+    extend: 'Ext.data.Model',
+    fields: [
+	'userid', 'firstname', 'lastname', 'email', 'comment',
+	{ type: 'boolean', name: 'enable' },
+	{ type: 'date', dateFormat: 'timestamp', name: 'expire' },
+    ],
+    proxy: {
+	type: 'proxmox',
+	url: "/api2/json/access/users",
     },
-
-}, function() {
-    Ext.define('pve-users', {
-	extend: 'Ext.data.Model',
-	fields: [
-	    'userid', 'firstname', 'lastname', 'email', 'comment',
-	    { type: 'boolean', name: 'enable' },
-	    { type: 'date', dateFormat: 'timestamp', name: 'expire' },
-	],
-	proxy: {
-            type: 'proxmox',
-	    url: "/api2/json/access/users",
-	},
-	idProperty: 'userid',
-    });
+    idProperty: 'userid',
 });
-
-
-- 
2.30.2






More information about the pve-devel mailing list