[pve-devel] [PATCH v2 manager 4/5] ui: backup views: add button to change protection status

Fabian Ebner f.ebner at proxmox.com
Thu Sep 30 13:42:14 CEST 2021


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

New in v2.

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

diff --git a/www/manager6/grid/BackupView.js b/www/manager6/grid/BackupView.js
index 3731c985..b8407104 100644
--- a/www/manager6/grid/BackupView.js
+++ b/www/manager6/grid/BackupView.js
@@ -297,6 +297,25 @@ Ext.define('PVE.grid.BackupView', {
 			    }).show();
 			},
 		    },
+		    {
+			xtype: 'proxmoxButton',
+			text: gettext('Change Protection'),
+			disabled: true,
+			handler: function(button, event, record) {
+			    const volid = record.data.volid;
+			    const storage = storagesel.getValue();
+			    const url =
+				`/api2/extjs/nodes/${nodename}/storage/${storage}/content/${volid}`;
+			    Proxmox.Utils.API2Request({
+				url: url,
+				method: 'PUT',
+				waitMsgTarget: me,
+				params: { 'protected': record.data.protected ? 0 : 1 },
+				failure: (response) => Ext.Msg.alert('Error', response.htmlStatus),
+				success: (response) => reload(),
+			    });
+			},
+		    },
 		    '-',
 		    delete_btn,
 		    '->',
diff --git a/www/manager6/storage/BackupView.js b/www/manager6/storage/BackupView.js
index 359f5f18..dca140fe 100644
--- a/www/manager6/storage/BackupView.js
+++ b/www/manager6/storage/BackupView.js
@@ -171,6 +171,22 @@ Ext.define('PVE.storage.BackupView', {
 		    }).show();
 		},
 	    },
+	    {
+		xtype: 'proxmoxButton',
+		text: gettext('Change Protection'),
+		disabled: true,
+		handler: function(button, event, record) {
+		    const volid = record.data.volid;
+		    Proxmox.Utils.API2Request({
+			url: `/api2/extjs/nodes/${nodename}/storage/${me.storage}/content/${volid}`,
+			method: 'PUT',
+			waitMsgTarget: me,
+			params: { 'protected': record.data.protected ? 0 : 1 },
+			failure: (response) => Ext.Msg.alert('Error', response.htmlStatus),
+			success: (response) => reload(),
+		    });
+		},
+	    },
 	    '-',
 	    pruneButton,
 	);
-- 
2.30.2





More information about the pve-devel mailing list