I am trying to create hyperlink on the Node-red dashboard that allows me to open a CSV files from a single click. I read that the ui_link node can do this and went to test it, however I can't seem to find the ui_link node in the dashboard nodes lost on the Left hand side of the screen. I can see it in the list of nodes if I go to Manage Palette, but it does not appear in the node picker on the left. I think node-red is on the latest version (0.17.5) and also node-red-dashboard (2.9.6).
What am I doing wrong?
Latest version of NR is 0.18.7 - I suggest you run the bash script at https://nodered.org/docs/hardware/raspberrypi
However I do remember ever seeing the ui link node
I think that node is not from the standard node-red-dashboard. Did you have a different dashboard set installed? If so then I suspect may be left over from there somehow.
Maybe first try re-starting node-RED.
Ui_link is an internal node that can be added via the dashboard tab in the editor. But I don’t think it will do what you want. It is for linking/opening other web pages. I guess you could point it at a csv file but it would only try to view it wheras I suspect you want to load it in and process it.
@dceejay aren't you suppose to be on vacation?
Yup
@deecejay. Yep you are correct - I want the CSV file to automatically open up when I click on the hyperlink. So I will ignore the ui_link node if it does not do that.
I initially tried making a text box on the UI and managed to create hyperlink to CSV file using html tags in the text field to file:///C:/folder/filename.csv
<a href='" + msg.filename + "'>" + msg.filename + "</a>
This appears to create a hyperlink with the correct link but clicking the link does nothing. If I right click and Copy Link Address the paste this into the web browser it will automatically download the file. If I paste the link into windows explorer then it opens the file as expected.
I guess node-red is in some sort of protected environment to stop me opening the link directly from the web page.
I perhaps should have said before that this is all running in a windows 10 environment...
PS if you are on holiday - enjoy it - this can wait a bit!!
@zenofmud, you are correct. It is actually running on 0.18.7.
0.17.5 was what it was running on before I updated it. oops
A better way to serve this csv file to the browser is to use an http in
node, effectively creating an http endpoint that retrieves the file contents and sends the data, along with the correct content-type, using the http protocol.
This should be fairly simple, since the data is in a known file location... a typical flow would be:
http in
-> change
-> file in
-> change
-> http response
The first change
node is used to "save" the msg.payload
and/or msg.res
fields (if necessary -- probably not for this example). The second change
node sets up the response data and/or headers (like content-type). This may also not be necessary in your case, since you can set static headers right in the response node.