How to enable and disable pages in dashboard 2.0?

node.send({
    payload: {
        pages: {
            disable: ['Neway Automações']                     
        }
    }
});

I need help understanding how to disable and enable a page. Am I not knowing how to do this or is it not working correctly? @joepavitt

Seems okay to me, as you have it as per the documentation, and I've tested locally on my own Dashboard as the functionality is working. Typo in the page name, maybe?

For future reference, no need to tag me, I see all the traffic coming on the Dashboard 2 topic, and there are others here that can assist too

If you still can't see the problem export those three nodes and one ui node from the page, and paste here so we can test it. The one ui node from the page will give us the page node.

[
    {
        "id": "6e910c997dd4122a",
        "type": "group",
        "z": "9a66516c0bb63179",
        "name": "login",
        "style": {
            "stroke": "#000000",
            "fill": "#d1d1d1",
            "label": true,
            "color": "#000000"
        },
        "nodes": [
            "34c67ce1cee54042",
            "9beb98e668d28d1b",
            "95426b336836aa36",
            "f20750c38e05eb28",
            "c05413d84624b36f",
            "88632b1c944da58c",
            "e81ccf951614e091",
            "de768c84f28fec3c",
            "76cfec3e75f57afc"
        ],
        "x": 254,
        "y": 2519,
        "w": 672,
        "h": 302
    },
    {
        "id": "34c67ce1cee54042",
        "type": "ui-template",
        "z": "9a66516c0bb63179",
        "g": "6e910c997dd4122a",
        "group": "",
        "page": "c10b3e0c7c4bdb0d",
        "ui": "",
        "name": "login",
        "order": 0,
        "width": 0,
        "height": 0,
        "head": "",
        "format": "<template>\n    <div class=\"card_login\" :class=\"{ 'background_login': active }\">\n        <v-text-field class=\"input_login\" type=\"password\" label=\"Senha\" variant=\"outlined\" v-model=\"senha\"\n            @keyup.enter=\"sendOTP\"></v-text-field>\n        <v-btn class=\"button_login\" @click=\"sendOTP\">Autorizar</v-btn>\n    </div>\n</template>\n\n\n<script>\n    export default {\n    data() {\n      return {              \n        senha:'',\n        active: false\n      };\n    },\n    methods: {    \n      sendOTP() {\n        this.active = true;\n        setTimeout(() => {\n          this.send({ payload: this.senha });\n          this.senha = '';\n          this.active = false;\n        }, 1000);\n      },      \n    }        \n  }\n</script>\n\n\n<style>\n    .card_login {\n        display: flex;\n        margin: auto;\n        flex-direction: column;\n        height: 130px !important;\n        width: 250px !important;\n        background-color: #4F4F4F;\n        border: 1px solid #000000;\n        border-radius: 18px;\n        padding: 10px;\n    }\n\n\n    .background_login {\n        background-color: #FF8C00;\n    }\n\n\n    .input_login {\n        margin: auto;\n        height: 20%;\n        width: 90%;\n        font-size: 25px;\n    }\n\n\n    .button_login {\n        margin: auto;\n        background-color: #4F4F4F;\n        border: 1px solid #000000;\n        border-radius: 10px;\n        color: #000000;\n    }\n</style>",
        "storeOutMessages": true,
        "passthru": false,
        "resendOnRefresh": true,
        "templateScope": "widget:page",
        "className": "",
        "x": 330,
        "y": 2560,
        "wires": [
            [
                "9beb98e668d28d1b",
                "88632b1c944da58c"
            ]
        ]
    },
    {
        "id": "9beb98e668d28d1b",
        "type": "function",
        "z": "9a66516c0bb63179",
        "g": "6e910c997dd4122a",
        "name": "senha 780705",
        "func": "if (msg.payload === '780705') {\n    \n    node.send({ payload: { pages: { enable: ['Casa'] } } });\n   \n    node.send({ payload: { 'page': 'Casa' }});\n\n}\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 600,
        "y": 2560,
        "wires": [
            [
                "95426b336836aa36",
                "e81ccf951614e091"
            ]
        ]
    },
    {
        "id": "95426b336836aa36",
        "type": "ui-control",
        "z": "9a66516c0bb63179",
        "g": "6e910c997dd4122a",
        "name": "",
        "ui": "85df8d80890b47f2",
        "events": "all",
        "x": 840,
        "y": 2580,
        "wires": [
            []
        ]
    },
    {
        "id": "f20750c38e05eb28",
        "type": "ui-template",
        "z": "9a66516c0bb63179",
        "g": "6e910c997dd4122a",
        "group": "2756af9309917096",
        "page": "",
        "ui": "",
        "name": "logoff",
        "order": 0,
        "width": "0",
        "height": "0",
        "head": "",
        "format": "<template>\n    <v-btn class=\"buton_logoff\" ref=\"botao\" stacked @click=\"start\">\n      <div class=\"title_logoff\">Logoff</div>\n      <v-icon class=\"icon_logoff\" ref=\"icon\" style=\"font-size: 40px;\">{{ icone }}</v-icon>\n    </v-btn>\n</template>\n\n\n<script>\n  export default {\n    data() {\n      return {\n        icone: 'mdi-power-on'\n       };\n    },\n    methods: {\n      start: function () {        \n        this.icone = 'mdi-power-cycle';\n        this.$refs.icon.$el.style.color = '#A9A9A9';\n        this.$refs.icon.$el.style.textShadow = '0px 0px 0px';    \n       \n        setTimeout(() => {\n          this.icone = 'mdi-power-off';\n          this.$refs.icon.$el.style.color = '#A9A9A9';\n          this.$refs.icon.$el.style.textShadow = '0px 0px 0px';\n        }, 1000);\n\n\n        setTimeout(() => {\n          this.send({ payload: 'ON' });\n        }, 2000);\n\n\n      },\n    }\n  };\n</script>\n\n\n<style>\n  .buton_logoff {\n    display: flex;\n    flex-direction: column;\n    margin: auto;\n    height: 50px;\n    width: 50px;\n    background-color: #FF8C00;\n    color: #000000;\n    border: 1px solid #000000;\n    font-size: 14px;\n    border-radius: 18px;\n  }\n  .title_logoff {\n    font-size: 75%;\n  }\n</style>",
        "storeOutMessages": true,
        "passthru": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 330,
        "y": 2720,
        "wires": [
            [
                "c05413d84624b36f",
                "de768c84f28fec3c"
            ]
        ]
    },
    {
        "id": "c05413d84624b36f",
        "type": "function",
        "z": "9a66516c0bb63179",
        "g": "6e910c997dd4122a",
        "name": "logoff",
        "func": "node.send({ payload: { 'page': 'Login' }});\n\nnode.send({ payload: { pages: { disable: ['Casa'] } } });\n   \n\n\n\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 650,
        "y": 2720,
        "wires": [
            [
                "95426b336836aa36"
            ]
        ]
    },
    {
        "id": "88632b1c944da58c",
        "type": "function",
        "z": "9a66516c0bb63179",
        "g": "6e910c997dd4122a",
        "name": "senha 123",
        "func": "if (msg.payload === '123') {\n   \n    node.send({ payload: { 'page': 'Neway Automações' }});\n\n\n    setTimeout(function () {\n        node.send({\n            payload: {\n                groups: {\n                    show: [\n                        'Neway Automações:Luzes',\n                        'Neway Automações:Fitas',\n                        'Neway Automações:Movimento e Ocupação',\n                        'Neway Automações:Utilitários',\n                        'Neway Automações:Entretenimento',\n                        'Neway Automações:Acionamento Individuais',\n                        'Neway Automações:Logoff'                        \n                    ]\n                }\n            }\n        });\n    }, 10);\n\n\n    setTimeout(function () {\n        node.send({\n            payload: {\n                groups: {\n                    hide: [                        \n                        'Neway Automações:Fitas',\n                        'Neway Automações:Movimento e Ocupação',\n                        'Neway Automações:Utilitários',\n                        'Neway Automações:Entretenimento',\n                        'Neway Automações:Acionamento Individuais'                        \n                    ]\n                }\n            }\n        });\n    }, 20);\n\n\n    setTimeout(function () {\n        node.send({ payload: { pages: { hide: ['Neway Automações'] } } });\n    }, 30);\n\n\n    setTimeout(function () {\n        node.send({ payload: { pages: { hide: ['Login'] } } });\n    }, 40);\n}\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 610,
        "y": 2600,
        "wires": [
            [
                "95426b336836aa36",
                "e81ccf951614e091"
            ]
        ]
    },
    {
        "id": "e81ccf951614e091",
        "type": "delay",
        "z": "9a66516c0bb63179",
        "g": "6e910c997dd4122a",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "minutes",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 480,
        "y": 2660,
        "wires": [
            [
                "c05413d84624b36f",
                "76cfec3e75f57afc"
            ]
        ]
    },
    {
        "id": "de768c84f28fec3c",
        "type": "template",
        "z": "9a66516c0bb63179",
        "g": "6e910c997dd4122a",
        "name": "reset",
        "field": "reset",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "reset",
        "output": "str",
        "x": 390,
        "y": 2780,
        "wires": [
            [
                "e81ccf951614e091"
            ]
        ]
    },
    {
        "id": "76cfec3e75f57afc",
        "type": "delay",
        "z": "9a66516c0bb63179",
        "g": "6e910c997dd4122a",
        "name": "",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 580,
        "y": 2780,
        "wires": [
            [
                "de768c84f28fec3c"
            ]
        ]
    },
    {
        "id": "c10b3e0c7c4bdb0d",
        "type": "ui-page",
        "name": "Login",
        "ui": "85df8d80890b47f2",
        "path": "/login",
        "icon": "home",
        "layout": "grid",
        "theme": "b6221fc08b602ea9",
        "order": -1,
        "className": "",
        "visible": "true",
        "disabled": "false"
    },
    {
        "id": "85df8d80890b47f2",
        "type": "ui-base",
        "name": "Base",
        "path": "/dashboard",
        "includeClientData": true,
        "acceptsClientConfig": [
            "ui-notification",
            "ui-control"
        ],
        "showPathInSidebar": false,
        "navigationStyle": "default"
    },
    {
        "id": "2756af9309917096",
        "type": "ui-group",
        "name": "Logoff",
        "page": "c4dcb127abec7894",
        "width": "2",
        "height": "1",
        "order": 8,
        "showTitle": true,
        "className": "",
        "visible": "true",
        "disabled": "false"
    },
    {
        "id": "b6221fc08b602ea9",
        "type": "ui-theme",
        "name": "Default Theme",
        "colors": {
            "surface": "#ffffff",
            "primary": "#0094ce",
            "bgPage": "#eeeeee",
            "groupBg": "#ffffff",
            "groupOutline": "#cccccc"
        },
        "sizes": {
            "pagePadding": "12px",
            "groupGap": "12px",
            "groupBorderRadius": "4px",
            "widgetGap": "12px"
        }
    },
    {
        "id": "c4dcb127abec7894",
        "type": "ui-page",
        "name": "Casa",
        "ui": "85df8d80890b47f2",
        "path": "/painel",
        "icon": "home",
        "layout": "flex",
        "theme": "b6221fc08b602ea9",
        "order": -1,
        "className": "",
        "visible": "true",
        "disabled": "true"
    }
]

