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 C1C7F779ED for ; Wed, 28 Apr 2021 16:14:03 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A7818FAC5 for ; Wed, 28 Apr 2021 16:14:03 +0200 (CEST) Received: from dana.proxmox.com (unknown [94.136.29.99]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0DF55FAA4 for ; Wed, 28 Apr 2021 16:13:58 +0200 (CEST) Received: by dana.proxmox.com (Postfix, from userid 10037) id D71461C0899; Wed, 28 Apr 2021 16:13:58 +0200 (CEST) From: Lorenz Stechauner To: pve-devel@lists.proxmox.com Date: Wed, 28 Apr 2021 16:13:46 +0200 Message-Id: <20210428141346.240896-3-l.stechauner@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210428141346.240896-1-l.stechauner@proxmox.com> References: <20210428141346.240896-1-l.stechauner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 2 AWL 0.005 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods NO_DNS_FOR_FROM 0.379 Envelope sender has no MX or A DNS records RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pve-devel] [PATCH widget-toolkit 1/1] window: add upidFieldName option 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: Wed, 28 Apr 2021 14:14:03 -0000 Signed-off-by: Lorenz Stechauner --- src/window/Edit.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/window/Edit.js b/src/window/Edit.js index 53d0e73..867ba9b 100644 --- a/src/window/Edit.js +++ b/src/window/Edit.js @@ -53,6 +53,10 @@ Ext.define('Proxmox.window.Edit', { showTaskViewer: false, + // name of the upid field in response data + // required for showTaskViewer + upidFieldName: undefined, + // gets called if we have a progress bar or taskview and it detected that // the task finished. function(success) taskDone: Ext.emptyFn, @@ -165,9 +169,8 @@ Ext.define('Proxmox.window.Edit', { Ext.Msg.alert(gettext('Error'), response.htmlStatus); }, success: function(response, options) { - let hasProgressBar = - (me.backgroundDelay || me.showProgress || me.showTaskViewer) && - response.result.data; + let data = response.result.data; + let hasProgressBar = (me.backgroundDelay || me.showProgress || me.showTaskViewer) && data; me.apiCallDone(true, response, options); @@ -176,7 +179,7 @@ Ext.define('Proxmox.window.Edit', { // when background action is completed me.hide(); - let upid = response.result.data; + let upid = me.upidFieldName ? data[me.upidFieldName] : data; let viewerClass = me.showTaskViewer ? 'Viewer' : 'Progress'; Ext.create('Proxmox.window.Task' + viewerClass, { autoShow: true, -- 2.20.1