How to read line to line any text in nodered dashboard

Hello everyone! I have a log file that I would like to display on the dashboard, but the text is not displayed line by line, but continuously. how to solve this?

log file:
log1

dashboard:
log2

A function node beforehand with something like:

msg.payload = msg.payload.replace(/\n/g, "<br>");
return msg;

Should do the trick

It's almost good, but it doesn't read the last line

But still. :slight_smile: Thank you very much for your quick reply!!!

You can add the html tag <pre>{{msg.payload}}</pre> in the ui-text node value format field, this will tell the browser that the text should keep its formating, e,g new lines, tabs, etc.
example

[{"id":"955aca2f9ed86903","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":400,"y":3920,"wires":[["2cfcb43351f7c9be"]]},{"id":"2cfcb43351f7c9be","type":"template","z":"b779de97.b1b46","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"1\n2\n3\n4\n5","output":"str","x":560,"y":3920,"wires":[["7dc87205205edf64"]]},{"id":"7dc87205205edf64","type":"ui_text","z":"b779de97.b1b46","group":"4f791fdc1745d3d9","order":2,"width":0,"height":0,"name":"","label":"text","format":"<pre>{{msg.payload}}</pre>","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":690,"y":3920,"wires":[]},{"id":"4f791fdc1745d3d9","type":"ui_group","name":"micro","tab":"c954274bbed7292e","order":1,"disp":false,"width":"18","collapse":false,"className":""},{"id":"c954274bbed7292e","type":"ui_tab","name":"Solar","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
1 Like

Let me add a little:
template node:

<style>

.nr-dashboard-cardpanel {
    text-align: left;
    box-sizing: border-box;
}
body.nr-dashboard-theme md-content {
    background: #000000;
    height: 100%;
    color: #878787;
}

.nr-dashboard-theme ui-card-panel {
    background-color: #e1484800;
    border: 5px solid #10e714;
}

body.nr-dashboard-theme md-content md-card {
    background-color: #ffffff00;
    color: #5eff1bfa;
}

.nr-dashboard-theme ui-card-panel p.nr-dashboard-cardtitle {
    color: #5eff1bfa;
}

</style>

And add it to the current group

3

Using <pre> is better. No need to amend the text.

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