I set up a working template node with a function to take me to the clicked tab.
But now multiple users whant to use it, and we discovered that every clicking takes all open dashboards to the last clicked tab.
This is my function:
function navigate(where) {
fetch('/navigate', {
method: 'POST',
body: JSON.stringify({ tab: where })
});
return false;
}
How can I prevent all other dashboards to follow to the last clicked tab?
here is a sample of that flow with one testbutton.
[ { "id": "884fb0cf.d68a5", "type": "ui_ui_control", "z": "97287e58.a1eed", "name": "", "events": "change", "x": 760, "y": 520, "wires": [ [] ] }, { "id": "60b9057a.631e2c", "type": "http response", "z": "97287e58.a1eed", "name": "", "statusCode": "", "headers": {}, "x": 430, "y": 480, "wires": [] }, { "id": "8145ee8e.271a", "type": "http in", "z": "97287e58.a1eed", "name": "", "url": "/navigate", "method": "post", "upload": false, "swaggerDoc": "", "x": 200, "y": 520, "wires": [ [ "f9574f4.3ae91b", "60b9057a.631e2c" ] ] }, { "id": "f9574f4.3ae91b", "type": "json", "z": "97287e58.a1eed", "name": "", "property": "payload", "action": "", "pretty": false, "x": 430, "y": 520, "wires": [ [ "77503546.bd3d5c" ] ] }, { "id": "77503546.bd3d5c", "type": "function", "z": "97287e58.a1eed", "name": "safety", "func": "return {payload: {tab: msg.payload.tab}};", "outputs": 1, "noerr": 0, "x": 590, "y": 520, "wires": [ [ "884fb0cf.d68a5" ] ] }, { "id": "2b293ee4d674c450", "type": "ui_template", "z": "97287e58.a1eed", "group": "43c4d7e6.ca2bf8", "name": "newtab", "order": 2, "width": "6", "height": "9", "format": "<script>\n function navigate(where) {\n fetch('/navigate', {\n method: 'POST', \n body: JSON.stringify({ tab: where }) \n });\n return false;\n }\n</script>\n<div layout=\"row\" layout-align=\"space-between\">\n <button type=\"button\" onclick=\"navigate('newtab')\"> testbutton </button>\n</div>", "storeOutMessages": true, "fwdInMessages": true, "resendOnRefresh": false, "templateScope": "local", "className": "", "x": 480, "y": 400, "wires": [ [] ] }, { "id": "62159f39.07279", "type": "ui_ui_control", "z": "97287e58.a1eed", "name": "", "events": "all", "x": 320, "y": 320, "wires": [ [ "b921c350.f679a", "2b293ee4d674c450" ] ] }, { "id": "43c4d7e6.ca2bf8", "type": "ui_group", "name": "test", "tab": "cb9f47a9.877e18", "order": 1, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "cb9f47a9.877e18", "type": "ui_tab", "name": "newtab", "icon": "power_settings_new", "order": 1, "disabled": false, "hidden": false } ]