add pmxRoleSelector

copied+refactored from pve-manager
for use with other projects

also show privs now in the combobox

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-05-19 16:48:36 +02:00 committed by Thomas Lamprecht
parent 50e8bf4419
commit 9a3c1cb408
2 changed files with 42 additions and 0 deletions

View File

@ -30,6 +30,7 @@ JSSRC= \
form/BondModeSelector.js \
form/NetworkSelector.js \
form/RealmComboBox.js \
form/RoleSelector.js \
button/Button.js \
button/HelpButton.js \
grid/ObjectGrid.js \

41
form/RoleSelector.js Normal file
View File

@ -0,0 +1,41 @@
Ext.define('pmx-roles', {
extend: 'Ext.data.Model',
fields: ['roleid', 'privs'],
proxy: {
type: 'proxmox',
url: "/api2/json/access/roles",
},
idProperty: 'roleid',
});
Ext.define('Proxmox.form.RoleSelector', {
extend: 'Proxmox.form.ComboGrid',
alias: 'widget.pmxRoleSelector',
allowBlank: false,
autoSelect: false,
valueField: 'roleid',
displayField: 'roleid',
listConfig: {
columns: [
{
header: gettext('Role'),
sortable: true,
dataIndex: 'roleid',
flex: 1,
},
{
header: gettext('Privileges'),
dataIndex: 'privs',
flex: 1,
},
],
},
store: {
autoLoad: true,
model: 'pmx-roles',
sorters: 'roleid',
},
});