From 21e3ed344942291e8db09d0159cff214331b2dad Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 24 Feb 2021 11:19:12 +0100 Subject: [PATCH] tape: add 'latest-only' property to backup job config --- src/api2/config/tape_backup_job.rs | 2 ++ src/config/tape_job.rs | 7 +++++++ www/tape/BackupJobs.js | 7 +++++++ www/tape/window/TapeBackupJob.js | 18 +++++++++++++++++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/api2/config/tape_backup_job.rs b/src/api2/config/tape_backup_job.rs index bc05704c..560766f2 100644 --- a/src/api2/config/tape_backup_job.rs +++ b/src/api2/config/tape_backup_job.rs @@ -117,6 +117,8 @@ pub enum DeletableProperty { EjectMedia, /// Delete the export-media-set property ExportMediaSet, + /// Delete the 'latest-only' property + LatestOnly, } #[api( diff --git a/src/config/tape_job.rs b/src/config/tape_job.rs index 913eaa06..184f307e 100644 --- a/src/config/tape_job.rs +++ b/src/config/tape_job.rs @@ -53,6 +53,11 @@ lazy_static! { type: bool, optional: true, }, + "latest-only": { + description: "Backup latest snapshots only.", + type: bool, + optional: true, + }, comment: { optional: true, schema: SINGLE_LINE_COMMENT_SCHEMA, @@ -77,6 +82,8 @@ pub struct TapeBackupJobConfig { #[serde(skip_serializing_if="Option::is_none")] export_media_set: Option, #[serde(skip_serializing_if="Option::is_none")] + latest_only: Option, + #[serde(skip_serializing_if="Option::is_none")] pub comment: Option, #[serde(skip_serializing_if="Option::is_none")] pub schedule: Option, diff --git a/www/tape/BackupJobs.js b/www/tape/BackupJobs.js index b8f5a084..84b260b9 100644 --- a/www/tape/BackupJobs.js +++ b/www/tape/BackupJobs.js @@ -4,6 +4,7 @@ Ext.define('pbs-tape-backup-job-status', { 'id', 'store', 'pool', 'drive', 'store', 'schedule', 'comment', { name: 'eject-media', type: 'boolean' }, { name: 'export-media-set', type: 'boolean' }, + { name: 'latest-only', type: 'boolean' }, 'next-run', 'last-run-upid', 'last-run-state', 'last-run-endtime', { name: 'duration', @@ -214,6 +215,12 @@ Ext.define('PBS.config.TapeBackupJobView', { width: 60, sortable: false, }, + { + header: gettext('Latest Only'), + dataIndex: 'latest-only', + renderer: Proxmox.Utils.format_boolean, + sortable: false, + }, { header: gettext('Schedule'), dataIndex: 'schedule', diff --git a/www/tape/window/TapeBackupJob.js b/www/tape/window/TapeBackupJob.js index 7b99e647..7cd3e462 100644 --- a/www/tape/window/TapeBackupJob.js +++ b/www/tape/window/TapeBackupJob.js @@ -29,6 +29,14 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', { items: { 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: [ { xtype: 'pmxDisplayEditField', @@ -76,7 +84,7 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', { deleteEmpty: '{!isCreate}', }, listeners: { - change1: function(cb, value) { + change: function(cb, value) { let me = this; let eject = me.up('window').down('proxmoxcheckbox[name=eject-media]'); if (value) { @@ -94,6 +102,14 @@ Ext.define('PBS.TapeManagement.BackupJobEdit', { deleteEmpty: '{!isCreate}', }, }, + { + fieldLabel: gettext('Latest Only'), + xtype: 'proxmoxcheckbox', + name: 'latest-only', + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, ], columnB: [ -- 2.39.2