[pve-devel] [PATCH manager v7 08/14] ui: add form/TagEdit.js

Aaron Lauterer a.lauterer at proxmox.com
Wed Sep 14 16:15:12 CEST 2022


Out of curiosity, did you decide to use the older style of component, instead of 
the newer declarative approach, to be able to have references to the buttons as 
"me.<button>" instead of having to do lookups all the time?

one more thing inline

On 6/21/22 11:20, Dominik Csapak wrote:
> this is a wrapper container for holding a list of (editable) tags
> intended to be used in the lxc/qemu status toolbar
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>   www/manager6/Makefile        |   1 +
>   www/manager6/form/TagEdit.js | 151 +++++++++++++++++++++++++++++++++++
>   2 files changed, 152 insertions(+)
>   create mode 100644 www/manager6/form/TagEdit.js
> 
> diff --git a/www/manager6/Makefile b/www/manager6/Makefile
> index 9d610f71..eb4be4c5 100644
> --- a/www/manager6/Makefile
> +++ b/www/manager6/Makefile
> @@ -75,6 +75,7 @@ JSSRC= 							\
>   	form/iScsiProviderSelector.js			\
>   	form/TagColorGrid.js				\
>   	form/Tag.js					\
> +	form/TagEdit.js					\
>   	grid/BackupView.js				\
>   	grid/FirewallAliases.js				\
>   	grid/FirewallOptions.js				\
> diff --git a/www/manager6/form/TagEdit.js b/www/manager6/form/TagEdit.js
> new file mode 100644
> index 00000000..5a267169
> --- /dev/null
> +++ b/www/manager6/form/TagEdit.js
> @@ -0,0 +1,151 @@
> +Ext.define('PVE.panel.TagEditContainer', {
> +    extend: 'Ext.container.Container',
> +    alias: 'widget.pveTagEditContainer',
> +
> +    tagCount: 0,
> +
> +    layout: {
> +	type: 'hbox',
> +	align: 'stretch',
> +    },
> +
> +    loadTags: function(tagstring = '', inEdit, force = false) {
> +	let me = this;
> +
> +	if (me.oldTags === tagstring && !force) {
> +	    return;
> +	}
> +
> +	let tags = tagstring.split(/[;, ]/).filter((t) => !!t) || [];

This is used at least 3 times throughout this series. Would it make sense to put 
it into a small util helper function to have it in one place?

[...]





More information about the pve-devel mailing list