How to create a (non shared) page

Hi folks,

Perhaps a noob dashboard question. Not even sure if this was possible in the old dashboard. No idea to be honest.

I want a page in my new dashboard where I have some input query fields, and an "Execute query" button. Then I want to execute a query on my influxdb in my Node-RED flow and show the result on my page in a chart.

But this data (both the input query fields and the result data in the chart) should not be shared with all other dashboards. I mean if meanwhile my wife or my kids have the dashboard open on their smartphones, they are not interested in my query (results). They might even have their own query (results) open at the same time which I don't want to override with my query results. So every dashboard client should have its own copy of the data on this page, which is not shared/synced with the other dashboards clients.

Hopefully it is a bit understandable what I mean...

Is something like that possible with dashboard D2?

Thanks!!!
Bart

1 Like

As of right now this is possible only with the FlowFuse Auth plugin on FF's paid tiers.

However, there will be a release this week which contains UI Base - Update how we configure client data inclusion and injection of "auth" plugins by joepavitt · Pull Request #869 · FlowFuse/node-red-dashboard · GitHub which will mean that you can configure any widget type (in thia case, whatever youre displaying results in) to accept "client constraints" - which means you can pass it a socketId, and it will only send data to that associated connection.

You can then map data to a socket connection too in a global or flow variable too

2 Likes

Hi @joepavitt,
Thanks a lot for the quick response!!
And thanks to Flowfuse for making this feature available for everybody...
Hopefully you find some time somewhere to add some noob example/info in the release docs, because I am not quite sure yet how I could use it.
But we will see...
Bart

1 Like

Or just use an http-in/out and template with a form and chartjs loaded from a cdn

@bakman2,
Yes indeed I have been wondering if a form was the way to go. But since Joe says a standard solutiin is being developed, I will just wait a bit...
Thanks!!

I've just published v1.10.0 which will contain this, and included some "Design Pattern" docs which may help too: Getting Started | Node-RED Dashboard 2.0

Fundamentally, the new approach is that msg._client.socketId can now be used to constrain communication to a single client for all node types (like ui-control and ui-notification could be in the original Dashboard). You can use this feature to ensure only the output from a form is sent to the relevant socket connection that sent it in the first place.

1 Like

This is a really nice addition!
You guys are really working hard for this community :star_struck:
Thanks for keeping me updated here.

5 Likes

The new "add client data" function added in v.1.10.0 is a great step forward. Until now I have been inspecting msg._client.socketId and applying accept/reject logic myself. The new function should make life much easier. Thanks @joepavitt.

I am facing a challenge in querying shared (single source of truth) dashboard nodes, when multiple clients are open.

Assume, for example, a shared template node which maintains data. Whenever I send it an update msg, the msg is replicated to all clients, keeping them all in sync. So far so good.
Now suppose I send this node a query msg to which it returns a data response. If I send this query from a server node (e.g. inject), the request will be accepted by all clients, and I will receive multiple (identical) responses.
Currently I collapse these responses into a single msg (per msg._msgid) but would appreciate other ideas from the great minds on this forum, or better still a built-in framework solution.

The difficulty here is that with the Node-RED ecosystem, generally your logic/data is stored server-side, so that you do only have one version of the data. What you've got here is your logic for data storage/generation on the client-side, so you will always have duplication, depending on the number of clients connected? What logic/functionality are you reliant upon in your clients? Can this be moved server-side?

Thanks.
Yes, I am fully aware that I'm trying to handle a client object as if it was a server object. This is for the 'ui-tabulator' node I'm about to release. The table object (AFAIK) can only be instantiated on a client page, and I cannot re-implement its 100's of APIs on the server.
I already implemented a server-side data model of the table (kept in the server datastore and used upon client open/refresh), I may think of improvements in future releases (e.g. designating a "master client" or implementing selected APIs on the server).

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