That does not appear to be what I asked for. The three nodes you showed, an inject, a function and ui-control, plus one ui node from the page. Make the ui node a simple node such as a text node, not a template. Keep it simple.

[
    {
        "id": "95426b336836aa36",
        "type": "ui-control",
        "z": "9a66516c0bb63179",
        "g": "6e910c997dd4122a",
        "name": "",
        "ui": "85df8d80890b47f2",
        "events": "all",
        "x": 840,
        "y": 2580,
        "wires": [
            []
        ]
    },
    {
        "id": "85df8d80890b47f2",
        "type": "ui-base",
        "name": "Base",
        "path": "/dashboard",
        "includeClientData": true,
        "acceptsClientConfig": [
            "ui-notification",
            "ui-control"
        ],
        "showPathInSidebar": false,
        "navigationStyle": "default"
    }
]

That is just the ui-control node.

[
    {
        "id": "4f76dee6f346af81",
        "type": "function",
        "z": "251d2845015cbf09",
        "name": "",
        "func": "node.send({ payload: { pages: { disable: ['Casa'] } } });\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 640,
        "y": 520,
        "wires": [
            [
                "8e870e2844912e0e"
            ]
        ]
    },
    {
        "id": "8e870e2844912e0e",
        "type": "ui-control",
        "z": "251d2845015cbf09",
        "name": "",
        "ui": "85df8d80890b47f2",
        "events": "all",
        "x": 780,
        "y": 520,
        "wires": [
            []
        ]
    },
    {
        "id": "3ae5515720fc2f8c",
        "type": "inject",
        "z": "251d2845015cbf09",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 460,
        "y": 520,
        "wires": [
            [
                "4f76dee6f346af81"
            ]
        ]
    },
    {
        "id": "85df8d80890b47f2",
        "type": "ui-base",
        "name": "Base",
        "path": "/dashboard",
        "includeClientData": true,
        "acceptsClientConfig": [
            "ui-notification",
            "ui-control"
        ],
        "showPathInSidebar": false,
        "navigationStyle": "default"
    }
]

