]>
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('Verify Jobs'),
47 iconCls
: 'fa fa-check-circle',
48 path
: 'pbsVerifyJobView',
52 text
: gettext('Subscription'),
53 iconCls
: 'fa fa-support',
54 path
: 'pbsSubscription',
60 text
: gettext('Administration'),
61 iconCls
: 'fa fa-wrench',
62 path
: 'pbsServerAdministration',
67 text
: gettext('Disks'),
68 iconCls
: 'fa fa-hdd-o',
73 text
: Proxmox
.Utils
.directoryText
,
74 iconCls
: 'fa fa-folder',
75 path
: 'pbsDirectoryList',
80 iconCls
: 'fa fa-th-large',
89 text
: gettext('Datastore'),
90 iconCls
: 'fa fa-archive',
91 path
: 'pbsDataStoreConfig',
99 Ext
.define('PBS.view.main.NavigationTree', {
100 extend
: 'Ext.list.Tree',
101 xtype
: 'navigationtree',
104 xclass
: 'Ext.app.ViewController',
106 init: function(view
) {
107 view
.rstore
= Ext
.create('Proxmox.data.UpdateStore', {
110 storeId
: 'pbs-datastore-list',
111 storeid
: 'pbs-datastore-list',
112 model
: 'pbs-datastore-list',
115 view
.rstore
.on('load', this.onLoad
, this);
116 view
.on('destroy', view
.rstore
.stopUpdate
);
119 onLoad: function(store
, records
, success
) {
120 if (!success
) return;
121 var view
= this.getView();
123 let root
= view
.getStore().getRoot();
125 // FIXME: newly added always get appended to the end..
126 records
.sort((a
, b
) => {
127 if (a
.id
> b
.id
) return 1;
128 if (a
.id
< b
.id
) return -1;
132 var list
= root
.findChild('path', 'pbsDataStoreConfig', false);
133 var length
= records
.length
;
134 var lookup_hash
= {};
135 for (var i
= 0; i
< length
; i
++) {
136 let name
= records
[i
].id
;
137 lookup_hash
[name
] = true;
138 if (!list
.findChild('text', name
, false)) {
141 path
: `DataStore-${name}`,
142 iconCls
: 'fa fa-database',
149 list
.eachChild(function(node
) {
150 let name
= node
.data
.text
;
151 if (!lookup_hash
[name
]) {
152 erase_list
.push(node
);
156 Ext
.Array
.forEach(erase_list
, function(node
) { node
.erase(); });
160 select: function(path
) {
162 var item
= me
.getStore().findRecord('path', path
, 0, false, true, true);
163 me
.setSelection(item
);
168 expanderFirst
: false,
169 store
: 'NavigationStore',