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 5950D74F13 for ; Fri, 4 Jun 2021 11:44:08 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5136A1B074 for ; Fri, 4 Jun 2021 11:44:08 +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 6205A1B04F for ; Fri, 4 Jun 2021 11:44:07 +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 36BCF4670E for ; Fri, 4 Jun 2021 11:44:07 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Fri, 4 Jun 2021 11:44:05 +0200 Message-Id: <20210604094406.12537-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210604094406.12537-1-d.csapak@proxmox.com> References: <20210604094406.12537-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -1.556 Adjusted score from AWL reputation of From: address ENA_SUBJ_ODD_CASE 3.2 Subject has odd case 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 Subject: [pbs-devel] [PATCH widget-toolkit 1/1] window/SafeDestroy: add taskDone and apiCallDone callbacks 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, 04 Jun 2021 09:44:08 -0000 like in edit window, so we can reacto to a successful task/api call Signed-off-by: Dominik Csapak --- src/window/SafeDestroy.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/window/SafeDestroy.js b/src/window/SafeDestroy.js index b269f2d..ead0e04 100644 --- a/src/window/SafeDestroy.js +++ b/src/window/SafeDestroy.js @@ -17,6 +17,14 @@ Ext.define('Proxmox.window.SafeDestroy', { additionalItems: [], + // gets called if we have a progress bar or taskview and it detected that + // the task finished. function(success) + taskDone: Ext.emptyFn, + + // gets called when the api call is finished, right at the beginning + // function(success, response, options) + apiCallDone: Ext.emptyFn, + config: { item: { id: undefined, @@ -66,6 +74,7 @@ Ext.define('Proxmox.window.SafeDestroy', { method: 'DELETE', waitMsgTarget: view, failure: function(response, opts) { + view.apiCallDone(false, response, opts); view.close(); Ext.Msg.alert('Error', response.htmlStatus); }, @@ -73,6 +82,8 @@ Ext.define('Proxmox.window.SafeDestroy', { const hasProgressBar = !!(view.showProgress && response.result.data); + view.apiCallDone(true, response, options); + if (hasProgressBar) { // stay around so we can trigger our close events // when background action is completed @@ -81,6 +92,7 @@ Ext.define('Proxmox.window.SafeDestroy', { const upid = response.result.data; const win = Ext.create('Proxmox.window.TaskProgress', { upid: upid, + taskDone: view.taskDone, listeners: { destroy: function() { view.close(); -- 2.20.1