From 2072aeaee6198a9110256e7218b5b0c0436d5a34 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 20 May 2020 12:15:33 +0200 Subject: [PATCH] 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 --- www/Makefile | 1 + www/form/UserSelector.js | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 www/form/UserSelector.js diff --git a/www/Makefile b/www/Makefile index ef6673e1..62c44516 100644 --- a/www/Makefile +++ b/www/Makefile @@ -5,6 +5,7 @@ IMAGES := \ images/proxmox_logo.png JSSRC= \ + form/UserSelector.js \ config/UserView.js \ window/UserEdit.js \ Utils.js \ diff --git a/www/form/UserSelector.js b/www/form/UserSelector.js new file mode 100644 index 00000000..b1beb4b3 --- /dev/null +++ b/www/form/UserSelector.js @@ -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, + }, + ], + }, +});