From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/2] ui: datastore/Content: change group remove to SafeDestroy Window
Date: Mon, 17 May 2021 09:03:15 +0200 [thread overview]
Message-ID: <20210517070315.4510-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210517070315.4510-1-d.csapak@proxmox.com>
so that a user does not accidentally remove a whole group instead
of a snapshot
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/Utils.js | 1 +
www/datastore/Content.js | 68 +++++++++++++++++++++++++---------------
2 files changed, 43 insertions(+), 26 deletions(-)
diff --git a/www/Utils.js b/www/Utils.js
index 14561ad4..f614d77e 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -384,6 +384,7 @@ Ext.define('PBS.Utils', {
dirremove: [gettext('Directory'), gettext('Remove')],
'eject-media': [gettext('Drive'), gettext('Eject Media')],
"format-media": [gettext('Drive'), gettext('Format media')],
+ "forget-group": [gettext('Group'), gettext('Remove Group')],
garbage_collection: ['Datastore', gettext('Garbage Collect')],
'inventory-update': [gettext('Drive'), gettext('Inventory Update')],
'label-media': [gettext('Drive'), gettext('Label Media')],
diff --git a/www/datastore/Content.js b/www/datastore/Content.js
index ca90f82a..5be5bb93 100644
--- a/www/datastore/Content.js
+++ b/www/datastore/Content.js
@@ -374,38 +374,35 @@ Ext.define('PBS.DataStoreContent', {
});
},
- onForget: function(view, rI, cI, item, e, rec) {
+ forgetGroup: function(data) {
let me = this;
- view = this.getView();
-
- if (!(rec && rec.data)) return;
- let data = rec.data;
- if (!view.datastore) return;
+ let view = me.getView();
- let params;
- let message;
- let url;
- if (rec.parentNode.id !== 'root') {
- message = Ext.String.format(gettext('Are you sure you want to remove snapshot {0}'), `'${data.text}'`);
- url = `/admin/datastore/${view.datastore}/snapshots`;
- params = {
- "backup-type": data["backup-type"],
- "backup-id": data["backup-id"],
- "backup-time": (data['backup-time'].getTime()/1000).toFixed(0),
- };
- } else {
- message = Ext.String.format(gettext('Are you sure you want to remove group {0}'), `'${data.text}'`);
- url = `/admin/datastore/${view.datastore}/groups`;
- params = {
+ Ext.create('Proxmox.window.SafeDestroy', {
+ url: `/admin/datastore/${view.datastore}/groups`,
+ params: {
"backup-type": data.backup_type,
"backup-id": data.backup_id,
- };
- }
+ },
+ item: {
+ id: data.text,
+ },
+ autoShow: true,
+ taskName: 'forget-group',
+ listeners: {
+ destroy: () => me.reload(),
+ },
+ });
+ },
+
+ forgetSnapshot: function(data) {
+ let me = this;
+ let view = me.getView();
Ext.Msg.show({
title: gettext('Confirm'),
icon: Ext.Msg.WARNING,
- message,
+ message: Ext.String.format(gettext('Are you sure you want to remove snapshot {0}'), `'${data.text}'`),
buttons: Ext.Msg.YESNO,
defaultFocus: 'no',
callback: function(btn) {
@@ -414,8 +411,12 @@ Ext.define('PBS.DataStoreContent', {
}
Proxmox.Utils.API2Request({
- url,
- params,
+ url: `/admin/datastore/${view.datastore}/snapshots`,
+ params: {
+ "backup-type": data["backup-type"],
+ "backup-id": data["backup-id"],
+ "backup-time": (data['backup-time'].getTime()/1000).toFixed(0),
+ },
method: 'DELETE',
waitMsgTarget: view,
failure: function(response, opts) {
@@ -427,6 +428,21 @@ Ext.define('PBS.DataStoreContent', {
});
},
+ onForget: function(view, rI, cI, item, e, rec) {
+ let me = this;
+ view = this.getView();
+
+ if (!(rec && rec.data)) return;
+ let data = rec.data;
+ if (!view.datastore) return;
+
+ if (rec.parentNode.id !== 'root') {
+ me.forgetSnapshot(data);
+ } else {
+ me.forgetGroup(data);
+ }
+ },
+
downloadFile: function(tV, rI, cI, item, e, rec) {
let me = this;
let view = me.getView();
--
2.20.1
next prev parent reply other threads:[~2021-05-17 7:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 7:03 [pbs-devel] [PATCH proxmox-backup 1/2] ui: datastore/Content: fix wrong tooltip for forgetting Dominik Csapak
2021-05-17 7:03 ` Dominik Csapak [this message]
2021-05-17 8:59 ` [pbs-devel] applied: " 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=20210517070315.4510-2-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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal