Signed-off-by: René Jochum <r.joc...@proxmox.com> --- www/manager6/Makefile | 2 ++ www/manager6/data/PermPathStore.js | 54 +++++++++++++++++++++++++++++++++++ www/manager6/dc/ACLView.js | 2 +- www/manager6/form/PermPathSelector.js | 12 ++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 www/manager6/data/PermPathStore.js create mode 100644 www/manager6/form/PermPathSelector.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile index 81ddcc8d..1d7303a3 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -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 \ @@ -58,6 +59,7 @@ JSSRC= \ form/USBSelector.js \ form/CalendarEvent.js \ form/CephPoolSelector.js \ + form/PermPathSelector.js \ dc/Tasks.js \ dc/Log.js \ panel/StatusPanel.js \ diff --git a/www/manager6/data/PermPathStore.js b/www/manager6/data/PermPathStore.js new file mode 100644 index 00000000..c88f4cee --- /dev/null +++ b/www/manager6/data/PermPathStore.js @@ -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' + }); + } +}); \ No newline at end of file diff --git a/www/manager6/dc/ACLView.js b/www/manager6/dc/ACLView.js index e12c83f2..1322f952 100644 --- a/www/manager6/dc/ACLView.js +++ b/www/manager6/dc/ACLView.js @@ -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, diff --git a/www/manager6/form/PermPathSelector.js b/www/manager6/form/PermPathSelector.js new file mode 100644 index 00000000..ace94b9f --- /dev/null +++ b/www/manager6/form/PermPathSelector.js @@ -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' + } +}); -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel