2020-05-29 10:53:41 +02:00
Ext . define ( 'PBS.window.SyncJobEdit' , {
extend : 'Proxmox.window.Edit' ,
alias : 'widget.pbsSyncJobEdit' ,
mixins : [ 'Proxmox.Mixin.CBind' ] ,
userid : undefined ,
2020-09-11 10:35:28 +02:00
onlineHelp : 'syncjobs' ,
2020-05-29 10:53:41 +02:00
isAdd : true ,
subject : gettext ( 'SyncJob' ) ,
fieldDefaults : { labelWidth : 120 } ,
cbindData : function ( initialConfig ) {
let me = this ;
let baseurl = '/api2/extjs/config/sync' ;
let id = initialConfig . id ;
me . isCreate = ! id ;
me . url = id ? ` ${ baseurl } / ${ id } ` : baseurl ;
me . method = id ? 'PUT' : 'POST' ;
me . autoLoad = ! ! id ;
2020-11-04 19:04:06 +01:00
me . scheduleValue = id ? null : 'hourly' ;
2020-05-29 10:53:41 +02:00
return { } ;
} ,
items : {
xtype : 'inputpanel' ,
2020-10-28 21:25:30 +01:00
onGetValues : function ( values ) {
let me = this ;
if ( ! values . id && me . up ( 'pbsSyncJobEdit' ) . isCreate ) {
values . id = 'auto-' + Ext . data . identifier . Uuid . Global . generate ( ) . slice ( 0 , 23 ) ;
}
return values ;
} ,
2020-05-29 10:53:41 +02:00
column1 : [
{
2020-10-28 21:25:30 +01:00
xtype : 'displayfield' ,
name : 'store' ,
fieldLabel : gettext ( 'Local Datastore' ) ,
2020-05-29 10:53:41 +02:00
allowBlank : false ,
2020-10-28 21:25:30 +01:00
submitValue : true ,
2020-05-29 10:53:41 +02:00
cbind : {
2020-10-28 21:25:30 +01:00
value : '{datastore}' ,
2020-05-29 10:53:41 +02:00
} ,
} ,
{
2020-07-21 18:46:55 +02:00
fieldLabel : gettext ( 'Source Remote' ) ,
2020-05-29 10:53:41 +02:00
xtype : 'pbsRemoteSelector' ,
allowBlank : false ,
name : 'remote' ,
} ,
{
2020-07-21 18:46:55 +02:00
fieldLabel : gettext ( 'Source Datastore' ) ,
xtype : 'proxmoxtextfield' ,
2020-05-29 10:53:41 +02:00
allowBlank : false ,
2020-07-21 18:46:55 +02:00
name : 'remote-store' ,
2020-05-29 10:53:41 +02:00
} ,
2020-10-28 21:25:30 +01:00
] ,
2020-05-29 10:53:41 +02:00
column2 : [
2020-10-30 12:36:41 +01:00
{
fieldLabel : gettext ( 'Owner' ) ,
xtype : 'pbsUserSelector' ,
name : 'owner' ,
allowBlank : true ,
emptyText : 'backup@pam' ,
2020-11-04 11:34:14 +01:00
skipEmptyText : true ,
cbind : {
deleteEmpty : '{!isCreate}' ,
2020-10-30 12:36:41 +01:00
} ,
} ,
2020-05-29 10:53:41 +02:00
{
fieldLabel : gettext ( 'Remove vanished' ) ,
xtype : 'proxmoxcheckbox' ,
name : 'remove-vanished' ,
uncheckedValue : false ,
2020-07-21 18:48:30 +02:00
value : false ,
2020-05-29 10:53:41 +02:00
} ,
{
fieldLabel : gettext ( 'Schedule' ) ,
2020-07-21 19:32:25 +02:00
xtype : 'pbsCalendarEvent' ,
2020-05-29 10:53:41 +02:00
name : 'schedule' ,
2020-10-28 21:25:30 +01:00
emptyText : gettext ( 'none (disabled)' ) ,
2020-06-23 15:29:57 +02:00
cbind : {
deleteEmpty : '{!isCreate}' ,
2020-11-04 19:04:06 +01:00
value : '{scheduleValue}' ,
2020-06-23 15:29:57 +02:00
} ,
2020-05-29 10:53:41 +02:00
} ,
] ,
columnB : [
{
fieldLabel : gettext ( 'Comment' ) ,
xtype : 'proxmoxtextfield' ,
name : 'comment' ,
2020-06-23 15:29:57 +02:00
cbind : {
deleteEmpty : '{!isCreate}' ,
} ,
2020-05-29 10:53:41 +02:00
} ,
] ,
} ,
} ) ;