2022-05-14 18:51:54 +02:00
Ext . define ( 'PBS.panel.PruneInputPanel' , {
extend : 'Proxmox.panel.InputPanel' ,
xtype : 'pbsPruneInputPanel' ,
mixins : [ 'Proxmox.Mixin.CBind' ] ,
onlineHelp : 'maintenance_pruning' ,
2022-05-19 13:34:07 +02:00
// show/hide dry-run field FIXME: rename to canDryrun, this is confusing..
2022-05-14 18:51:54 +02:00
dryrun : false ,
2022-05-19 13:34:07 +02:00
canRecurse : false , // show a recursive/max-depth field
2022-05-14 18:51:54 +02:00
cbindData : function ( ) {
let me = this ;
me . isCreate = ! ! me . isCreate ;
return {
ns : me . ns ? ? '' ,
} ;
} ,
2022-05-19 13:34:07 +02:00
viewModel : {
data : { canRecurse : false } ,
} ,
2022-05-14 18:51:54 +02:00
onGetValues : function ( values ) {
2022-05-19 13:34:07 +02:00
let me = this ;
if ( me . ns && me . ns !== '' ) {
values . ns = me . ns ;
}
2024-03-06 12:21:02 +01:00
if ( ! values . recursive && me . canRecurse ) {
2022-05-19 13:34:07 +02:00
values [ 'max-depth' ] = 0 ;
2022-05-14 18:51:54 +02:00
}
2022-05-19 13:34:07 +02:00
delete values . recursive ;
2022-05-14 18:51:54 +02:00
return values ;
} ,
column1 : [
{
xtype : 'pbsPruneKeepInput' ,
name : 'keep-last' ,
fieldLabel : gettext ( 'Keep Last' ) ,
cbind : {
deleteEmpty : '{!isCreate}' ,
} ,
} ,
{
xtype : 'pbsPruneKeepInput' ,
name : 'keep-daily' ,
fieldLabel : gettext ( 'Keep Daily' ) ,
cbind : {
deleteEmpty : '{!isCreate}' ,
} ,
} ,
{
xtype : 'pbsPruneKeepInput' ,
name : 'keep-monthly' ,
fieldLabel : gettext ( 'Keep Monthly' ) ,
cbind : {
deleteEmpty : '{!isCreate}' ,
} ,
} ,
2022-05-19 13:34:07 +02:00
{
xtype : 'proxmoxcheckbox' ,
name : 'dry-run' ,
fieldLabel : gettext ( 'Dry Run' ) ,
cbind : {
hidden : '{!dryrun}' ,
disabled : '{!dryrun}' ,
} ,
} ,
2022-05-14 18:51:54 +02:00
] ,
column2 : [
{
xtype : 'pbsPruneKeepInput' ,
fieldLabel : gettext ( 'Keep Hourly' ) ,
name : 'keep-hourly' ,
cbind : {
deleteEmpty : '{!isCreate}' ,
} ,
} ,
{
xtype : 'pbsPruneKeepInput' ,
name : 'keep-weekly' ,
fieldLabel : gettext ( 'Keep Weekly' ) ,
cbind : {
deleteEmpty : '{!isCreate}' ,
} ,
} ,
{
xtype : 'pbsPruneKeepInput' ,
name : 'keep-yearly' ,
fieldLabel : gettext ( 'Keep Yearly' ) ,
cbind : {
deleteEmpty : '{!isCreate}' ,
} ,
} ,
{
2022-05-19 13:34:07 +02:00
xtype : 'fieldcontainer' ,
layout : 'hbox' ,
fieldLabel : gettext ( 'Recursive' ) ,
2022-05-14 18:51:54 +02:00
cbind : {
2022-05-19 13:34:07 +02:00
hidden : '{!canRecurse}' ,
disabled : '{!canRecurse}' ,
2022-05-14 18:51:54 +02:00
} ,
2022-05-19 13:34:07 +02:00
items : [
{
xtype : 'proxmoxcheckbox' ,
name : 'recursive' ,
uncheckedValue : false ,
value : true ,
bind : {
value : '{canRecurse}' ,
} ,
} ,
{
xtype : 'pbsNamespaceMaxDepth' ,
name : 'max-depth' ,
padding : '0 0 0 5' ,
labelWidth : 75 ,
deleteEmpty : false ,
bind : {
disabled : '{!canRecurse}' ,
} ,
flex : 1 ,
} ,
] ,
2022-05-14 18:51:54 +02:00
} ,
] ,
} ) ;