all lists on 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] ui: tape/Restore: fix form validation for datastore mapping
Date: Tue, 17 May 2022 11:47:04 +0200	[thread overview]
Message-ID: <20220517094704.1879984-1-d.csapak@proxmox.com> (raw)

'defaultStore' can be '' or null, so check for truthyness
also, we want the mapping to be a formField so that the validation
triggers and the restore button gets en/disabled accordingly. We
still have to call 'getValue' manually, because the onGetValues will get
it as string instead of an array

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/tape/window/TapeRestore.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/www/tape/window/TapeRestore.js b/www/tape/window/TapeRestore.js
index 08010085..8a6f6c2f 100644
--- a/www/tape/window/TapeRestore.js
+++ b/www/tape/window/TapeRestore.js
@@ -383,6 +383,8 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
 			let defaultNs = values.defaultNs;
 			delete values.defaultNs;
 
+			// we have to get it manually but want it to be a form field
+			delete values.mapping;
 			let [ds_map, ns_map] = me.down('pbsDataStoreMappingField').getValue();
 			if (ds_map !== '') {
 			    datastores.push(ds_map);
@@ -474,7 +476,7 @@ Ext.define('PBS.TapeManagement.TapeRestoreWindow', {
 			},
 			{
 			    xtype: 'pbsDataStoreMappingField',
-			    isFormField: false,
+			    name: 'mapping',
 			    reference: 'mappingGrid',
 			    height: 240,
 			    defaultBindProperty: 'value',
@@ -565,7 +567,7 @@ Ext.define('PBS.TapeManagement.DataStoreMappingGrid', {
 	let me = this;
 	let error = false;
 
-	if (me.getViewModel().get('defaultStore') !== '') {
+	if (!me.getViewModel().get('defaultStore')) {
 	    error = true;
 	    me.getStore().each(rec => {
 		if (rec.data.target) {
-- 
2.30.2





             reply	other threads:[~2022-05-17  9:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  9:47 Dominik Csapak [this message]
2022-05-17 11:36 ` [pbs-devel] applied: " 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=20220517094704.1879984-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal