Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Template: Custom Properties #665

Open
joepavitt opened this issue Mar 12, 2024 · 2 comments
Open

UI Template: Custom Properties #665

joepavitt opened this issue Mar 12, 2024 · 2 comments
Labels
feature-request New feature or request that needs to be turned into Epic/Story details size:M - 3 Sizing estimation point subflows Any issue/PR related to the use of Dashboard 2.0 within subflows

Comments

@joepavitt
Copy link
Collaborator

joepavitt commented Mar 12, 2024

Description

This may take some doing to get "right", but the base philosophy is to build off the great work @Steve-Mcl is doing with #634 whereby we could begin to wrap a ui-template in a subflow to provide a reusable, configurable component in the Node-RED local palette.

A challenge with this is that often, the ui-template is being configured within the Vue component, and doesn't have access to the parent environment variables that would be set at the subflow-level. I see two options here:

1. Expose all Environment Variables to Client

Security alarm bells ringing

2. Custom Properties

To circumvent this, we could introduce the concept of "Custom Properties" which would be a generic list of key:value pairs (of varying types) on the ui-template. It would then be possible within a subflow to bind these to the subflow env vars, and so have a ui-template driven entirely by the subflow properties.

Epic/Story

No response

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

@joepavitt joepavitt added size:M - 3 Sizing estimation point feature-request New feature or request that needs to be turned into Epic/Story details labels Mar 12, 2024
@Steve-Mcl
Copy link
Contributor

My first thought was to pick up env variables addressed in the template using the ast parser but it would be it might be tricky picking them out of the html.

Option 2
If I am reading this right, the proposal is to have an editableList where env vars are linked up to client side object (like how msg is available)?
If so, that can work, but it feels like duplication of effort.

Option 3
It might be possible to use the ast parser to pick env vars out of Vue props or a specifically named data object or via an object prop named env? I would propose only the items specifically named in the template are bound (to subvert option 1)

@joepavitt
Copy link
Collaborator Author

Not just env vars though, anything. Could have strings/numbers/booleans. Just means the general config of a ui-template can live at the node-level, rather than nested inside the Vue template.

Within the Vue template, they'd then be accessible under the existing this.props option, although had been some discussion about us renaming that to be config in another issue as its a better description.

With the generic editable list, that then unlocks the possibility to override those properties with env Vars as you would any other node in a subflow

@joepavitt joepavitt added the subflows Any issue/PR related to the use of Dashboard 2.0 within subflows label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request that needs to be turned into Epic/Story details size:M - 3 Sizing estimation point subflows Any issue/PR related to the use of Dashboard 2.0 within subflows
Projects
Status: Backlog
Development

No branches or pull requests

2 participants