FlowFuse / node-red-dashboard

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

UI Text: Format #390

Open joepavitt opened 11 months ago

joepavitt commented 11 months ago

Description

We currently do not allow for users to define a format property on ui-text. This provides flexibility on how to display values in a ui-text node.

An alternative would be that we require users to utilise a template or change node possible as a more "Node-RED" way of doing this?

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

joepavitt commented 11 months ago

@Steve-Mcl fairly sure I recall you having opinions on this?

Steve-Mcl commented 11 months ago

This is very closely linked to #234

I think not supporting variable labels will be a sticking point for many.

Imo, ideally, it would be Vue binding/syntax - even if that is achieved by a custom regex or other means. And that would be uniform across all widgets. Making OEM reports and dashboards are almost a non starter without this?

I'll have a think around the implications and minimum acceptable criteria.

m-schaeffler commented 7 months ago

I use the format often in this way: {{msg.payload.brightness|number:1}} %

By this syntax I have this:

  1. select a value from the payload object
  2. control the count of digits after the decimal sign
  3. unit of the value

I would really like it, if this would also be available for the LED widget

joepavitt commented 7 months ago

Thanks for the upvote @m-schaeffler - we are aware of it's popularity, but it is very hard. Dashboard 1.0 got around this is some very hacky/dirty ways that I'm hesitant to introduce into Dashboard 2.0, but admittedly, I've not spent a huge amount of time investigating yet.

m-schaeffler commented 7 months ago

@joepavitt After a little bit of thinking: A good solution, that is also compatible with the nodered way, could be:

A typed input is used to select the value to be used, similar as in the switch node. With JSONata any formatting including adding a unit could be performed.

joepavitt commented 7 months ago

A typed input is used to select the value to be used, similar as in the switch node.

Now that I could definitely get on board with...