From e01ca6a2ddfa30259962aca5ef901c7a9dada69b Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 21 May 2021 12:20:19 +0200 Subject: [PATCH] ui: tape/TapeRestore: improve SnapshotGrid * 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()); }, });