]>
git.proxmox.com Git - proxmox-backup.git/blob - www/NavigationTree.js
1 Ext
.define('PBS.store.NavigationStore', {
2 extend
: 'Ext.data.TreeStore',
4 storeId
: 'NavigationStore',
10 text
: gettext('Dashboard'),
11 iconCls
: 'fa fa-tachometer',
16 text
: gettext('Configuration'),
17 iconCls
: 'fa fa-gears',
18 path
: 'pbsSystemConfiguration',
22 text
: gettext('User Management'),
23 iconCls
: 'fa fa-user',
28 text
: gettext('Permissions'),
29 iconCls
: 'fa fa-unlock',
34 text
: gettext('Data Store'),
35 iconCls
: 'fa fa-archive',
36 path
: 'pbsDataStoreConfig',
40 text
: gettext('Subscription'),
41 iconCls
: 'fa fa-support',
42 path
: 'pbsSubscription',
48 text
: gettext('Administration'),
49 iconCls
: 'fa fa-wrench',
50 path
: 'pbsServerAdministration',
57 Ext
.define('PBS.view.main.NavigationTree', {
58 extend
: 'Ext.list.Tree',
59 xtype
: 'navigationtree',
62 xclass
: 'Ext.app.ViewController',
64 init: function(view
) {
66 view
.rstore
= Ext
.create('Proxmox.data.UpdateStore', {
69 storeid
: 'pbs-datastore-list',
70 model
: 'pbs-datastore-list'
73 view
.rstore
.on('load', this.onLoad
, this);
74 view
.on('destroy', view
.rstore
.stopUpdate
);
77 onLoad: function(store
, records
, success
) {
78 var view
= this.getView();
80 let root
= view
.getStore().getRoot();
82 if (!root
.findChild('path', 'pbsDataStoreStatus', false)) {
84 text
: gettext('Data Store'),
86 iconCls
: 'fa fa-archive',
87 path
: 'pbsDataStoreStatus',
92 // FIXME: newly added always get appended to the end..
93 records
.sort((a
, b
) => {
94 if (a
.id
> b
.id
) return 1;
95 if (a
.id
< b
.id
) return -1;
99 var list
= root
.findChild('path', 'pbsDataStoreStatus', false);
100 var length
= records
.length
;
101 var lookup_hash
= {};
102 for (var i
= 0; i
< length
; i
++) {
103 var name
= records
[i
].id
;
104 lookup_hash
[name
] = true;
105 if (!list
.findChild('text', name
, false)) {
108 path
: `DataStore-${name}`,
109 iconCls
: 'fa fa-database',
116 list
.eachChild(function(node
) {
117 var name
= node
.data
.text
;
118 if (!lookup_hash
[name
]) {
119 erase_list
.push(node
);
123 Ext
.Array
.forEach(erase_list
, function(node
) { node
.erase(); });
128 select: function(path
) {
130 var item
= me
.getStore().findRecord('path', path
, 0, false, true, true);
131 me
.setSelection(item
);
136 expanderFirst
: false,
137 store
: 'NavigationStore',