2021-02-23 10:58:01 +00:00
|
|
|
Ext.define('PBS.TapeManagement.BackupJobEdit', {
|
|
|
|
extend: 'Proxmox.window.Edit',
|
|
|
|
alias: 'widget.pbsTapeBackupJobEdit',
|
|
|
|
mixins: ['Proxmox.Mixin.CBind'],
|
|
|
|
|
|
|
|
userid: undefined,
|
|
|
|
|
|
|
|
isAdd: true,
|
|
|
|
|
|
|
|
subject: gettext('Tape Backup Job'),
|
|
|
|
|
|
|
|
fieldDefaults: { labelWidth: 120 },
|
|
|
|
|
|
|
|
cbindData: function(initialConfig) {
|
|
|
|
let me = this;
|
|
|
|
|
|
|
|
let baseurl = '/api2/extjs/config/tape-backup-job';
|
|
|
|
let id = initialConfig.id;
|
|
|
|
|
|
|
|
me.isCreate = !id;
|
|
|
|
me.url = id ? `${baseurl}/${id}` : baseurl;
|
|
|
|
me.method = id ? 'PUT' : 'POST';
|
|
|
|
me.autoLoad = !!id;
|
|
|
|
me.scheduleValue = id ? null : 'daily';
|
|
|
|
me.authid = id ? null : Proxmox.UserName;
|
|
|
|
me.editDatastore = me.datastore === undefined && me.isCreate;
|
|
|
|
return { };
|
|
|
|
},
|
|
|
|
|
|
|
|
items: {
|
|
|
|
xtype: 'inputpanel',
|
2021-02-24 10:19:12 +00:00
|
|
|
onGetValues: function(values) {
|
|
|
|
let me = this;
|
|
|
|
|
|
|
|
if (values['export-media-set'] && !me.up('pbsTapeBackupJobEdit').isCreate) {
|
2021-03-01 13:13:41 +00:00
|
|
|
Proxmox.Utils.assemble_field_data(values, { "delete": 'eject-media' });
|
2021-02-24 10:19:12 +00:00
|
|
|
}
|
2021-03-05 08:45:32 +00:00
|
|
|
PBS.Utils.delete_if_default(values, 'notify-user');
|
2021-02-24 10:19:12 +00:00
|
|
|
return values;
|
|
|
|
},
|
2021-02-23 10:58:01 +00:00
|
|
|
column1: [
|
2021-02-24 07:41:39 +00:00
|
|
|
{
|
|
|
|
xtype: 'pmxDisplayEditField',
|
|
|
|
name: 'id',
|
|
|
|
fieldLabel: gettext('Job ID'),
|
|
|
|
renderer: Ext.htmlEncode,
|
|
|
|
allowBlank: false,
|
|
|
|
cbind: {
|
|
|
|
editable: '{isCreate}',
|
|
|
|
},
|
|
|
|
},
|
2021-02-23 10:58:01 +00:00
|
|
|
{
|
|
|
|
xtype: 'pbsDataStoreSelector',
|
|
|
|
fieldLabel: gettext('Local Datastore'),
|
|
|
|
name: 'store',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'pbsMediaPoolSelector',
|
|
|
|
fieldLabel: gettext('Media Pool'),
|
|
|
|
name: 'pool',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'pbsDriveSelector',
|
|
|
|
fieldLabel: gettext('Drive'),
|
|
|
|
name: 'drive',
|
|
|
|
},
|
2021-03-05 08:45:32 +00:00
|
|
|
{
|
|
|
|
xtype: 'pbsUserSelector',
|
|
|
|
name: 'notify-user',
|
|
|
|
fieldLabel: gettext('Notify User'),
|
|
|
|
emptyText: 'root@pam',
|
|
|
|
allowBlank: true,
|
|
|
|
renderer: Ext.String.htmlEncode,
|
|
|
|
},
|
2021-02-23 10:58:01 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
column2: [
|
|
|
|
{
|
|
|
|
fieldLabel: gettext('Schedule'),
|
|
|
|
xtype: 'pbsCalendarEvent',
|
|
|
|
name: 'schedule',
|
|
|
|
emptyText: gettext('none (disabled)'),
|
|
|
|
cbind: {
|
|
|
|
deleteEmpty: '{!isCreate}',
|
|
|
|
value: '{scheduleValue}',
|
|
|
|
},
|
|
|
|
},
|
2021-02-24 07:41:39 +00:00
|
|
|
{
|
2021-05-21 13:53:50 +00:00
|
|
|
fieldLabel: gettext('Export Media-Set'),
|
2021-02-24 07:41:39 +00:00
|
|
|
xtype: 'proxmoxcheckbox',
|
|
|
|
name: 'export-media-set',
|
|
|
|
cbind: {
|
|
|
|
deleteEmpty: '{!isCreate}',
|
|
|
|
},
|
|
|
|
listeners: {
|
2021-02-24 10:19:12 +00:00
|
|
|
change: function(cb, value) {
|
2021-02-24 07:41:39 +00:00
|
|
|
let me = this;
|
|
|
|
let eject = me.up('window').down('proxmoxcheckbox[name=eject-media]');
|
|
|
|
if (value) {
|
|
|
|
eject.setValue(false);
|
|
|
|
}
|
|
|
|
eject.setDisabled(!!value);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldLabel: gettext('Eject Media'),
|
|
|
|
xtype: 'proxmoxcheckbox',
|
|
|
|
name: 'eject-media',
|
|
|
|
cbind: {
|
|
|
|
deleteEmpty: '{!isCreate}',
|
|
|
|
},
|
|
|
|
},
|
2021-02-24 10:19:12 +00:00
|
|
|
{
|
|
|
|
fieldLabel: gettext('Latest Only'),
|
|
|
|
xtype: 'proxmoxcheckbox',
|
|
|
|
name: 'latest-only',
|
|
|
|
cbind: {
|
|
|
|
deleteEmpty: '{!isCreate}',
|
|
|
|
},
|
|
|
|
},
|
2021-02-23 10:58:01 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
columnB: [
|
|
|
|
{
|
|
|
|
fieldLabel: gettext('Comment'),
|
|
|
|
xtype: 'proxmoxtextfield',
|
|
|
|
name: 'comment',
|
|
|
|
cbind: {
|
|
|
|
deleteEmpty: '{!isCreate}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
});
|