add pmxUserSelector

copied from pbs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-11-09 12:27:15 +01:00 committed by Dominik Csapak
parent 71295836e5
commit d3812684c2
2 changed files with 51 additions and 0 deletions

View File

@ -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 \

50
src/form/UserSelector.js Normal file
View File

@ -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,
},
],
},
});