Dashboard 2, ui-template in subflow, accessing subflow properties

I am experimenting with the new ability to include dashboard 2 widgets in a subflow.
Am I correct in thinking that, if I have a ui-template in a subflow, that, in order to access the subflow properties inside the template, I have to pick them up and add those properties to a message and send them to the template?

You're absolutely right Colin for the current state of the art.

I do have UI Template: Custom Properties · Issue #665 · FlowFuse/node-red-dashboard · GitHub open to improve this experience

OK, thanks.

To get round this, in the subflow, I am feeding the input messages through a function that copies the properties into msg._data then passes the message to the template. That works ok apart from the problem that if I change the property values and do a partial deploy, then refresh the dashboard browser, the template gets sent the previous message, which still includes the old data. It is not until a new message is sent to the subflow that the new data is picked up. I can't see any solution to this problem at the moment other than to add a repeater node so that messages into the subflow are resent every few seconds.

I have realised there is a better way. An inject node triggered to fire at startup re-triggers if the subflow parameters are changed, so that can be used to send the template an initial message with the properties,

1 Like

image

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.