From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v5 5/5] ui: tape: add single snapshot restore
Date: Tue, 11 May 2021 12:50:07 +0200 [thread overview]
Message-ID: <20210511105007.3980-6-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210511105007.3980-1-d.csapak@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/tape/BackupOverview.js | 41 ++++++++++++++++++++++++++++++++++
www/tape/window/TapeRestore.js | 25 +++++++++++++++++++++
2 files changed, 66 insertions(+)
diff --git a/www/tape/BackupOverview.js b/www/tape/BackupOverview.js
index 0cc0e18e..c028d58d 100644
--- a/www/tape/BackupOverview.js
+++ b/www/tape/BackupOverview.js
@@ -16,6 +16,38 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
}).show();
},
+ restoreSingle: function(button, record) {
+ let me = this;
+ let view = me.getView();
+ let selection = view.getSelection();
+ if (!selection || selection.length < 1) {
+ return;
+ }
+
+ let node = selection[0];
+ if (node.data.restoreid === undefined) {
+ return;
+ }
+ let restoreid = node.data.restoreid;
+ let mediaset = node.data.text;
+ let uuid = node.data['media-set-uuid'];
+ let datastores = [node.data.store];
+
+ Ext.create('PBS.TapeManagement.TapeRestoreWindow', {
+ mediaset,
+ uuid,
+ list: [
+ restoreid,
+ ],
+ datastores,
+ listeners: {
+ destroy: function() {
+ me.reload();
+ },
+ },
+ }).show();
+ },
+
restore: function(button, record) {
let me = this;
let view = me.getView();
@@ -149,6 +181,7 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
entry.text = entry.snapshot;
entry.leaf = true;
entry.children = [];
+ entry.restoreid = `${entry.store}:${entry.snapshot}`;
let iconCls = PBS.Utils.get_type_icon_cls(entry.snapshot);
if (iconCls !== '') {
entry.iconCls = `fa ${iconCls}`;
@@ -262,6 +295,14 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
parentXType: 'treepanel',
enableFn: (rec) => !!rec.data['media-set-uuid'],
},
+ {
+ xtype: 'proxmoxButton',
+ disabled: true,
+ text: gettext('Restore Snapshot'),
+ handler: 'restoreSingle',
+ parentXType: 'treepanel',
+ enableFn: (rec) => !!rec.data.restoreid,
+ },
],
columns: [
diff --git a/www/tape/window/TapeRestore.js b/www/tape/window/TapeRestore.js
index edb21668..7e4f5cae 100644
--- a/www/tape/window/TapeRestore.js
+++ b/www/tape/window/TapeRestore.js
@@ -10,6 +10,18 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
showTaskViewer: true,
isCreate: true,
+ cbindData: function(config) {
+ let me = this;
+ me.isSingle = false;
+ me.listText = "";
+ if (me.list !== undefined) {
+ me.isSingle = true;
+ me.listText = me.list.join('<br>');
+ me.title = gettext('Restore Snapshot');
+ }
+ return {};
+ },
+
defaults: {
labelWidth: 120,
},
@@ -33,6 +45,10 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
}
delete values.mapping;
+ if (me.up('window').list !== undefined) {
+ values.snapshots = me.up('window').list;
+ }
+
values.store = datastores.join(',');
return values;
@@ -55,6 +71,15 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
value: '{uuid}',
},
},
+ {
+ xtype: 'displayfield',
+ fieldLabel: gettext('Snapshot(s)'),
+ submitValue: false,
+ cbind: {
+ hidden: '{!isSingle}',
+ value: '{listText}',
+ },
+ },
{
xtype: 'pbsDriveSelector',
fieldLabel: gettext('Drive'),
--
2.20.1
next prev parent reply other threads:[~2021-05-11 10:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-11 10:50 [pbs-devel] [PATCH proxmox-backup v5 0/5] tape: " Dominik Csapak
2021-05-11 10:50 ` [pbs-devel] [PATCH proxmox-backup v5 1/5] api2/tape/restore: refactor restore code into its own function Dominik Csapak
2021-05-11 10:50 ` [pbs-devel] [PATCH proxmox-backup v5 2/5] api2/tape/restore: add optional snapshots to 'restore' Dominik Csapak
2021-05-11 10:50 ` [pbs-devel] [PATCH proxmox-backup v5 3/5] tape/inventory: add completion helper for tape snapshots Dominik Csapak
2021-05-11 10:50 ` [pbs-devel] [PATCH proxmox-backup v5 4/5] bin/proxmox-tape: add optional snapshots to restore command Dominik Csapak
2021-05-11 10:50 ` Dominik Csapak [this message]
2021-05-11 11:11 ` [pbs-devel] applied: [PATCH proxmox-backup v5 0/5] tape: single snapshot restore Dietmar Maurer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210511105007.3980-6-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.