Possible to hide a menu choice dynamically?

Hello,
My question, is it possible to hide a menu choice dynamically?
For example, depending on a variable defined "false" before, the menu choice "MQTT settings" would not appear.

I have read in the forum if there is a way to dynamically hide a choice in the left menus. But I didn't find the solution. Did I search wrong?

Thanks for the help

example:
image

Easy to do if you craft your own menu using node-red-contrib-ui-contextmenu - Contextmenu location - #45 by Paul-Reed

1 Like

You can use ui-control to enable and disable a tab or show and hide, you can disable and hide in combination to
e.g.

[{"id":"aef67b0c.38751","type":"inject","z":"b779de97.b1b46","name":"true","props":[{"p":"enable","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":70,"y":1480,"wires":[["46ccfdb2.490184"]]},{"id":"46ccfdb2.490184","type":"switch","z":"b779de97.b1b46","name":"","property":"enable","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":160,"y":1520,"wires":[["2bddd26.51c5f2e"],["e7f55eab.d7c8f8"]]},{"id":"2bddd26.51c5f2e","type":"template","z":"b779de97.b1b46","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"tabs\": {\"show\": \"Level\", \"enable\": \"Level\"}}","output":"json","x":330,"y":1500,"wires":[["b02f0367.55436"]]},{"id":"e7f55eab.d7c8f8","type":"template","z":"b779de97.b1b46","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"tabs\": {\"hide\": \"Level\", \"disable\": \"Level\"}}","output":"json","x":330,"y":1540,"wires":[["b02f0367.55436"]]},{"id":"91a293b8.336418","type":"inject","z":"b779de97.b1b46","name":"false","props":[{"p":"enable","v":"false","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":70,"y":1560,"wires":[["46ccfdb2.490184"]]},{"id":"b02f0367.55436","type":"ui_ui_control","z":"b779de97.b1b46","name":"","events":"all","x":510,"y":1520,"wires":[[]]}]

change the name "level" in the templates to a name of the tab you want to affect.

2 Likes

@E1cid Your answer is exactly what I asked for. The answers to the questions come almost before you have time to ask them :rofl:

hide

@Paul-Reed Your proposal of floating menus was one of my wishes. I didn't understand the idea of how this node works until you pointed it out to me. It's still a node written in part by Bart :open_mouth:
(it was related to SVG)
I'll definitely use it. I was looking for sub menus. :+1: :+1:
So just don't forget to hide the standard NR menu.
That's cool.
Thanks to both of you !

2 Likes

So that gave me an idea.
To make the dashboard multilingual according to a previously defined variable, you just have to use this method to hide the menus of the languages you don't want to see. It becomes quite simple.
1 Tab in English
1 Tab in French
1 Tab in German
etc... they are the same duplicated and translated.
and depending on the variable, we hide the desired Tabs dynamically.

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