]>
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',
74 iconCls
: 'fa fa-th-large',
83 text
: gettext('Datastore'),
84 iconCls
: 'fa fa-archive',
85 path
: 'pbsDataStoreConfig',
93 Ext
.define('PBS.view.main.NavigationTree', {
94 extend
: 'Ext.list.Tree',
95 xtype
: 'navigationtree',
98 xclass
: 'Ext.app.ViewController',
100 init: function(view
) {
101 view
.rstore
= Ext
.create('Proxmox.data.UpdateStore', {
104 storeId
: 'pbs-datastore-list',
105 storeid
: 'pbs-datastore-list',
106 model
: 'pbs-datastore-list',
109 view
.rstore
.on('load', this.onLoad
, this);
110 view
.on('destroy', view
.rstore
.stopUpdate
);
113 onLoad: function(store
, records
, success
) {
114 if (!success
) return;
115 var view
= this.getView();
117 let root
= view
.getStore().getRoot();
119 // FIXME: newly added always get appended to the end..
120 records
.sort((a
, b
) => {
121 if (a
.id
> b
.id
) return 1;
122 if (a
.id
< b
.id
) return -1;
126 var list
= root
.findChild('path', 'pbsDataStoreConfig', false);
127 var length
= records
.length
;
128 var lookup_hash
= {};
129 for (var i
= 0; i
< length
; i
++) {
130 let name
= records
[i
].id
;
131 lookup_hash
[name
] = true;
132 if (!list
.findChild('text', name
, false)) {
135 path
: `DataStore-${name}`,
136 iconCls
: 'fa fa-database',
143 list
.eachChild(function(node
) {
144 let name
= node
.data
.text
;
145 if (!lookup_hash
[name
]) {
146 erase_list
.push(node
);
150 Ext
.Array
.forEach(erase_list
, function(node
) { node
.erase(); });
154 select: function(path
) {
156 var item
= me
.getStore().findRecord('path', path
, 0, false, true, true);
157 me
.setSelection(item
);
162 expanderFirst
: false,
163 store
: 'NavigationStore',