ui: add UserSelector

this has to be different from pve for now, since the default of
'enabled' is reverted (pve: default disabled, pbs: default enabled)

if we decide to change this either here or in pve, we can refactor
it to the widget-toolkit

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-05-20 12:15:33 +02:00 committed by Dietmar Maurer
parent b05672579e
commit 2072aeaee6
2 changed files with 51 additions and 0 deletions

View File

@ -5,6 +5,7 @@ IMAGES := \
images/proxmox_logo.png images/proxmox_logo.png
JSSRC= \ JSSRC= \
form/UserSelector.js \
config/UserView.js \ config/UserView.js \
window/UserEdit.js \ window/UserEdit.js \
Utils.js \ Utils.js \

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

@ -0,0 +1,50 @@
Ext.define('PBS.form.UserSelector', {
extend: 'Proxmox.form.ComboGrid',
alias: 'widget.pbsUserSelector',
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,
},
],
},
});