From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 1A86270AFA for ; Fri, 14 May 2021 16:36:36 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 09CD9194A1 for ; Fri, 14 May 2021 16:36:06 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 260CC19496 for ; Fri, 14 May 2021 16:36:04 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id F283D42881 for ; Fri, 14 May 2021 16:36:03 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Fri, 14 May 2021 16:36:03 +0200 Message-Id: <20210514143603.6713-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210514143603.6713-1-d.csapak@proxmox.com> References: <20210514143603.6713-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.015 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [parentnode.id] Subject: [pbs-devel] [PATCH proxmox-backup 2/2] ui: datastore/Content: add forget button for groups X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 14:36:36 -0000 since we can remove whole groups via api now Signed-off-by: Dominik Csapak --- www/datastore/Content.js | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/www/datastore/Content.js b/www/datastore/Content.js index 1394b2ea..67ebbdac 100644 --- a/www/datastore/Content.js +++ b/www/datastore/Content.js @@ -382,10 +382,30 @@ Ext.define('PBS.DataStoreContent', { let data = rec.data; if (!view.datastore) return; + 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 = { + "backup-type": data.backup_type, + "backup-id": data.backup_id, + }; + } + Ext.Msg.show({ title: gettext('Confirm'), icon: Ext.Msg.WARNING, - message: Ext.String.format(gettext('Are you sure you want to remove snapshot {0}'), `'${data.text}'`), + message, buttons: Ext.Msg.YESNO, defaultFocus: 'no', callback: function(btn) { @@ -394,12 +414,8 @@ Ext.define('PBS.DataStoreContent', { } 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`, + url, + params, method: 'DELETE', waitMsgTarget: view, failure: function(response, opts) { @@ -617,8 +633,8 @@ Ext.define('PBS.DataStoreContent', { { handler: 'onForget', getTip: (v, m, rec) => Ext.String.format(gettext("Permanently forget snapshot '{0}'"), v), - getClass: (v, m, rec) => !rec.data.leaf && rec.parentNode.id !== 'root' ? 'fa critical fa-trash-o' : 'pmx-hidden', - isDisabled: (v, r, c, i, rec) => rec.data.leaf || rec.parentNode.id === 'root', + getClass: (v, m, rec) => !rec.data.leaf ? 'fa critical fa-trash-o' : 'pmx-hidden', + isDisabled: (v, r, c, i, rec) => !!rec.data.leaf, }, { handler: 'downloadFile', -- 2.20.1