From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id BD9137D71D for ; Tue, 9 Nov 2021 12:27:53 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9436EB058 for ; Tue, 9 Nov 2021 12:27:30 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 6C05CAFDE for ; Tue, 9 Nov 2021 12:27:27 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3FB6342740 for ; Tue, 9 Nov 2021 12:27:27 +0100 (CET) From: Wolfgang Bumiller To: pve-devel@lists.proxmox.com Date: Tue, 9 Nov 2021 12:27:15 +0100 Message-Id: <20211109112721.130935-27-w.bumiller@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211109112721.130935-1-w.bumiller@proxmox.com> References: <20211109112721.130935-1-w.bumiller@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.523 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH widget-toolkit 1/7] add pmxUserSelector X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2021 11:27:54 -0000 copied from pbs Signed-off-by: Wolfgang Bumiller --- src/Makefile | 1 + src/form/UserSelector.js | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/form/UserSelector.js diff --git a/src/Makefile b/src/Makefile index a490ccd..cc464c3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -42,6 +42,7 @@ JSSRC= \ form/MultiDiskSelector.js \ form/TaskTypeSelector.js \ form/ACME.js \ + form/UserSelector.js \ button/Button.js \ button/HelpButton.js \ grid/ObjectGrid.js \ diff --git a/src/form/UserSelector.js b/src/form/UserSelector.js new file mode 100644 index 0000000..ce66fab --- /dev/null +++ b/src/form/UserSelector.js @@ -0,0 +1,50 @@ +Ext.define('Proxmox.form.UserSelector', { + extend: 'Proxmox.form.ComboGrid', + alias: 'widget.pmxUserSelector', + + allowBlank: false, + autoSelect: false, + valueField: 'userid', + displayField: 'userid', + + editable: true, + anyMatch: true, + forceSelection: true, + + store: { + model: 'pmx-users', + autoLoad: true, + params: { + enabled: 1, + }, + sorters: 'userid', + }, + + listConfig: { + columns: [ + { + header: gettext('User'), + sortable: true, + dataIndex: 'userid', + renderer: Ext.String.htmlEncode, + flex: 1, + }, + { + header: gettext('Name'), + sortable: true, + renderer: (first, mD, rec) => Ext.String.htmlEncode( + `${first || ''} ${rec.data.lastname || ''}`, + ), + dataIndex: 'firstname', + flex: 1, + }, + { + header: gettext('Comment'), + sortable: false, + dataIndex: 'comment', + renderer: Ext.String.htmlEncode, + flex: 1, + }, + ], + }, +}); -- 2.30.2