FlowFuse / node-red-dashboard

https://dashboard.flowfuse.com
Apache License 2.0
204 stars 48 forks source link

UI Template - Tabbed interface for defining Component #419

Closed joepavitt closed 8 months ago

joepavitt commented 11 months ago

Description

Proposed by @bartbutenaers here: https://discourse.nodered.org/t/dashboard-2-0-pre-alpha-available/80142/283?u=joepavitt

This would involve the default layout of the ui-template node following a similar pattern to the core function node whereby we offer tabs to assist with the creation of the underlying Vue Component:

52239331c53769d6e01faf63dccce24654d3f89d

We have a lot of users that are not familiar with VueJS, so we should be doing all we can to assist with their onboarding and developer experience of building custom widgets in ui-template.

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

bartbutenaers commented 11 months ago

Hi @joepavitt,

Thanks again for at least taking this into consideration!!

About my extra info on discourse, because @Steve-Mcl mentioned (correctly) that my idea would not be fun for Vue lovers. We perhaps could add an extra tabsheet and checkbox:

image

Then we could support two scenario's, based on the checkbox status:

So in both cases the same Vue component string will be deployed to the server.

Hopefully this design could assist both types of users...

joepavitt commented 11 months ago

Another option here could be to have an "Advanced Mode" checkbook which gives you the text input we have now.

Then the default mode would your new, separated tab view?

My concern with the "Vue" tab at the end would be the two-way binding of that. What if someone edits that, how do we reflect that back in the other tabs reliably?

bartbutenaers commented 11 months ago

My propsal is in fact a one-way binding towards a disabled Vue component editor.
Hopefully this visual comparison explains it better:

image

And when you deselect the checkbox perhaps show a confirmation box that all your manual changes in the "Vue component" tabsheet will get overwritten by generated code.

bartbutenaers commented 11 months ago

So when you unselect the checkbox, you can view the read-only generated Vue component code in a disabled Monaco editor. By having a look at the generated code, people might gain Vue knowledge over time.

Like in the Blockly node we also show the generated javascript in a second tabsheet. The generated javascript (from the Blockly blocks) is also read only, but that way people over time might perhaps gain knowledge. And it also helps while troubleshooting my node, when the generated code contains issues :-)

joepavitt commented 11 months ago

Hi @diego780705 - thanks for the feedback.

Will quickly address this:

Item to note: Message input in the ui_template node is going straight to output, this should be optional and not happen.

With a note that it is mentioned in our migration progress and it's explicitly covered by https://github.com/FlowFuse/node-red-dashboard/issues/354

I will also mention that you can susbcribe to incoing events in ui-template with:

mounted () {
    this.$socket.on("msg-input" + this.id, (msg) => {
        // do stuff with msg
    })
}

I hope you don't mind, but I'm going to answer the rest in two separate parts, both of which I'll be moving over the to the Node-RED Forum. This way, many others can learn from it, and it doesn't distract from Bart's proposals here regarding UI changes to the UI Template editor in Node-RED.

  1. I have addressed the 4 points here- https://discourse.nodered.org/t/ui-template-feedback-thoughts/83579
  2. Your migration of Dashboard 1.0 ui-templates - https://discourse.nodered.org/t/migrating-dashboard-1-0-ui-template-to-dashboard-2-0/83578

Hope that's okay, and we can continue those particular points of discussion in their relevant threads.

joepavitt commented 11 months ago

Thanks @diego780705 any future queries and questions, please direct to the Node-RED or FlowFuse forums. That way, I can answer then where rest of the community can see too.

Happy to help however I can. I'm confident in what we've built with ui-template, I'm yet to see anything it can't do

joepavitt commented 8 months ago

Just working back through some older issues, given how well ui-template has been received in it's current form, and the complexities that would be involved in building this out, I'm going to make a call and say that this isn't a direction I want to go into with it and close the issue.