mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-05 06:39:04 +00:00
fix #2574: ui: permission-path selector: push each unique path only once
In clusters a storage was pushed as many times as there are nodes using it. Ensure we only push a path once, do this with a memory oriented solution, i.e., build a extra object to remember what we already pushed. This is preferred over a me.findExact call as it's a o(n) vs o(n^2) solution compute wise and we make the user wait if this would need long, so reducing compute time over memory use is here a good choice - even if we will seldom run into situations where this actually will make a difference with such small data counts. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
d6d084dc14
commit
baed2b7c41
@ -19,28 +19,26 @@ Ext.define('PVE.data.PermPathStore', {
|
||||
|
||||
me.callParent([config]);
|
||||
|
||||
let donePaths = {};
|
||||
me.suspendEvents();
|
||||
PVE.data.ResourceStore.each(function(record) {
|
||||
let path;
|
||||
switch (record.get('type')) {
|
||||
case 'node':
|
||||
me.add({value: '/nodes/' + record.get('text')});
|
||||
case 'node': path = '/nodes/' + record.get('text');
|
||||
break;
|
||||
|
||||
case 'qemu':
|
||||
me.add({value: '/vms/' + record.get('vmid')});
|
||||
case 'qemu': path = '/vms/' + record.get('vmid');
|
||||
break;
|
||||
|
||||
case 'lxc':
|
||||
me.add({value: '/vms/' + record.get('vmid')});
|
||||
case 'lxc': path = '/vms/' + record.get('vmid');
|
||||
break;
|
||||
|
||||
case 'storage':
|
||||
me.add({value: '/storage/' + record.get('storage')});
|
||||
case 'storage': path = '/storage/' + record.get('storage');
|
||||
break;
|
||||
case 'pool':
|
||||
me.add({value: '/pool/' + record.get('pool')});
|
||||
case 'pool': path = '/pool/' + record.get('pool');
|
||||
break;
|
||||
}
|
||||
if (path !== undefined && !donePaths[path]) {
|
||||
me.add({ value: path });
|
||||
donePaths[path] = 1;
|
||||
}
|
||||
});
|
||||
me.resumeEvents();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user