public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-widget-toolkit/proxmox-backup 0/3] ui: slightly improve removable datastore dialog
@ 2024-11-26 15:12 Fiona Ebner
  2024-11-26 15:12 ` [pbs-devel] [PATCH widget-toolkit 1/1] form: display-edit: support emptyText Fiona Ebner
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Fiona Ebner @ 2024-11-26 15:12 UTC (permalink / raw)
  To: pbs-devel

proxmox-widget-toolkit:

Fiona Ebner (1):
  form: display-edit: support emptyText

 src/form/DisplayEdit.js | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

proxmox-backup:

Fiona Ebner (2):
  ui: datastore edit: improve field label name
  ui: datastore edit: fix emptytext for path field

 www/window/DataStoreEdit.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

* [pbs-devel] [PATCH widget-toolkit 1/1] form: display-edit: support emptyText
  2024-11-26 15:12 [pbs-devel] [PATCH proxmox-widget-toolkit/proxmox-backup 0/3] ui: slightly improve removable datastore dialog Fiona Ebner
@ 2024-11-26 15:12 ` Fiona Ebner
  2024-11-26 15:28   ` Thomas Lamprecht
  2024-11-26 15:12 ` [pbs-devel] [PATCH proxmox-backup 2/3] ui: datastore edit: improve field label name Fiona Ebner
  2024-11-26 15:13 ` [pbs-devel] [PATCH proxmox-backup 3/3] ui: datastore edit: fix emptytext for path field Fiona Ebner
  2 siblings, 1 reply; 7+ messages in thread
From: Fiona Ebner @ 2024-11-26 15:12 UTC (permalink / raw)
  To: pbs-devel

First user is intended to be the path field for datastores in PBS
where the emptyText should dynamically be for a relative or absolute
path.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 src/form/DisplayEdit.js | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/form/DisplayEdit.js b/src/form/DisplayEdit.js
index fe1b83b..3f6a9bb 100644
--- a/src/form/DisplayEdit.js
+++ b/src/form/DisplayEdit.js
@@ -7,6 +7,7 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
 	data: {
 	    editable: false,
 	    value: undefined,
+	    emptyText: undefined,
 	},
     },
 
@@ -41,6 +42,19 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
 	vm.get('value');
     },
 
+    setEmptyText: function(emptyText) {
+	let me = this;
+	let vm = me.getViewModel();
+
+	me.emptyText = emptyText;
+	vm.set('emptyText', emptyText);
+    },
+    getEmptyText: function() {
+	let me = this;
+	let vm = me.getViewModel();
+	return vm.get('emptyText');
+    },
+
     layout: 'fit',
     defaults: {
 	hideLabel: true,
@@ -77,11 +91,13 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
 	    hidden: '{editable}',
 	    disabled: '{editable}',
 	    value: '{value}',
+	    // doesn't have a setEmptyText() method, so don't bind that
 	});
 	Ext.applyIf(editConfig.bind, {
 	    hidden: '{!editable}',
 	    disabled: '{!editable}',
 	    value: '{value}',
+	    emptyText: '{emptyText}',
 	});
 
 	// avoid glitch, start off correct even before viewmodel fixes it
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

* [pbs-devel] [PATCH proxmox-backup 2/3] ui: datastore edit: improve field label name
  2024-11-26 15:12 [pbs-devel] [PATCH proxmox-widget-toolkit/proxmox-backup 0/3] ui: slightly improve removable datastore dialog Fiona Ebner
  2024-11-26 15:12 ` [pbs-devel] [PATCH widget-toolkit 1/1] form: display-edit: support emptyText Fiona Ebner
@ 2024-11-26 15:12 ` Fiona Ebner
  2024-11-26 15:44   ` [pbs-devel] applied: " Thomas Lamprecht
  2024-11-26 15:13 ` [pbs-devel] [PATCH proxmox-backup 3/3] ui: datastore edit: fix emptytext for path field Fiona Ebner
  2 siblings, 1 reply; 7+ messages in thread
From: Fiona Ebner @ 2024-11-26 15:12 UTC (permalink / raw)
  To: pbs-devel

And use title case to be consistent with the other field labels.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 www/window/DataStoreEdit.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/window/DataStoreEdit.js b/www/window/DataStoreEdit.js
index 23970083..40ccd20a 100644
--- a/www/window/DataStoreEdit.js
+++ b/www/window/DataStoreEdit.js
@@ -113,7 +113,7 @@ Ext.define('PBS.DataStoreEdit', {
 				uuidEditField.allowBlank = !isRemovable;
 				uuidEditField.setValue('');
 				if (isRemovable) {
-				    pathField.setFieldLabel(gettext('On device path'));
+				    pathField.setFieldLabel(gettext('Path on Device'));
 				} else {
 				    pathField.setFieldLabel(gettext('Backing Path'));
 				}
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

* [pbs-devel] [PATCH proxmox-backup 3/3] ui: datastore edit: fix emptytext for path field
  2024-11-26 15:12 [pbs-devel] [PATCH proxmox-widget-toolkit/proxmox-backup 0/3] ui: slightly improve removable datastore dialog Fiona Ebner
  2024-11-26 15:12 ` [pbs-devel] [PATCH widget-toolkit 1/1] form: display-edit: support emptyText Fiona Ebner
  2024-11-26 15:12 ` [pbs-devel] [PATCH proxmox-backup 2/3] ui: datastore edit: improve field label name Fiona Ebner
@ 2024-11-26 15:13 ` Fiona Ebner
  2 siblings, 0 replies; 7+ messages in thread
From: Fiona Ebner @ 2024-11-26 15:13 UTC (permalink / raw)
  To: pbs-devel

It is a relative path for removable datastores.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

