[pbs-devel] [PATCH widget-toolkit 1/1] form: display-edit: support emptyText

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Nov 26 16:28:53 CET 2024


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 at 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.




More information about the pbs-devel mailing list