proxmox-backup/www/DataStorePanel.js
Dominik Csapak 1dceaed1e9 ui: DataStorePanel: save active tab statefully
so that the last selected tab for datastores will get selected
the next time any datastore is selected, even across browser
reloads

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-10-27 17:41:30 +01:00

97 lines
1.7 KiB
JavaScript

Ext.define('PBS.DataStorePanel', {
extend: 'Ext.tab.Panel',
alias: 'widget.pbsDataStorePanel',
mixins: ['Proxmox.Mixin.CBind'],
cbindData: function(initalConfig) {
let me = this;
return {
aclPath: `/datastore/${me.datastore}`,
};
},
stateId: 'pbs-datastore-panel',
stateful: true,
stateEvents: ['tabchange'],
applyState: function(state) {
let me = this;
if (state.tab !== undefined) {
me.setActiveTab(state.tab);
}
},
getState: function() {
let me = this;
return {
tab: me.getActiveTab().getItemId(),
};
},
border: false,
defaults: {
border: false,
},
items: [
{
xtype: 'pbsDataStoreSummary',
title: gettext('Summary'),
itemId: 'summary',
iconCls: 'fa fa-book',
cbind: {
datastore: '{datastore}',
},
},
{
xtype: 'pbsDataStoreContent',
itemId: 'content',
iconCls: 'fa fa-th',
cbind: {
datastore: '{datastore}',
},
},
{
title: gettext('Prune & Garbage collection'),
xtype: 'pbsDataStorePruneAndGC',
itemId: 'prunegc',
iconCls: 'fa fa-trash-o',
cbind: {
datastore: '{datastore}',
},
},
{
iconCls: 'fa fa-refresh',
itemId: 'syncjobs',
xtype: 'pbsSyncJobView',
cbind: {
datastore: '{datastore}',
},
},
{
iconCls: 'fa fa-check-circle',
itemId: 'verifyjobs',
xtype: 'pbsVerifyJobView',
cbind: {
datastore: '{datastore}',
},
},
{
itemId: 'acl',
xtype: 'pbsACLView',
iconCls: 'fa fa-unlock',
aclExact: true,
cbind: {
aclPath: '{aclPath}',
},
},
],
initComponent: function() {
let me = this;
me.title = `${gettext("Datastore")}: ${me.datastore}`;
me.callParent();
},
});