public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] ui: tape/Restore: fix form validation for datastore mapping
@ 2022-05-17  9:47 Dominik Csapak
  2022-05-17 11:36 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2022-05-17  9:47 UTC (permalink / raw)
  To: pbs-devel

'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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup] ui: tape/Restore: fix form validation for datastore mapping
  2022-05-17  9:47 [pbs-devel] [PATCH proxmox-backup] ui: tape/Restore: fix form validation for datastore mapping Dominik Csapak
@ 2022-05-17 11:36 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-05-17 11:36 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

Am 5/17/22 um 11:47 schrieb Dominik Csapak:
> '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(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-17 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17  9:47 [pbs-devel] [PATCH proxmox-backup] ui: tape/Restore: fix form validation for datastore mapping Dominik Csapak
2022-05-17 11:36 ` [pbs-devel] applied: " Thomas Lamprecht

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