]>
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('Subscription'),
47 iconCls
: 'fa fa-support',
48 path
: 'pbsSubscription',
54 text
: gettext('Administration'),
55 iconCls
: 'fa fa-wrench',
56 path
: 'pbsServerAdministration',
61 text
: gettext('Disks'),
62 iconCls
: 'fa fa-hdd-o',
67 text
: Proxmox
.Utils
.directoryText
,
68 iconCls
: 'fa fa-folder',
69 path
: 'pbsDirectoryList',
77 text
: gettext('Data Store'),
78 iconCls
: 'fa fa-archive',
79 path
: 'pbsDataStoreConfig',
87 Ext
.define('PBS.view.main.NavigationTree', {
88 extend
: 'Ext.list.Tree',
89 xtype
: 'navigationtree',
92 xclass
: 'Ext.app.ViewController',
94 init: function(view
) {
96 view
.rstore
= Ext
.create('Proxmox.data.UpdateStore', {
99 storeid
: 'pbs-datastore-list',
100 model
: 'pbs-datastore-list'
103 view
.rstore
.on('load', this.onLoad
, this);
104 view
.on('destroy', view
.rstore
.stopUpdate
);
107 onLoad: function(store
, records
, success
) {
108 if (!success
) return;
109 var view
= this.getView();
111 let root
= view
.getStore().getRoot();
113 // FIXME: newly added always get appended to the end..
114 records
.sort((a
, b
) => {
115 if (a
.id
> b
.id
) return 1;
116 if (a
.id
< b
.id
) return -1;
120 var list
= root
.findChild('path', 'pbsDataStoreConfig', false);
121 var length
= records
.length
;
122 var lookup_hash
= {};
123 for (var i
= 0; i
< length
; i
++) {
124 var name
= records
[i
].id
;
125 lookup_hash
[name
] = true;
126 if (!list
.findChild('text', name
, false)) {
129 path
: `DataStore-${name}`,
130 iconCls
: 'fa fa-database',
137 list
.eachChild(function(node
) {
138 var name
= node
.data
.text
;
139 if (!lookup_hash
[name
]) {
140 erase_list
.push(node
);
144 Ext
.Array
.forEach(erase_list
, function(node
) { node
.erase(); });
149 select: function(path
) {
151 var item
= me
.getStore().findRecord('path', path
, 0, false, true, true);
152 me
.setSelection(item
);
157 expanderFirst
: false,
158 store
: 'NavigationStore',