Hide multiple tab's with ui_control

I've been parsing and using the ui_control node.

Is it possible only in a command line to hide several tabs?

I tried here and failed.

Does anyone have a way I can do this in an elegant way?

[{"id":"215bd10b8e5bb52e","type":"subflow","name":"Password","info":"","category":"","in":[{"x":110,"y":210,"wires":[{"id":"99cc850a1d0922be"}]}],"out":[{"x":910,"y":190,"wires":[{"id":"fc8e1e11e9e11e6a","port":0},{"id":"3e6ee77098e8b163","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"19cb3fa7a24b617f","type":"ui_toast","z":"215bd10b8e5bb52e","position":"prompt","displayTime":"3","highlight":"","sendall":false,"outputs":1,"ok":"OK","cancel":"Cancel","raw":true,"className":"","topic":"","name":"Ask Password","x":420,"y":210,"wires":[["823e9dc589a4ae6a"]]},{"id":"823e9dc589a4ae6a","type":"switch","z":"215bd10b8e5bb52e","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"password","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":590,"y":210,"wires":[["fc8e1e11e9e11e6a"],["3e6ee77098e8b163"]]},{"id":"ea6bc392d093238b","type":"ui_toast","z":"215bd10b8e5bb52e","position":"dialog","displayTime":"3","highlight":"","sendall":false,"outputs":1,"ok":"OK","cancel":"","raw":false,"className":"","topic":"","name":"Incorrect Password","x":990,"y":240,"wires":[[]]},{"id":"3e6ee77098e8b163","type":"change","z":"215bd10b8e5bb52e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Authentication Failed!","tot":"str"},{"t":"set","p":"auth","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":250,"wires":[["ea6bc392d093238b"]]},{"id":"99cc850a1d0922be","type":"function","z":"215bd10b8e5bb52e","name":"Content","func":"return { payload: '<style>input{ -webkit-text-security: disc;}</style>Please enter your password'};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":240,"y":210,"wires":[["19cb3fa7a24b617f"]]},{"id":"fc8e1e11e9e11e6a","type":"change","z":"215bd10b8e5bb52e","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"Authentication Successful!","tot":"str"},{"t":"set","p":"auth","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":130,"wires":[["076bc748a119ecaf"]]},{"id":"076bc748a119ecaf","type":"ui_toast","z":"215bd10b8e5bb52e","position":"dialog","displayTime":"2","highlight":"green","sendall":false,"outputs":1,"ok":"OK","cancel":"","raw":false,"className":"","topic":"","name":"Password OK","x":980,"y":140,"wires":[[]]},{"id":"fd96c0bcc076194c","type":"ui_button","z":"5e6f472c41a03e2d","name":"","group":"f5d551dabcbf977e","order":4,"width":6,"height":1,"passthru":false,"label":"Mostrar ConfiguraƧƵes","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":180,"y":120,"wires":[["f894a1be8b5bafb6"]]},{"id":"f894a1be8b5bafb6","type":"subflow:215bd10b8e5bb52e","z":"5e6f472c41a03e2d","name":"","x":400,"y":120,"wires":[["5ddddab8e5a4b83f"]],"icon":"font-awesome/fa-eye"},{"id":"10c863e1d78f0581","type":"ui_ui_control","z":"5e6f472c41a03e2d","name":"","events":"all","x":1000,"y":320,"wires":[[]]},{"id":"a1a6d9cf5d76e928","type":"inject","z":"5e6f472c41a03e2d","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":470,"y":380,"wires":[["f8adb84df9c574de","6f3be7dd324375c3"]]},{"id":"136f3d04f940df90","type":"ui_button","z":"5e6f472c41a03e2d","name":"","group":"f5d551dabcbf977e","order":7,"width":6,"height":1,"passthru":false,"label":"Ocultar configuraƧƵes","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":480,"y":340,"wires":[["f8adb84df9c574de","6f3be7dd324375c3"]]},{"id":"5ddddab8e5a4b83f","type":"switch","z":"5e6f472c41a03e2d","name":"","property":"auth","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":120,"wires":[["7f8da5e601b0d25c","4a6f0146dc9accaa"]]},{"id":"f8adb84df9c574de","type":"change","z":"5e6f472c41a03e2d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"tabs\": {\"hide\": \"ConexĆ£o\"}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":340,"wires":[["10c863e1d78f0581"]]},{"id":"6f3be7dd324375c3","type":"change","z":"5e6f472c41a03e2d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"tabs\": {\"hide\": \"PersonalizaĆ§Ć£o\"}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":380,"wires":[["10c863e1d78f0581"]]},{"id":"7f8da5e601b0d25c","type":"change","z":"5e6f472c41a03e2d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"tabs\": {\"show\": \"ConexĆ£o\"}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":240,"wires":[["10c863e1d78f0581"]]},{"id":"4a6f0146dc9accaa","type":"change","z":"5e6f472c41a03e2d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"tabs\": {\"show\": \"PersonalizaĆ§Ć£o\"}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":280,"wires":[["10c863e1d78f0581"]]},{"id":"f5d551dabcbf977e","type":"ui_group","name":"","tab":"0adeda6ceb2467c7","order":1,"disp":true,"width":16,"collapse":false,"className":""},{"id":"0adeda6ceb2467c7","type":"ui_tab","name":"Login","icon":"dashboard","order":10,"disabled":false,"hidden":false}]

image

It's work fine!

{
    "tabs": {
        "hide": "PersonalizaĆ§Ć£o"
    }
}

But if I do that it doesn't work

{
    "tabs": {
        "hide": "PersonalizaĆ§Ć£o",
        "hide": "ConexĆ£o"
    }
}

From the help panel:

{"tabs": {"hide": "tab_name_to_hide", "disable": ["secret_tab", "unused_stuff"]}}

So have you tried?

{"tabs": {"hide": ["tab_name_to_hide", "anothertabtohide"]}}

No idea if that works but would seem to be logical.

1 Like

It worked really well.

Thanks

image

Taking advantage of the same topic,

Do you have any idea how I can store a JSON with these switches? So that I can hide and show tabs?

You will need to keep a context variable because you have multiple independent switches that could all be changed at different times.

Easiest done probably with a function node if you know some JavaScript. For any incoming msg, check which switch it is and update the context variable accordingly and output a msg that has the correct payload object as shown above.

You could do it with a change node using JSONata instead if that is your thing.

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