2020-05-20 12:15:38 +02:00
Ext . define ( 'PBS.DataStorePanel' , {
extend : 'Ext.tab.Panel' ,
alias : 'widget.pbsDataStorePanel' ,
mixins : [ 'Proxmox.Mixin.CBind' ] ,
2024-08-07 14:10:45 +02:00
cbindData : function ( initialConfig ) {
2020-05-20 12:15:38 +02:00
let me = this ;
return {
aclPath : ` /datastore/ ${ me . datastore } ` ,
} ;
} ,
2020-10-27 16:20:11 +01:00
stateId : 'pbs-datastore-panel' ,
stateful : true ,
stateEvents : [ 'tabchange' ] ,
applyState : function ( state ) {
let me = this ;
2020-11-10 14:16:16 +01:00
if ( state . tab !== undefined && me . rendered ) {
2020-10-27 16:20:11 +01:00
me . setActiveTab ( state . tab ) ;
2020-11-10 14:16:16 +01:00
} else if ( state . tab ) {
// if we are not rendered yet, defer setting the activetab
2022-05-18 18:04:16 +02:00
setTimeout ( ( ) => me . setActiveTab ( state . tab ) , 10 ) ;
2020-10-27 16:20:11 +01:00
}
} ,
getState : function ( ) {
let me = this ;
return {
tab : me . getActiveTab ( ) . getItemId ( ) ,
} ;
} ,
2020-05-20 12:15:38 +02:00
border : false ,
defaults : {
border : false ,
} ,
2020-11-10 09:15:12 +01:00
tools : [ PBS . Utils . get _help _tool ( "datastore_intro" ) ] ,
2020-05-20 12:15:38 +02:00
items : [
{
2020-10-27 16:20:07 +01:00
xtype : 'pbsDataStoreSummary' ,
title : gettext ( 'Summary' ) ,
itemId : 'summary' ,
2020-10-27 16:20:08 +01:00
iconCls : 'fa fa-book' ,
2020-10-27 16:20:06 +01:00
cbind : {
datastore : '{datastore}' ,
} ,
} ,
{
2020-10-27 16:20:07 +01:00
xtype : 'pbsDataStoreContent' ,
itemId : 'content' ,
2020-10-27 16:20:08 +01:00
iconCls : 'fa fa-th' ,
2020-05-20 12:15:38 +02:00
cbind : {
datastore : '{datastore}' ,
} ,
} ,
2020-05-26 12:19:04 +02:00
{
2024-04-18 12:16:59 +02:00
xtype : 'pbsPruneAndGC' ,
2020-10-27 16:20:07 +01:00
itemId : 'prunegc' ,
2020-10-27 16:20:08 +01:00
iconCls : 'fa fa-trash-o' ,
cbind : {
datastore : '{datastore}' ,
} ,
} ,
{
iconCls : 'fa fa-refresh' ,
itemId : 'syncjobs' ,
2024-11-25 12:15:35 +01:00
xtype : 'pbsSyncJobView' ,
2020-10-27 16:20:08 +01:00
cbind : {
datastore : '{datastore}' ,
} ,
} ,
{
iconCls : 'fa fa-check-circle' ,
itemId : 'verifyjobs' ,
xtype : 'pbsVerifyJobView' ,
2020-05-26 12:19:04 +02:00
cbind : {
datastore : '{datastore}' ,
} ,
} ,
2020-11-06 17:51:52 +01:00
{
xtype : 'pbsDatastoreOptionView' ,
itemId : 'options' ,
title : gettext ( 'Options' ) ,
iconCls : 'fa fa-cog' ,
cbind : {
datastore : '{datastore}' ,
} ,
} ,
2020-05-20 12:15:38 +02:00
{
itemId : 'acl' ,
xtype : 'pbsACLView' ,
2020-10-27 16:20:08 +01:00
iconCls : 'fa fa-unlock' ,
2020-05-20 12:15:38 +02:00
cbind : {
aclPath : '{aclPath}' ,
2022-05-18 18:09:15 +02:00
datastore : '{datastore}' ,
2020-05-20 12:15:38 +02:00
} ,
} ,
] ,
initComponent : function ( ) {
let me = this ;
2020-07-02 17:20:38 +02:00
me . title = ` ${ gettext ( "Datastore" ) } : ${ me . datastore } ` ;
2020-11-10 14:16:16 +01:00
// remove invalid activeTab settings
if ( me . activeTab && ! me . items . some ( ( item ) => item . itemId === me . activeTab ) ) {
delete me . activeTab ;
}
2020-05-20 12:15:38 +02:00
me . callParent ( ) ;
} ,
} ) ;