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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id EFD0A67BDF; Fri, 28 Aug 2020 10:47:36 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E4A601ECF3; Fri, 28 Aug 2020 10:47:06 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 2B71E1ECD1; Fri, 28 Aug 2020 10:47:06 +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 EAA3F4493D; Fri, 28 Aug 2020 10:47:05 +0200 (CEST) From: Hannes Laimer To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com Date: Fri, 28 Aug 2020 10:46:51 +0200 Message-Id: <20200828084658.22057-3-h.laimer@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200828084658.22057-1-h.laimer@proxmox.com> References: <20200828084658.22057-1-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH v3 proxmox-widget-toolbox 2/9] safe-destroy: replace type with purgeable and taskName X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 08:47:37 -0000 Signed-off-by: Hannes Laimer --- type is replaced with the two fields purgeable and taskName, type was pve-manager specific src/window/SafeDestroy.js | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/window/SafeDestroy.js b/src/window/SafeDestroy.js index b1001a8..71dce24 100644 --- a/src/window/SafeDestroy.js +++ b/src/window/SafeDestroy.js @@ -18,9 +18,10 @@ Ext.define('Proxmox.window.SafeDestroy', { config: { item: { id: undefined, - type: undefined, + purgeable: false, }, url: undefined, + taskName: undefined, params: {}, }, @@ -159,28 +160,17 @@ Ext.define('Proxmox.window.SafeDestroy', { throw "no ID specified"; } - if (!Ext.isDefined(item.type)) { - throw "no VM type specified"; - } - var messageCmp = me.lookupReference('messageCmp'); var msg; - if (item.type === 'VM') { - msg = Proxmox.Utils.format_task_description('qmdestroy', item.id); - } else if (item.type === 'CT') { - msg = Proxmox.Utils.format_task_description('vzdestroy', item.id); - } else if (item.type === 'CephPool') { - msg = Proxmox.Utils.format_task_description('cephdestroypool', item.id); - } else if (item.type === 'Image') { - msg = Proxmox.Utils.format_task_description('unknownimgdel', item.id); + if (Ext.isDefined(me.getTaskName())) { + msg = Proxmox.Utils.format_task_description(me.getTaskName(), item.id); + messageCmp.setHtml(msg); } else { - throw "unknown item type specified"; + throw "no task name specified"; } - messageCmp.setHtml(msg); - - if (!(item.type === 'VM' || item.type === 'CT')) { + if (!item.purgeable) { let purgeCheckbox = me.lookupReference('purgeCheckbox'); purgeCheckbox.setDisabled(true); purgeCheckbox.setHidden(true); -- 2.20.1