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 528429117F for ; Wed, 7 Sep 2022 11:06:41 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3C53F2FE86 for ; Wed, 7 Sep 2022 11:06:11 +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 for ; Wed, 7 Sep 2022 11:06:10 +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 5F67A437B7; Wed, 7 Sep 2022 10:58:31 +0200 (CEST) From: Daniel Tschlatscher To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com, pmg-devel@lists.proxmox.com Date: Wed, 7 Sep 2022 10:56:33 +0200 Message-Id: <20220907085633.89113-8-d.tschlatscher@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220907085633.89113-1-d.tschlatscher@proxmox.com> References: <20220907085633.89113-1-d.tschlatscher@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.067 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pmg-devel] [PATCH widget-toolkit v2 7/7] add task log download button in TaskViewer X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2022 09:06:41 -0000 Adds a download button in the TaskViewer. Uses the newly created downloadAsFile() method in the Utils class. Signed-off-by: Daniel Tschlatscher --- src/window/TaskViewer.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/window/TaskViewer.js b/src/window/TaskViewer.js index 9293d95..f1de188 100644 --- a/src/window/TaskViewer.js +++ b/src/window/TaskViewer.js @@ -230,11 +230,23 @@ Ext.define('Proxmox.window.TaskViewer', { border: false, }); + let downloadBtn = new Ext.Button({ + text: gettext('Download'), + iconCls: 'fa fa-download', + handler: function() { + let url = '/api2/extjs/nodes/' + + `${task.node}/tasks/${encodeURIComponent(me.upid)}/log?limit=0`; + + Proxmox.Utils.downloadAsFile(url); + }, + }); + + let logView = Ext.create('Proxmox.panel.LogView', { title: gettext('Output'), - tbar: [stop_btn2], + tbar: [stop_btn2, '->', downloadBtn], border: false, - url: "/api2/extjs/nodes/" + task.node + "/tasks/" + encodeURIComponent(me.upid) + "/log", + url: `/api2/extjs/nodes/${task.node}/tasks/${encodeURIComponent(me.upid)}/log`, }); me.mon(statstore, 'load', function() { @@ -249,6 +261,7 @@ Ext.define('Proxmox.window.TaskViewer', { stop_btn1.setDisabled(status !== 'running'); stop_btn2.setDisabled(status !== 'running'); + downloadBtn.setDisabled(status === 'running'); }); statstore.startUpdate(); -- 2.30.2