pve-manager/www/manager6/data/PermPathStore.js
Lukas Wagner 56f677ebd7 ui: perm path: add ACL paths for notifications, usb and pci mappings
Suggested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-16 11:11:19 +02:00

63 lines
1.4 KiB
JavaScript

Ext.define('PVE.data.PermPathStore', {
extend: 'Ext.data.Store',
alias: 'store.pvePermPath',
fields: ['value'],
autoLoad: false,
data: [
{ 'value': '/' },
{ 'value': '/access' },
{ 'value': '/access/groups' },
{ 'value': '/access/realm' },
{ 'value': '/mapping' },
{ 'value': '/mapping/notification' },
{ 'value': '/mapping/pci' },
{ 'value': '/mapping/usb' },
{ 'value': '/nodes' },
{ 'value': '/pool' },
{ 'value': '/sdn/zones' },
{ 'value': '/storage' },
{ 'value': '/vms' },
],
constructor: function(config) {
var me = this;
config = config || {};
me.callParent([config]);
let donePaths = {};
me.suspendEvents();
PVE.data.ResourceStore.each(function(record) {
let path;
switch (record.get('type')) {
case 'node': path = '/nodes/' + record.get('text');
break;
case 'qemu': path = '/vms/' + record.get('vmid');
break;
case 'lxc': path = '/vms/' + record.get('vmid');
break;
case 'sdn': path = '/sdn/zones/' + record.get('sdn');
break;
case 'storage': path = '/storage/' + record.get('storage');
break;
case 'pool': path = '/pool/' + record.get('pool');
break;
}
if (path !== undefined && !donePaths[path]) {
me.add({ value: path });
donePaths[path] = 1;
}
});
me.resumeEvents();
me.fireEvent('refresh', me);
me.fireEvent('datachanged', me);
me.sort({
property: 'value',
direction: 'ASC',
});
},
});