That is the inject, function, and ui-control, but you have not included a simple ui node on the page, such as a text node.

I really appreciate the help, but I can't understand what I'm not doing. I would just like to send the message to ui-control and disable the page. I use function because the processes are much more elaborate than that. If you can create an example and photograph it, I'll adjust it here.. anyway, the page won't be disabled..

Just select one of the ui-nodes that are on the page you are trying to hide, export it, and paste it here.

You are being asked to select and export those 3 nodes and one of the ui-something nodes that belongs to the page you are trying to disable.

The reason is: when you export the ui-something widget, the page it belongs to also gets exported and we can check the page name matches what you are providing in the payload.

[
    {
        "id": "6144c0042a190c57",
        "type": "ui-template",
        "z": "9a66516c0bb63179",
        "g": "6e4fdee14d68f4d8",
        "group": "f848602a9ceff0ab",
        "page": "",
        "ui": "",
        "name": "ping google",
        "order": 0,
        "width": "1",
        "height": "1",
        "head": "",
        "format": "<template>\n    <div class=\"card_ping\">\n        <div class=\"title_ping\">{{title}}</div>\n        <v-icon class=\"icon_ping\" ref=\"icon\">{{icon}}</v-icon>   \n        <div class=\"title_ping\">{{ping}}</div>\n    </div>\n</template>\n\n<script>\n    export default {\n        data() {\n            return {\n                icon: \"mdi-wifi-strength-outline\",                \n                title: \"--\",\n                ping: \"--\"\n            };\n        },\n        mounted() {\n            this.$socket.on('widget-load:' + this.id, (msg) => {\n                if (this.msg.payload > 0) {\n                    if (this.msg.payload < 8) {\n                        this.online_alto();\n                        this.ping = this.msg.payload;\n                    } else {\n                        this.online_baixo();\n                        this.ping = this.msg.payload;\n                    }                                                      \n                } else if (this.msg.payload === false) {\n                    this.offline();\n                    this.ping = \"--\";                                        \n                }\n            });\n        },\n        methods: {\n            online_alto: function () {\n                this.icon = \"mdi-wifi-arrow-up\";\n                this.$refs.icon.$el.style.color = '#32CD32';\n                this.$refs.icon.$el.style.textShadow = '0px 0px 10px #32CD32';\n                this.title = \"Online\";               \n            },\n            online_baixo: function () {\n                this.icon = \"mdi-wifi-arrow-down\";\n                this.$refs.icon.$el.style.color = '#FF8C00';\n                this.$refs.icon.$el.style.textShadow = '0px 0px 10px #FF8C00';\n                this.title = \"Online\";\n            },\n            offline: function () {\n                this.icon = \"mdi-wifi-remove\";\n                this.$refs.icon.$el.style.color = '#A9A9A9';\n                this.$refs.icon.$el.style.textShadow = '0px 0px 0px'; \n                this.title = \"Offline\";               \n            }\n        },\n        watch: {\n            msg: function(){\n                if(this.msg.payload != undefined){                 \n                    if (this.msg.payload > 0) {\n                        if (this.msg.payload < 8) {\n                            this.online_alto();\n                            this.ping = this.msg.payload;\n                        } else {\n                            this.online_baixo();\n                            this.ping = this.msg.payload;\n                        }                                                      \n                    } else if (this.msg.payload === false) {\n                        this.offline();\n                        this.ping = \"--\";                                        \n                    }\n                }\n            }\n        }\n    }\n</script>\n\n<style>\n    .card_ping {\n        display: flex;\n        flex-direction: column;        \n        margin: auto;\n        height: 70px !important; \n        width: 70px !important; \n        background-color: #4F4F4F !important;         \n        border: 1px solid #000000; \n        font-size: 14px; \n        border-radius: 18px; \n    }\n    .title_ping { \n        margin: auto;        \n        font-size: 80%;\n    }\n    .icon_ping {    \n        margin: auto;      \n        font-size: 200%;\n    }\n</style>",
        "storeOutMessages": true,
        "passthru": false,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 450,
        "y": 2160,
        "wires": [
            []
        ]
    },
    {
        "id": "f848602a9ceff0ab",
        "type": "ui-group",
        "name": "Servidor",
        "page": "c4dcb127abec7894",
        "width": "4",
        "height": "1",
        "order": 9,
        "showTitle": true,
        "className": "",
        "visible": "true",
        "disabled": "false"
    },
    {
        "id": "c4dcb127abec7894",
        "type": "ui-page",
        "name": "Casa",
        "ui": "85df8d80890b47f2",
        "path": "/painel",
        "icon": "home",
        "layout": "flex",
        "theme": "b6221fc08b602ea9",
        "order": -1,
        "className": "",
        "visible": "true",
        "disabled": "true"
    },
    {
        "id": "85df8d80890b47f2",
        "type": "ui-base",
        "name": "Base",
        "path": "/dashboard",
        "includeClientData": true,
        "acceptsClientConfig": [
            "ui-notification",
            "ui-control"
        ],
        "showPathInSidebar": false,
        "navigationStyle": "default"
    },
    {
        "id": "b6221fc08b602ea9",
        "type": "ui-theme",
        "name": "Default Theme",
        "colors": {
            "surface": "#ffffff",
            "primary": "#0094ce",
            "bgPage": "#eeeeee",
            "groupBg": "#ffffff",
            "groupOutline": "#cccccc"
        },
        "sizes": {
            "pagePadding": "12px",
            "groupGap": "12px",
            "groupBorderRadius": "4px",
            "widgetGap": "12px"
        }
    }
]