Dependency bump for widget-toolkit needed.

 www/window/DataStoreEdit.js | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/www/window/DataStoreEdit.js b/www/window/DataStoreEdit.js
index 40ccd20a..4a0b8d81 100644
--- a/www/window/DataStoreEdit.js
+++ b/www/window/DataStoreEdit.js
@@ -114,8 +114,10 @@ Ext.define('PBS.DataStoreEdit', {
 				uuidEditField.setValue('');
 				if (isRemovable) {
 				    pathField.setFieldLabel(gettext('Path on Device'));
+				    pathField.setEmptyText(gettext('A relative path'));
 				} else {
 				    pathField.setFieldLabel(gettext('Backing Path'));
+				    pathField.setEmptyText(gettext('An absolute path'));
 				}
 			    },
 			},
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

* Re: [pbs-devel] [PATCH widget-toolkit 1/1] form: display-edit: support emptyText
  2024-11-26 15:12 ` [pbs-devel] [PATCH widget-toolkit 1/1] form: display-edit: support emptyText Fiona Ebner
@ 2024-11-26 15:28   ` Thomas Lamprecht
  2024-11-26 16:23     ` Fiona Ebner
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Lamprecht @ 2024-11-26 15:28 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Fiona Ebner

Am 26.11.24 um 16:12 schrieb Fiona Ebner:
> First user is intended to be the path field for datastores in PBS
> where the emptyText should dynamically be for a relative or absolute
> path.
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>  src/form/DisplayEdit.js | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/src/form/DisplayEdit.js b/src/form/DisplayEdit.js
> index fe1b83b..3f6a9bb 100644
> --- a/src/form/DisplayEdit.js
> +++ b/src/form/DisplayEdit.js
> @@ -7,6 +7,7 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
>  	data: {
>  	    editable: false,
>  	    value: undefined,
> +	    emptyText: undefined,
>  	},
>      },
>  
> @@ -41,6 +42,19 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
>  	vm.get('value');
>      },
>  
> +    setEmptyText: function(emptyText) {
> +	let me = this;
> +	let vm = me.getViewModel();
> +
> +	me.emptyText = emptyText;
> +	vm.set('emptyText', emptyText);

did you try to skip this and just directly call the setEmptyText from the
edit field?

> +    },
> +    getEmptyText: function() {
> +	let me = this;
> +	let vm = me.getViewModel();
> +	return vm.get('emptyText');

same here but with getEmptyText from the underlying editField?

I mean, it can be fine as is, but if we can skip tracking this twice (here and
on editField level) it would IMO be a bit more robust.


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

* [pbs-devel] applied: [PATCH proxmox-backup 2/3] ui: datastore edit: improve field label name
  2024-11-26 15:12 ` [pbs-devel] [PATCH proxmox-backup 2/3] ui: datastore edit: improve field label name Fiona Ebner
@ 2024-11-26 15:44   ` Thomas Lamprecht
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Lamprecht @ 2024-11-26 15:44 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Fiona Ebner

Am 26.11.24 um 16:12 schrieb Fiona Ebner:
> And use title case to be consistent with the other field labels.
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>  www/window/DataStoreEdit.js | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied this one for now, thanks!


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

* Re: [pbs-devel] [PATCH widget-toolkit 1/1] form: display-edit: support emptyText
  2024-11-26 15:28   ` Thomas Lamprecht
@ 2024-11-26 16:23     ` Fiona Ebner
  0 siblings, 0 replies; 7+ messages in thread
From: Fiona Ebner @ 2024-11-26 16:23 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox Backup Server development discussion

Am 26.11.24 um 16:28 schrieb Thomas Lamprecht:
> Am 26.11.24 um 16:12 schrieb Fiona Ebner:
>> @@ -41,6 +42,19 @@ Ext.define('Proxmox.form.field.DisplayEdit', {
>>  	vm.get('value');
>>      },
>>  
>> +    setEmptyText: function(emptyText) {
>> +	let me = this;
>> +	let vm = me.getViewModel();
>> +
>> +	me.emptyText = emptyText;
>> +	vm.set('emptyText', emptyText);
> 
> did you try to skip this and just directly call the setEmptyText from the
> edit field?
> 
>> +    },
>> +    getEmptyText: function() {
>> +	let me = this;
>> +	let vm = me.getViewModel();
>> +	return vm.get('emptyText');
> 
> same here but with getEmptyText from the underlying editField?
> 
> I mean, it can be fine as is, but if we can skip tracking this twice (here and
> on editField level) it would IMO be a bit more robust.

As also quickly discussed off-list, the slightly hairy bit is getting to
the edit item. I opted for tracking the xtype of the field in v2:
https://lore.proxmox.com/pbs-devel/20241126162005.85583-1-f.ebner@proxmox.com/T/


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

end of thread, other threads:[~2024-11-26 16:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-26 15:12 [pbs-devel] [PATCH proxmox-widget-toolkit/proxmox-backup 0/3] ui: slightly improve removable datastore dialog Fiona Ebner
2024-11-26 15:12 ` [pbs-devel] [PATCH widget-toolkit 1/1] form: display-edit: support emptyText Fiona Ebner
2024-11-26 15:28   ` Thomas Lamprecht
2024-11-26 16:23     ` Fiona Ebner
2024-11-26 15:12 ` [pbs-devel] [PATCH proxmox-backup 2/3] ui: datastore edit: improve field label name Fiona Ebner
2024-11-26 15:44   ` [pbs-devel] applied: " Thomas Lamprecht
2024-11-26 15:13 ` [pbs-devel] [PATCH proxmox-backup 3/3] ui: datastore edit: fix emptytext for path field Fiona Ebner

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