From 4ff2c9b8323f4cd1a86117c030a9bd42c9b6603a Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 26 Jun 2020 15:58:06 +0200 Subject: [PATCH] ui: allow to Forget (delete) backup snapshots. --- www/DataStoreContent.js | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/www/DataStoreContent.js b/www/DataStoreContent.js index 746037e9..1ed02eed 100644 --- a/www/DataStoreContent.js +++ b/www/DataStoreContent.js @@ -199,6 +199,34 @@ Ext.define('PBS.DataStoreContent', { win.show(); }, + onForget: function() { + var view = this.getView(); + + let rec = view.selModel.getSelection()[0]; + if (!(rec && rec.data)) return; + let data = rec.data; + if (!data.leaf) return; + + if (!view.datastore) return; + + console.log(data); + + Proxmox.Utils.API2Request({ + params: { + "backup-type": data["backup-type"], + "backup-id": data["backup-id"], + "backup-time": (data['backup-time'].getTime()/1000).toFixed(0), + }, + url: `/admin/datastore/${view.datastore}/snapshots`, + method: 'DELETE', + waitMsgTarget: view, + failure: function(response, opts) { + Ext.Msg.alert(gettext('Error'), response.htmlStatus); + }, + callback: this.reload.bind(this), + }); + }, + openBackupFileDownloader: function() { let me = this; let view = me.getView(); @@ -336,6 +364,21 @@ Ext.define('PBS.DataStoreContent', { enableFn: function(record) { return !record.data.leaf; }, handler: 'onPrune', }, + { + xtype: 'proxmoxButton', + text: gettext('Forget'), + disabled: true, + parentXType: 'pbsDataStoreContent', + handler: 'onForget', + confirmMsg: function(record) { + console.log(record); + let name = record.data.text; + return Ext.String.format(gettext('Are you sure you want to remove snapshot {0}'), `'${name}'`); + }, + enableFn: function(record) { + return !!record.data.leaf; + }, + }, { xtype: 'proxmoxButton', text: gettext('Download Files'),