Assuming you chose a thing from the page you want to disable, that pages name is Casa not Neway Automações

That's not the case... I'm testing all types of names, with or without spaces, lowercase or uppercase. Nothing works. This is not an error, I sent one different from the other but I am modifying it appropriately so that the command matches the name.

But what you have posted was a page named Casa. If you are changing things then please post a full (minimal) reproducible non working example, with matching names etc.

It (the demo flow) will be evaluated by someone trying to help and assess if there is an issue or something else is going on.

In fact the previous flow posted (the inject, function and ui-control) does reference the same page.

@diegodamaceno The flows you posted do work for me. I noticed though that the page was already disabled in the flow you posted.

Can you describe exactly what you expect to see when you disable the page?

Below is a complete flow with both enable and disable capability.

[{"id":"4f76dee6f346af81","type":"function","z":"997da33a0beedade","name":"Disable","func":"node.send({ payload: { pages: { disable: ['Casa'] } } });\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":6480,"wires":[["8e4883d2e3ebe484","8e870e2844912e0e"]]},{"id":"8e870e2844912e0e","type":"ui-control","z":"997da33a0beedade","name":"","ui":"ID-BASE-1","events":"all","x":760,"y":6480,"wires":[[]]},{"id":"3ae5515720fc2f8c","type":"inject","z":"997da33a0beedade","name":"Disable","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":390,"y":6480,"wires":[["4f76dee6f346af81"]]},{"id":"8e4883d2e3ebe484","type":"debug","z":"997da33a0beedade","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":780,"y":6560,"wires":[]},{"id":"7e673f730a907d4f","type":"function","z":"997da33a0beedade","name":"Enable","func":"node.send({ payload: { pages: { enable: ['Casa'] } } });\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":6540,"wires":[["8e4883d2e3ebe484","8e870e2844912e0e"]]},{"id":"afee11532a732336","type":"inject","z":"997da33a0beedade","name":"Enable","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":390,"y":6540,"wires":[["7e673f730a907d4f"]]},{"id":"ID-BASE-1","type":"ui-base","name":"Dashboard","path":"/dashboard"}]

Thanks for your help gentlemen. I'll try to explain better what the problem is.

Objective - I want to create an automation to disable the page from such time to such time.

How I'm doing it - Injectc with time stamp hitting a function that disables and another that enables the page.

Problems encountered.

1 - The disabled page does not become inaccessible. I can still access it via direct link.
2 - The invisible page is still visible if I access it via direct link.
3 - I can't disable the page by sending payload like the documentation and just like I showed in the previous examples.

Summary. There is no point in disabling or making the page invisible if I type its address directly.

How to adjust?

I have a login page that, when displayed, leaves the activation panel disabled. When the correct password is entered, it enables the panel and directs the user to the panel. When we click logoff, the automation disables the panel back to the login page.. but none of this works because if I access the direct link, everything is still there, completely ignoring visibility or activity.

Did you try the flow I posted? It does disable and enable the page for me.

I will see if I also see the other issues.

You are right about 1, I have not tried 2. I suggest submitting an issue.

In fact manually displaying it via the link also re-enables it.