tape: add 'latest-only' property to backup job config

This commit is contained in:
Dietmar Maurer 2021-02-24 11:19:12 +01:00
parent 81678129fb
commit 21e3ed3449
4 changed files with 33 additions and 1 deletions

View File

@ -117,6 +117,8 @@ pub enum DeletableProperty {
EjectMedia, EjectMedia,
/// Delete the export-media-set property /// Delete the export-media-set property
ExportMediaSet, ExportMediaSet,
/// Delete the 'latest-only' property
LatestOnly,
} }
#[api( #[api(

View File

@ -53,6 +53,11 @@ lazy_static! {
type: bool, type: bool,
optional: true, optional: true,
}, },
"latest-only": {
description: "Backup latest snapshots only.",
type: bool,
optional: true,
},
comment: { comment: {
optional: true, optional: true,
schema: SINGLE_LINE_COMMENT_SCHEMA, schema: SINGLE_LINE_COMMENT_SCHEMA,
@ -77,6 +82,8 @@ pub struct TapeBackupJobConfig {
#[serde(skip_serializing_if="Option::is_none")] #[serde(skip_serializing_if="Option::is_none")]
export_media_set: Option<bool>, export_media_set: Option<bool>,
#[serde(skip_serializing_if="Option::is_none")] #[serde(skip_serializing_if="Option::is_none")]
latest_only: Option<bool>,
#[serde(skip_serializing_if="Option::is_none")]
pub comment: Option<String>, pub comment: Option<String>,
#[serde(skip_serializing_if="Option::is_none")] #[serde(skip_serializing_if="Option::is_none")]
pub schedule: Option<String>, pub schedule: Option<String>,

View File

@ -4,6 +4,7 @@ Ext.define('pbs-tape-backup-job-status', {
'id', 'store', 'pool', 'drive', 'store', 'schedule', 'comment', 'id', 'store', 'pool', 'drive', 'store', 'schedule', 'comment',
{ name: 'eject-media', type: 'boolean' }, { name: 'eject-media', type: 'boolean' },
{ name: 'export-media-set', type: 'boolean' }, { name: 'export-media-set', type: 'boolean' },
{ name: 'latest-only', type: 'boolean' },
'next-run', 'last-run-upid', 'last-run-state', 'last-run-endtime', 'next-run', 'last-run-upid', 'last-run-state', 'last-run-endtime',
{ {
name: 'duration', name: 'duration',
@ -214,6 +215,12 @@ Ext.define('PBS.config.TapeBackupJobView', {
width: 60, width: 60,
sortable: false, sortable: false,
}, },
{
header: gettext('Latest Only'),
dataIndex: 'latest-only',
renderer: Proxmox.Utils.format_boolean,
sortable: false,
},
{ {
header: gettext('Schedule'), header: gettext('Schedule'),
dataIndex: 'schedule', dataIndex: 'schedule',

View File

@ -29,6 +29,14 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', {
items: { items: {
xtype: 'inputpanel', xtype: 'inputpanel',
onGetValues: function(values) {
let me = this;
if (values['export-media-set'] && !me.up('pbsTapeBackupJobEdit').isCreate) {
Proxmox.Utils.assemble_field_data(values, { delete: 'eject-media' });
}
return values;
},
column1: [ column1: [
{ {
xtype: 'pmxDisplayEditField', xtype: 'pmxDisplayEditField',
@ -76,7 +84,7 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', {
deleteEmpty: '{!isCreate}', deleteEmpty: '{!isCreate}',
}, },
listeners: { listeners: {
change1: function(cb, value) { change: function(cb, value) {
let me = this; let me = this;
let eject = me.up('window').down('proxmoxcheckbox[name=eject-media]'); let eject = me.up('window').down('proxmoxcheckbox[name=eject-media]');
if (value) { if (value) {
@ -94,6 +102,14 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', {
deleteEmpty: '{!isCreate}', deleteEmpty: '{!isCreate}',
}, },
}, },
{
fieldLabel: gettext('Latest Only'),
xtype: 'proxmoxcheckbox',
name: 'latest-only',
cbind: {
deleteEmpty: '{!isCreate}',
},
},
], ],
columnB: [ columnB: [