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 1CDCB67486 for ; Mon, 9 Nov 2020 16:01:39 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1A3B818649 for ; Mon, 9 Nov 2020 16:01:39 +0100 (CET) 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 2BA7A1845C for ; Mon, 9 Nov 2020 16:01:33 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id ECD6D45FC1 for ; Mon, 9 Nov 2020 16:01:32 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Mon, 9 Nov 2020 16:01:28 +0100 Message-Id: <20201109150130.4956-9-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201109150130.4956-1-d.csapak@proxmox.com> References: <20201109150130.4956-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.384 Adjusted score from AWL reputation of From: address 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: [pbs-devel] [PATCH proxmox-backup 08/10] ui: TaskSummary: handle less defined parameters of tasks 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: Mon, 09 Nov 2020 15:01:39 -0000 this makes it a little easier to provide good data, without hardcoding all types in the source object Signed-off-by: Dominik Csapak --- www/dashboard/TaskSummary.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js index e4c5378c..169da2d4 100644 --- a/www/dashboard/TaskSummary.js +++ b/www/dashboard/TaskSummary.js @@ -59,7 +59,7 @@ Ext.define('PBS.TaskSummary', { filterParam.store = view.datastore; } - if (record.data[state] === 0) { + if (record.data[state] === 0 || record.data[state] === undefined) { return; } @@ -200,8 +200,8 @@ Ext.define('PBS.TaskSummary', { render_count: function(value, md, record, rowindex, colindex) { let me = this; let view = me.getView(); - let icon = me.render_icon(view.states[colindex], value); - return `${icon} ${value}`; + let icon = me.render_icon(view.states[colindex], value || 0); + return `${icon} ${value || 0}`; }, }, @@ -209,7 +209,17 @@ Ext.define('PBS.TaskSummary', { let me = this; let controller = me.getController(); let data = []; + if (!source) { + source = {}; + } me.types.forEach((type) => { + if (!source[type]) { + source[type] = { + error: 0, + warning: 0, + ok: 0, + }; + } source[type].type = me.titles[type]; data.push(source[type]); }); -- 2.20.1