Can we pass-in URL parameters to a dashboard?

#1

Hi,

I have embedded several node-red dashboards via iframe - that works as expected.

The surrounding page now needs to pass also an ID to the iframe/dashboard or better to the flow driving the dashboard. In the flow, I will then use it to retrieve further data via REST-calls.

But how can I access the extra URL parameter that is passed in from the surrounding page?

Thanks in advance
Mumin

0 Likes

#2

Have you tried adding query parameter to the URL and attaching a debug node (set to show full msg) to your http in node? Pretty sure they're available as properties in the msg object.

0 Likes

#3

I have tried that now but no success. Adding a parameter works, i.e. the dashboard is still shown.

But it seems that a http input node (with the same URL as the dashboard) is not called when the dashboard URL is called from parent page or directly from the browser.
To double check I have also made a test with a REST endpoint with a different URL - this is triggered then.

I understand that because adding an httpin node with the same URL as the dashboard would otherwise mean that this endpoint is triggering two things a) deliver the dashboard and b) get handled by the flow. That cannot work because only handler gets the request and can send a response.

0 Likes

#4

Have also checked if UICONTROL node will help, but does only deliver connect/disconnect.

However, found a workaround:

  • define an extra REST endpoint
  • extract the URL params there
  • then return the dashboard URL within an extra iframe

Will do it for me, although a bit ugly. Then cleanest way would be to let UICONTROL pass extra URL params as well.

Thanks Steve!

0 Likes

#5

not quite understanding what you are trying to do yet ... ui_control provides more than just connect and disconnect, it also reports tab changes, etc - and the session they came from. going the other way you can use it to show and hide groups and jump to different tabs. What info are you trying to pass ? what is the end goal ?

0 Likes

#6

Hi dceejay,

with node-red Dashboard I create chart graphics. I embed these graphics in another page, i.e. Dashboard pages are loaded via iframe.

Now I need to pass a certain database ID to the Dashboard page. I expect to be able to retrieve this ID in the node-red flow driving the Dashboard page. This will allow me to use the ID and load some specific data (REST call to a 3rd system), that will then also be shown on the Dashboard page. There is no other way to handle that in my scenario.

0 Likes

#7

so what would a potential url look like ?

0 Likes

#8

like this https://host.com/dashboard/#/0?param1=5bec43bf4e1b69161e9a2658

e.g. for the dashboard tab 0 and to pass param1 to it

0 Likes

#9

So I could perhaps add them to the ui-control "change" message as a params object ? like
image
I can't help feeling that causing the page to reload can't be the most efficient way to do this.

0 Likes