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 328B971C0D for ; Fri, 21 May 2021 12:20:31 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 26DACD17C for ; Fri, 21 May 2021 12:20:31 +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) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id C5688D144 for ; Fri, 21 May 2021 12:20:29 +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 3125B43A27 for ; Fri, 21 May 2021 12:20:23 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Fri, 21 May 2021 12:20:19 +0200 Message-Id: <20210521102022.26859-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210521102022.26859-1-d.csapak@proxmox.com> References: <20210521102022.26859-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.027 Adjusted score from AWL reputation of From: address 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 proxmox-backup v4 2/5] ui: tape/TapeRestore: improve SnapshotGrid 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, 21 May 2021 10:20:31 -0000 * handle not rendered call of getErrors * return 'all' as value if all snaphots where selected (for better distinction) * remove the default height * add checkChange on stores filterChange (now change also fires on the gridfilter plugin change) Signed-off-by: Dominik Csapak --- www/tape/window/TapeRestore.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/www/tape/window/TapeRestore.js b/www/tape/window/TapeRestore.js index 2a876619..10624f9a 100644 --- a/www/tape/window/TapeRestore.js +++ b/www/tape/window/TapeRestore.js @@ -336,6 +336,13 @@ Ext.define('PBS.TapeManagement.SnapshotGrid', { } }); + // getSource returns null if data is not filtered + let originalData = me.store.getData().getSource() || me.store.getData(); + + if (snapshots.length === originalData.length) { + return "all"; + } + return snapshots; }, @@ -347,20 +354,25 @@ Ext.define('PBS.TapeManagement.SnapshotGrid', { getErrors: function(value) { let me = this; - if (me.getSelection() < 1) { + if (me.getSelection().length < 1) { me.addCls(['x-form-trigger-wrap-default', 'x-form-trigger-wrap-invalid']); let errorMsg = gettext("Need at least one snapshot"); - me.getActionEl().dom.setAttribute('data-errorqtip', errorMsg); + let el = me.getActionEl(); + if (el) { + el.dom.setAttribute('data-errorqtip', errorMsg); + } return [errorMsg]; } me.removeCls(['x-form-trigger-wrap-default', 'x-form-trigger-wrap-invalid']); - me.getActionEl().dom.setAttribute('data-errorqtip', ""); + let el = me.getActionEl(); + if (el) { + el.dom.setAttribute('data-errorqtip', ""); + } return []; }, scrollable: true, - height: 350, plugins: 'gridfilters', viewConfig: { @@ -424,5 +436,7 @@ Ext.define('PBS.TapeManagement.SnapshotGrid', { }, ); } + + me.mon(me.store, 'filterchange', () => me.checkChange()); }, }); -- 2.20.1