]>
Commit | Line | Data |
---|---|---|
cd84df4c | 1 | Ext.define('PVE.data.PermPathStore', { |
3b1cb257 DC |
2 | extend: 'Ext.data.Store', |
3 | alias: 'store.pvePermPath', | |
d6d084dc | 4 | fields: ['value'], |
3b1cb257 DC |
5 | autoLoad: false, |
6 | data: [ | |
d6d084dc TL |
7 | { 'value': '/' }, |
8 | { 'value': '/access' }, | |
80e364cc DC |
9 | { 'value': '/access/groups' }, |
10 | { 'value': '/access/realm' }, | |
7becf34f | 11 | { 'value': '/mapping' }, |
d31e7f13 | 12 | { 'value': '/mapping/notifications' }, |
56f677eb LW |
13 | { 'value': '/mapping/pci' }, |
14 | { 'value': '/mapping/usb' }, | |
d6d084dc TL |
15 | { 'value': '/nodes' }, |
16 | { 'value': '/pool' }, | |
f28f6113 | 17 | { 'value': '/sdn/zones' }, |
d6d084dc TL |
18 | { 'value': '/storage' }, |
19 | { 'value': '/vms' }, | |
3b1cb257 DC |
20 | ], |
21 | ||
22 | constructor: function(config) { | |
23 | var me = this; | |
24 | ||
25 | config = config || {}; | |
26 | ||
27 | me.callParent([config]); | |
28 | ||
baed2b7c | 29 | let donePaths = {}; |
3b1cb257 DC |
30 | me.suspendEvents(); |
31 | PVE.data.ResourceStore.each(function(record) { | |
baed2b7c | 32 | let path; |
3b1cb257 | 33 | switch (record.get('type')) { |
baed2b7c | 34 | case 'node': path = '/nodes/' + record.get('text'); |
3b1cb257 | 35 | break; |
baed2b7c | 36 | case 'qemu': path = '/vms/' + record.get('vmid'); |
3b1cb257 | 37 | break; |
baed2b7c | 38 | case 'lxc': path = '/vms/' + record.get('vmid'); |
3b1cb257 | 39 | break; |
f28f6113 AD |
40 | case 'sdn': path = '/sdn/zones/' + record.get('sdn'); |
41 | break; | |
baed2b7c | 42 | case 'storage': path = '/storage/' + record.get('storage'); |
3b1cb257 | 43 | break; |
baed2b7c | 44 | case 'pool': path = '/pool/' + record.get('pool'); |
3b1cb257 DC |
45 | break; |
46 | } | |
baed2b7c TL |
47 | if (path !== undefined && !donePaths[path]) { |
48 | me.add({ value: path }); | |
49 | donePaths[path] = 1; | |
50 | } | |
3b1cb257 DC |
51 | }); |
52 | me.resumeEvents(); | |
53 | ||
54 | me.fireEvent('refresh', me); | |
55 | me.fireEvent('datachanged', me); | |
56 | ||
57 | me.sort({ | |
58 | property: 'value', | |
d6d084dc | 59 | direction: 'ASC', |
3b1cb257 | 60 | }); |
d6d084dc | 61 | }, |
3b1cb257 | 62 | }); |