]>
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('Sync Jobs'),
41 iconCls
: 'fa fa-refresh',
42 path
: 'pbsSyncJobView',
46 text
: gettext('Data Store'),
47 iconCls
: 'fa fa-archive',
48 path
: 'pbsDataStoreConfig',
52 text
: gettext('Subscription'),
53 iconCls
: 'fa fa-support',
54 path
: 'pbsSubscription',
60 text
: gettext('Administration'),
61 iconCls
: 'fa fa-wrench',
62 path
: 'pbsServerAdministration',
69 Ext
.define('PBS.view.main.NavigationTree', {
70 extend
: 'Ext.list.Tree',
71 xtype
: 'navigationtree',
74 xclass
: 'Ext.app.ViewController',
76 init: function(view
) {
78 view
.rstore
= Ext
.create('Proxmox.data.UpdateStore', {
81 storeid
: 'pbs-datastore-list',
82 model
: 'pbs-datastore-list'
85 view
.rstore
.on('load', this.onLoad
, this);
86 view
.on('destroy', view
.rstore
.stopUpdate
);
89 onLoad: function(store
, records
, success
) {
90 var view
= this.getView();
92 let root
= view
.getStore().getRoot();
94 if (!root
.findChild('path', 'pbsDataStoreStatus', false)) {
96 text
: gettext('Data Store'),
98 iconCls
: 'fa fa-archive',
99 path
: 'pbsDataStoreStatus',
104 // FIXME: newly added always get appended to the end..
105 records
.sort((a
, b
) => {
106 if (a
.id
> b
.id
) return 1;
107 if (a
.id
< b
.id
) return -1;
111 var list
= root
.findChild('path', 'pbsDataStoreStatus', false);
112 var length
= records
.length
;
113 var lookup_hash
= {};
114 for (var i
= 0; i
< length
; i
++) {
115 var name
= records
[i
].id
;
116 lookup_hash
[name
] = true;
117 if (!list
.findChild('text', name
, false)) {
120 path
: `DataStore-${name}`,
121 iconCls
: 'fa fa-database',
128 list
.eachChild(function(node
) {
129 var name
= node
.data
.text
;
130 if (!lookup_hash
[name
]) {
131 erase_list
.push(node
);
135 Ext
.Array
.forEach(erase_list
, function(node
) { node
.erase(); });
140 select: function(path
) {
142 var item
= me
.getStore().findRecord('path', path
, 0, false, true, true);
143 me
.setSelection(item
);
148 expanderFirst
: false,
149 store
: 'NavigationStore',