]>
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('Remotes'),
35 iconCls
: 'fa fa-server',
36 path
: 'pbsRemoteView',
40 text
: gettext('Data Store'),
41 iconCls
: 'fa fa-archive',
42 path
: 'pbsDataStoreConfig',
46 text
: gettext('Subscription'),
47 iconCls
: 'fa fa-support',
48 path
: 'pbsSubscription',
54 text
: gettext('Administration'),
55 iconCls
: 'fa fa-wrench',
56 path
: 'pbsServerAdministration',
63 Ext
.define('PBS.view.main.NavigationTree', {
64 extend
: 'Ext.list.Tree',
65 xtype
: 'navigationtree',
68 xclass
: 'Ext.app.ViewController',
70 init: function(view
) {
72 view
.rstore
= Ext
.create('Proxmox.data.UpdateStore', {
75 storeid
: 'pbs-datastore-list',
76 model
: 'pbs-datastore-list'
79 view
.rstore
.on('load', this.onLoad
, this);
80 view
.on('destroy', view
.rstore
.stopUpdate
);
83 onLoad: function(store
, records
, success
) {
84 var view
= this.getView();
86 let root
= view
.getStore().getRoot();
88 if (!root
.findChild('path', 'pbsDataStoreStatus', false)) {
90 text
: gettext('Data Store'),
92 iconCls
: 'fa fa-archive',
93 path
: 'pbsDataStoreStatus',
98 // FIXME: newly added always get appended to the end..
99 records
.sort((a
, b
) => {
100 if (a
.id
> b
.id
) return 1;
101 if (a
.id
< b
.id
) return -1;
105 var list
= root
.findChild('path', 'pbsDataStoreStatus', false);
106 var length
= records
.length
;
107 var lookup_hash
= {};
108 for (var i
= 0; i
< length
; i
++) {
109 var name
= records
[i
].id
;
110 lookup_hash
[name
] = true;
111 if (!list
.findChild('text', name
, false)) {
114 path
: `DataStore-${name}`,
115 iconCls
: 'fa fa-database',
122 list
.eachChild(function(node
) {
123 var name
= node
.data
.text
;
124 if (!lookup_hash
[name
]) {
125 erase_list
.push(node
);
129 Ext
.Array
.forEach(erase_list
, function(node
) { node
.erase(); });
134 select: function(path
) {
136 var item
= me
.getStore().findRecord('path', path
, 0, false, true, true);
137 me
.setSelection(item
);
142 expanderFirst
: false,
143 store
: 'NavigationStore',