fix #1499 Implement a combobox for Permissions paths

Signed-off-by: René Jochum <r.jochum@proxmox.com>
This commit is contained in:
René Jochum 2018-05-08 15:15:38 +02:00 committed by Dominik Csapak
parent 7e3fe38af3
commit cd84df4c6e
4 changed files with 69 additions and 1 deletions

View File

@ -14,6 +14,7 @@ JSSRC= \
lxc/CmdMenu.js \
node/CmdMenu.js \
VNCConsole.js \
data/PermPathStore.js \
data/ResourceStore.js \
data/model/Realm.js \
data/model/RRDModels.js \
@ -59,6 +60,7 @@ JSSRC= \
form/USBSelector.js \
form/CalendarEvent.js \
form/CephPoolSelector.js \
form/PermPathSelector.js \
dc/Tasks.js \
dc/Log.js \
panel/StatusPanel.js \

View File

@ -0,0 +1,54 @@
Ext.define('PVE.data.PermPathStore', {
extend: 'Ext.data.Store',
alias: 'store.pvePermPath',
fields: [ 'value' ],
autoLoad: false,
data: [
{'value': '/access'},
{'value': '/nodes'},
{'value': '/pool'},
{'value': '/storage'},
{'value': '/vms'}
],
constructor: function(config) {
var me = this;
config = config || {};
me.callParent([config]);
me.suspendEvents();
PVE.data.ResourceStore.each(function(record) {
switch (record.get('type')) {
case 'node':
me.add({value: '/nodes/' + record.get('text')});
break;
case 'qemu':
me.add({value: '/vms/' + record.get('vmid')});
break;
case 'lxc':
me.add({value: '/vms/' + record.get('vmid')});
break;
case 'storage':
me.add({value: '/storage/' + record.get('storage')});
break;
case 'pool':
me.add({value: '/pool/' + record.get('pool')});
break;
}
});
me.resumeEvents();
me.fireEvent('refresh', me);
me.fireEvent('datachanged', me);
me.sort({
property: 'value',
direction: 'ASC'
});
}
});

View File

@ -12,7 +12,7 @@ Ext.define('PVE.dc.ACLAdd', {
var items = [
{
xtype: me.path ? 'hiddenfield' : 'textfield',
xtype: me.path ? 'hiddenfield' : 'pvePermPathSelector',
name: 'path',
value: me.path,
allowBlank: false,

View File

@ -0,0 +1,12 @@
Ext.define('PVE.form.PermPathSelector', {
extend: 'Ext.form.field.ComboBox',
xtype: 'pvePermPathSelector',
valueField: 'value',
displayField: 'value',
typeAhead: true,
queryMode: 'local',
store: {
type: 'pvePermPath'
}
});