public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v4 2/5] ui: tape/TapeRestore: improve SnapshotGrid
Date: Fri, 21 May 2021 12:20:19 +0200	[thread overview]
Message-ID: <20210521102022.26859-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210521102022.26859-1-d.csapak@proxmox.com>

* 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 <d.csapak@proxmox.com>
---
 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





  parent reply	other threads:[~2021-05-21 10:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 10:20 [pbs-devel] [PATCH proxmox-backup v4 0/5] ui: unify and improve tape restore window Dominik Csapak
2021-05-21 10:20 ` [pbs-devel] [PATCH proxmox-backup v4 1/5] ui: tape/TapeRestore: fix small DataStoreMappingGrid bugs Dominik Csapak
2021-05-21 10:20 ` Dominik Csapak [this message]
2021-05-21 10:20 ` [pbs-devel] [PATCH proxmox-backup v4 3/5] ui: tape/window/TapeRestore: enabling selecting multiple snapshots Dominik Csapak
2021-05-21 10:20 ` [pbs-devel] [PATCH proxmox-backup v4 4/5] ui: tape/BackupOverview: also allow to filter by group for restore Dominik Csapak
2021-05-21 10:20 ` [pbs-devel] [PATCH proxmox-backup v4 5/5] ui: tape/BackupOverview: do not reload on restore Dominik Csapak
2021-05-21 14:34 ` [pbs-devel] applied-series: [PATCH proxmox-backup v4 0/5] ui: unify and improve tape restore window Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210521102022.26859-3-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal