2019-01-22 10:48:00 +00:00
|
|
|
Ext.define('PBS.store.NavigationStore', {
|
|
|
|
extend: 'Ext.data.TreeStore',
|
|
|
|
|
|
|
|
storeId: 'NavigationStore',
|
|
|
|
|
|
|
|
root: {
|
|
|
|
expanded: true,
|
|
|
|
children: [
|
2019-12-18 16:29:05 +00:00
|
|
|
{
|
|
|
|
text: gettext('Dashboard'),
|
|
|
|
iconCls: 'fa fa-tachometer',
|
|
|
|
path: 'pbsDashboard',
|
2020-09-25 16:36:58 +00:00
|
|
|
leaf: true,
|
2019-12-18 16:29:05 +00:00
|
|
|
},
|
2019-01-22 10:48:00 +00:00
|
|
|
{
|
|
|
|
text: gettext('Configuration'),
|
|
|
|
iconCls: 'fa fa-gears',
|
|
|
|
path: 'pbsSystemConfiguration',
|
|
|
|
expanded: true,
|
|
|
|
children: [
|
2020-05-18 12:18:38 +00:00
|
|
|
{
|
|
|
|
text: gettext('User Management'),
|
|
|
|
iconCls: 'fa fa-user',
|
|
|
|
path: 'pbsUserView',
|
2020-09-25 16:36:58 +00:00
|
|
|
leaf: true,
|
2020-05-18 12:18:38 +00:00
|
|
|
},
|
2020-05-20 10:15:37 +00:00
|
|
|
{
|
|
|
|
text: gettext('Permissions'),
|
|
|
|
iconCls: 'fa fa-unlock',
|
|
|
|
path: 'pbsACLView',
|
2020-09-25 16:36:58 +00:00
|
|
|
leaf: true,
|
2020-05-20 10:15:37 +00:00
|
|
|
},
|
2020-05-26 10:23:25 +00:00
|
|
|
{
|
|
|
|
text: gettext('Remotes'),
|
|
|
|
iconCls: 'fa fa-server',
|
|
|
|
path: 'pbsRemoteView',
|
|
|
|
leaf: true,
|
|
|
|
},
|
2020-05-29 08:53:42 +00:00
|
|
|
{
|
|
|
|
text: gettext('Sync Jobs'),
|
|
|
|
iconCls: 'fa fa-refresh',
|
|
|
|
path: 'pbsSyncJobView',
|
|
|
|
leaf: true,
|
|
|
|
},
|
2020-10-20 09:10:08 +00:00
|
|
|
{
|
|
|
|
text: gettext('Verify Jobs'),
|
|
|
|
iconCls: 'fa fa-check-circle',
|
|
|
|
path: 'pbsVerifyJobView',
|
|
|
|
leaf: true,
|
|
|
|
},
|
2019-01-22 10:48:00 +00:00
|
|
|
{
|
|
|
|
text: gettext('Subscription'),
|
|
|
|
iconCls: 'fa fa-support',
|
|
|
|
path: 'pbsSubscription',
|
2020-09-25 16:36:58 +00:00
|
|
|
leaf: true,
|
|
|
|
},
|
|
|
|
],
|
2019-01-22 10:48:00 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: gettext('Administration'),
|
|
|
|
iconCls: 'fa fa-wrench',
|
|
|
|
path: 'pbsServerAdministration',
|
2020-06-16 09:13:34 +00:00
|
|
|
expanded: true,
|
|
|
|
leaf: false,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
text: gettext('Disks'),
|
|
|
|
iconCls: 'fa fa-hdd-o',
|
|
|
|
path: 'pmxDiskList',
|
|
|
|
leaf: false,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
text: Proxmox.Utils.directoryText,
|
|
|
|
iconCls: 'fa fa-folder',
|
|
|
|
path: 'pbsDirectoryList',
|
|
|
|
leaf: true,
|
|
|
|
},
|
2020-06-25 12:53:05 +00:00
|
|
|
{
|
|
|
|
text: "ZFS",
|
|
|
|
iconCls: 'fa fa-th-large',
|
|
|
|
path: 'pbsZFSList',
|
|
|
|
leaf: true,
|
|
|
|
},
|
2020-09-25 16:36:58 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2020-06-05 08:11:51 +00:00
|
|
|
},
|
|
|
|
{
|
2020-07-02 15:20:38 +00:00
|
|
|
text: gettext('Datastore'),
|
2020-06-05 08:11:51 +00:00
|
|
|
iconCls: 'fa fa-archive',
|
|
|
|
path: 'pbsDataStoreConfig',
|
|
|
|
expanded: true,
|
2020-09-25 16:36:58 +00:00
|
|
|
leaf: false,
|
2020-06-05 08:11:51 +00:00
|
|
|
},
|
2020-09-25 16:36:58 +00:00
|
|
|
],
|
|
|
|
},
|
2019-01-22 10:48:00 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
Ext.define('PBS.view.main.NavigationTree', {
|
|
|
|
extend: 'Ext.list.Tree',
|
|
|
|
xtype: 'navigationtree',
|
|
|
|
|
2019-12-20 11:46:09 +00:00
|
|
|
controller: {
|
|
|
|
xclass: 'Ext.app.ViewController',
|
|
|
|
|
|
|
|
init: function(view) {
|
|
|
|
view.rstore = Ext.create('Proxmox.data.UpdateStore', {
|
|
|
|
autoStart: true,
|
|
|
|
interval: 15 * 1000,
|
2020-07-25 18:10:06 +00:00
|
|
|
storeId: 'pbs-datastore-list',
|
2019-12-20 11:46:09 +00:00
|
|
|
storeid: 'pbs-datastore-list',
|
2020-09-25 16:36:58 +00:00
|
|
|
model: 'pbs-datastore-list',
|
2019-12-20 11:46:09 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
view.rstore.on('load', this.onLoad, this);
|
|
|
|
view.on('destroy', view.rstore.stopUpdate);
|
|
|
|
},
|
|
|
|
|
|
|
|
onLoad: function(store, records, success) {
|
2020-06-05 08:11:51 +00:00
|
|
|
if (!success) return;
|
2019-12-20 11:46:09 +00:00
|
|
|
var view = this.getView();
|
|
|
|
|
|
|
|
let root = view.getStore().getRoot();
|
|
|
|
|
2020-05-25 17:46:43 +00:00
|
|
|
// FIXME: newly added always get appended to the end..
|
|
|
|
records.sort((a, b) => {
|
2020-09-25 16:36:58 +00:00
|
|
|
if (a.id > b.id) return 1;
|
2020-05-25 17:46:43 +00:00
|
|
|
if (a.id < b.id) return -1;
|
|
|
|
return 0;
|
|
|
|
});
|
|
|
|
|
2020-06-05 08:11:51 +00:00
|
|
|
var list = root.findChild('path', 'pbsDataStoreConfig', false);
|
2019-12-20 11:46:09 +00:00
|
|
|
var length = records.length;
|
|
|
|
var lookup_hash = {};
|
|
|
|
for (var i = 0; i < length; i++) {
|
2020-09-25 16:36:58 +00:00
|
|
|
let name = records[i].id;
|
2019-12-20 11:46:09 +00:00
|
|
|
lookup_hash[name] = true;
|
|
|
|
if (!list.findChild('text', name, false)) {
|
|
|
|
list.appendChild({
|
|
|
|
text: name,
|
2020-05-20 10:15:38 +00:00
|
|
|
path: `DataStore-${name}`,
|
2019-12-21 08:15:57 +00:00
|
|
|
iconCls: 'fa fa-database',
|
2020-09-25 16:36:58 +00:00
|
|
|
leaf: true,
|
2019-12-20 11:46:09 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var erase_list = [];
|
|
|
|
list.eachChild(function(node) {
|
2020-09-25 16:36:58 +00:00
|
|
|
let name = node.data.text;
|
2019-12-20 11:46:09 +00:00
|
|
|
if (!lookup_hash[name]) {
|
|
|
|
erase_list.push(node);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Ext.Array.forEach(erase_list, function(node) { node.erase(); });
|
2020-09-25 16:36:58 +00:00
|
|
|
},
|
2019-12-20 11:46:09 +00:00
|
|
|
},
|
|
|
|
|
2019-01-22 10:48:00 +00:00
|
|
|
select: function(path) {
|
|
|
|
var me = this;
|
|
|
|
var item = me.getStore().findRecord('path', path, 0, false, true, true);
|
|
|
|
me.setSelection(item);
|
|
|
|
},
|
|
|
|
|
|
|
|
animation: false,
|
|
|
|
expanderOnly: true,
|
|
|
|
expanderFirst: false,
|
|
|
|
store: 'NavigationStore',
|
2020-09-25 16:36:58 +00:00
|
|
|
ui: 'nav',
|
2019-01-22 10:48:00 +00:00
|
|
|
});
|