How to Redirect Tab using UI Control Node

#1

Hi,

I would like to know how to redirect tab using ui control. The following is what I had tried:

[{"id":"f7511300.c34c4","type":"mui_form","z":"6ddaac4.fd62654","name":"login-form","label":"<center><font color=\"#004080\">Welcome to <b>I4</b>Inari</font></center>","group":"b4e7b289.a5dd4","order":0,"width":0,"height":0,"options":[{"label":"Username","value":"username","type":"text","required":true},{"label":"Password","value":"password","type":"password","required":true}],"formValue":{"username":"","password":""},"payload":"","topic":"","x":100,"y":120,"wires":[["69c991a1.ab4da"]]},{"id":"69c991a1.ab4da","type":"function","z":"6ddaac4.fd62654","name":"select-query","func":"//Read username and password\nvar username = {payload: (msg.payload.username)};\nvar password = {payload: (msg.payload.password)};\n\n//SELECT Query\nmsg.topic=\"SELECT COUNT(*) AS count FROM users WHERE name='\" + username.payload + \"' AND user_name='\" + password.payload + \"'\";\n\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":120,"wires":[["2417a41b.7a67bc"]]},{"id":"2417a41b.7a67bc","type":"mysql","z":"6ddaac4.fd62654","mydb":"272ea16.4569d5e","name":"database","x":440,"y":120,"wires":[["f1d2d3f5.96db4"]]},{"id":"f1d2d3f5.96db4","type":"function","z":"6ddaac4.fd62654","name":"check","func":"var count = msg.payload[0].count;\n\nif (count > 0)\n{\n    msg.payload = {tab: \"Machine Management\"};\n}\nelse\n{\n    msg.payload = \"Login failed\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":120,"wires":[["f840d235.50469","9a1cb371.7387c"]]},{"id":"9a1cb371.7387c","type":"mui_text","z":"6ddaac4.fd62654","group":"b4e7b289.a5dd4","order":0,"width":0,"height":0,"name":"login-result","label":"","format":"{{msg.payload}}","layout":"col-center","x":750,"y":120,"wires":[]},{"id":"f840d235.50469","type":"mui_ui_control","z":"6ddaac4.fd62654","name":"","x":740,"y":180,"wires":[[]]},{"id":"b4e7b289.a5dd4","type":"mui_group","z":"","name":"Welcome to I4Inari","tab":"c6b47aa.71d9788","order":2,"disp":false,"width":"6","collapse":false},{"id":"272ea16.4569d5e","type":"MySQLdatabase","z":"","host":"10.21.11.15","port":"3306","db":"i4inari","tz":""},{"id":"c6b47aa.71d9788","type":"mui_tab","z":"","name":"I4Inari","icon":"home","order":1}]

Thanks for helping.

0 Likes

#2

Just send it the tab number (from 0) or tab name

1 Like

#3

Yes. I got it. Thank you very much for your help. However, I have a doubt. How to manage session in Node-Red?

0 Likes

#4

What do you mean by 'manage session in Node-RED'?

You are using the mdashboard nodes. Those are a fork of the node-red-dashboard nodes. I don't know if anyone here has any experience of the mdashboard fork in order to help with them.

0 Likes

#5

So, you mean that manage session is not possible in Node-RED?

0 Likes

#6

I did not say it wasn't possible. I asked you what you mean by 'manage session' and I pointed out we don't know much about the mdashboard nodes you are using and what they offer above the normal dashboard nodes.

0 Likes

#7

I'm trying to create login session on my dashboard.

0 Likes