[pve-devel] [PATCH v2 manager 1/2] backupview: add file restore button

Stefan Reiter s.reiter at proxmox.com
Thu Apr 22 17:47:38 CEST 2021


Adds it for both BackupViews, on VM view and storage view.

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---

Forgot to resend this one for v2, it didn't change though AFAIR.

 www/manager6/grid/BackupView.js    | 23 +++++++++++++++++++++++
 www/manager6/storage/BackupView.js | 19 +++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/www/manager6/grid/BackupView.js b/www/manager6/grid/BackupView.js
index b50f52ed..7beeca0e 100644
--- a/www/manager6/grid/BackupView.js
+++ b/www/manager6/grid/BackupView.js
@@ -228,6 +228,28 @@ Ext.define('PVE.grid.BackupView', {
 	    },
 	});
 
+	let file_restore_btn = Ext.create('Proxmox.button.Button', {
+	    text: gettext('File Restore'),
+	    disabled: true,
+	    selModel: sm,
+	    enableFn: function(rec) {
+		return !!rec && isPBS;
+	    },
+	    handler: function(b, e, rec) {
+		var storage = storagesel.getValue();
+		Ext.create('Proxmox.window.FileBrowser', {
+		    title: gettext('File Restore') + " - " + rec.data.text,
+		    listURL: `/api2/json/nodes/localhost/storage/${storage}/file-restore/list`,
+		    downloadURL: `/api2/json/nodes/localhost/storage/${storage}/file-restore/download`,
+		    extraParams: {
+			snapshot: rec.data.text,
+		    },
+		    archive: PVE.Utils.volume_is_qemu_backup(rec.data.volid, rec.data.format) ?
+			'all' : undefined,
+		}).show();
+	    },
+	});
+
 	Ext.apply(me, {
 	    selModel: sm,
 	    tbar: {
@@ -238,6 +260,7 @@ Ext.define('PVE.grid.BackupView', {
 		    delete_btn,
 		    '-',
 		    config_btn,
+		    file_restore_btn,
 		    '-',
 		    {
 			xtype: 'proxmoxButton',
diff --git a/www/manager6/storage/BackupView.js b/www/manager6/storage/BackupView.js
index 3dd500c2..5be18409 100644
--- a/www/manager6/storage/BackupView.js
+++ b/www/manager6/storage/BackupView.js
@@ -133,6 +133,25 @@ Ext.define('PVE.storage.BackupView', {
 		    renderer: PVE.Utils.render_backup_verification,
 		},
 	    };
+
+	    me.tbar.push({
+		xtype: 'proxmoxButton',
+		text: gettext('File Restore'),
+		disabled: true,
+		selModel: sm,
+		handler: function(b, e, rec) {
+		    Ext.create('Proxmox.window.FileBrowser', {
+			title: gettext('File Restore') + " - " + rec.data.text,
+			listURL: `/api2/json/nodes/localhost/storage/${me.storage}/file-restore/list`,
+			downloadURL: `/api2/json/nodes/localhost/storage/${me.storage}/file-restore/download`,
+			extraParams: {
+			    snapshot: rec.data.text,
+			},
+			archive: PVE.Utils.volume_is_qemu_backup(rec.data.volid, rec.data.format) ?
+			    'all' : undefined,
+		    }).show();
+		},
+	    });
 	}
 
 	me.callParent();
-- 
2.20.1






More information about the pve-devel mailing list