FlowFuse / node-red-dashboard

https://dashboard.flowfuse.com
Apache License 2.0
182 stars 46 forks source link

Some page returns an "unused" alert, however it is being used #1152

Open andrea-tomassi opened 1 month ago

andrea-tomassi commented 1 month ago

Current Behavior

image

Expected Behavior

If a page is being displyed, has groups inside etc should not trigger the "unused config" warning.

Steps To Reproduce

[ { "id": "3140cec2229a8dbf", "type": "tab", "label": "Flow 2", "disabled": false, "info": "", "env": [] }, { "id": "e3d02b48248a803b", "type": "ui-template", "z": "3140cec2229a8dbf", "group": "ab6b14b45fd0dfb3", "page": "", "ui": "", "name": "", "order": 1, "width": 0, "height": 0, "head": "", "format": "<v-btn @click=\"send({payload: 'Hello World'})\">Send Hello World", "storeOutMessages": true, "passthru": true, "resendOnRefresh": true, "templateScope": "local", "className": "", "x": 420, "y": 240, "wires": [ [ "e234badbeb740e49" ] ] }, { "id": "10b81341399afe1a", "type": "ui-template", "z": "3140cec2229a8dbf", "group": "324574385995bc1d", "page": "", "ui": "", "name": "", "order": 1, "width": 0, "height": 0, "head": "", "format": "", "storeOutMessages": true, "passthru": true, "resendOnRefresh": true, "templateScope": "local", "className": "", "x": 420, "y": 160, "wires": [ [] ] }, { "id": "0837ece1c6cd2f9f", "type": "inject", "z": "3140cec2229a8dbf", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "Hellooooo!", "payload": "iso", "payloadType": "date", "x": 180, "y": 120, "wires": [ [ "10b81341399afe1a", "53c9f9f3ee1b6e4b" ] ] }, { "id": "e234badbeb740e49", "type": "debug", "z": "3140cec2229a8dbf", "name": "debug 63", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 800, "y": 220, "wires": [] }, { "id": "53c9f9f3ee1b6e4b", "type": "ui-notification", "z": "3140cec2229a8dbf", "ui": "08f25dbd54afd079", "position": "top right", "colorDefault": true, "color": "#000000", "displayTime": "3", "showCountdown": true, "outputs": 1, "allowDismiss": true, "dismissText": "Close", "raw": false, "className": "", "name": "", "x": 450, "y": 80, "wires": [ [] ] }, { "id": "cd532b802ed99edb", "type": "function", "z": "3140cec2229a8dbf", "name": "auth", "func": "// Assuming msg._client.user.email contains the authenticated user's email\nconst userEmail = msg._client.user.email;\n\n// Define the pages and groups to hide\nconst pagesToHide = ['Homepage', 'Page 2']; // Replace with your actual page names\n\n// Prepare the payload to show/hide pages and groups\nmsg.payload = {\n pages: {\n show: [], // Add any pages you want to show\n hide: pagesToHide // Pages to hide\n }\n};\n\n// Log the action for debugging\nnode.log(Hiding pages: ${JSON.stringify(pagesToHide)});\n\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 410, "y": 320, "wires": [ [ "b3f8da232ad49630" ] ] }, { "id": "b3f8da232ad49630", "type": "ui-control", "z": "3140cec2229a8dbf", "name": "", "ui": "08f25dbd54afd079", "events": "all", "x": 640, "y": 320, "wires": [ [ "860583c48051155c" ] ] }, { "id": "860583c48051155c", "type": "debug", "z": "3140cec2229a8dbf", "name": "debug 64", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 840, "y": 320, "wires": [] }, { "id": "bd6b4ab764694470", "type": "ui-control", "z": "3140cec2229a8dbf", "name": "", "ui": "08f25dbd54afd079", "events": "all", "x": 160, "y": 320, "wires": [ [ "cd532b802ed99edb" ] ] }, { "id": "d4522e1cfe42ef45", "type": "ui-chart", "z": "3140cec2229a8dbf", "group": "8c88e7c22290f648", "name": "", "label": "chart", "order": 1, "chartType": "line", "category": "topic", "categoryType": "msg", "xAxisLabel": "", "xAxisProperty": "", "xAxisPropertyType": "property", "xAxisType": "time", "xAxisFormat": "", "xAxisFormatType": "auto", "yAxisLabel": "", "yAxisProperty": "", "ymin": "", "ymax": "", "action": "append", "stackSeries": false, "pointShape": "circle", "pointRadius": 4, "showLegend": true, "removeOlder": 1, "removeOlderUnit": "3600", "removeOlderPoints": "", "colors": [ "#0095ff", "#ff0000", "#ff7f0e", "#2ca02c", "#a347e1", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "textColor": [ "#666666" ], "textColorDefault": true, "gridColor": [ "#e5e5e5" ], "gridColorDefault": true, "width": 6, "height": 8, "className": "", "x": 410, "y": 420, "wires": [ [] ] }, { "id": "ab6b14b45fd0dfb3", "type": "ui-group", "name": "G2", "page": "bcc422e05bf17807", "width": "4", "height": "3", "order": 2, "showTitle": true, "className": "", "visible": "true", "disabled": "false" }, { "id": "324574385995bc1d", "type": "ui-group", "name": "G1", "page": "bcc422e05bf17807", "width": "4", "height": "3", "order": 1, "showTitle": true, "className": "", "visible": "true", "disabled": "false" }, { "id": "08f25dbd54afd079", "type": "ui-base", "name": "UI Name", "path": "/dashboard", "includeClientData": true, "acceptsClientConfig": [ "ui-notification", "ui-control", "ui-template", "ui-markdown", "ui-form", "ui-text-input", "ui-file-input", "ui-button", "ui-button-group", "ui-dropdown", "ui-radio-group", "ui-slider", "ui-switch", "ui-text", "ui-table", "ui-chart", "ui-gauge", "ui-tabulator" ], "showPathInSidebar": false, "showPageTitle": true, "navigationStyle": "icon", "titleBarStyle": "default" }, { "id": "8c88e7c22290f648", "type": "ui-group", "name": "My Group", "page": "d1b4fa02ddfafd2b", "width": "6", "height": "1", "order": 1, "showTitle": true, "className": "", "visible": "true", "disabled": "false" }, { "id": "bcc422e05bf17807", "type": "ui-page", "name": "Homepage", "ui": "08f25dbd54afd079", "path": "/home", "icon": "home", "layout": "grid", "theme": "b7b1935fbb33bbc8", "order": 1, "className": "", "visible": true, "disabled": false }, { "id": "d1b4fa02ddfafd2b", "type": "ui-page", "name": "Page 2", "ui": "08f25dbd54afd079", "path": "/page2", "icon": "home", "layout": "grid", "theme": "b7b1935fbb33bbc8", "order": 2, "className": "", "visible": "true", "disabled": "false" }, { "id": "b7b1935fbb33bbc8", "type": "ui-theme", "name": "def theme", "colors": { "surface": "#ffffff", "primary": "#0094ce", "bgPage": "#eeeeee", "groupBg": "#ffffff", "groupOutline": "#cccccc" }, "sizes": { "pagePadding": "12px", "groupGap": "12px", "groupBorderRadius": "4px", "widgetGap": "12px" } } ]

Environment

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

andrea-tomassi commented 1 month ago

I guess this is a related issue: The group count for a page is still zero while a group assigned to that pages exists. Probably this can help to find the root cause.

Rebooting node-red instance does not solve the misalignment.

image

andrea-tomassi commented 1 month ago

Some more evidence:

image

Page 1 has "My Group". My Group has a form element (but evetually it could be empty as well).

image

Still page 1 is reported as "unused"

arturv2000 commented 1 month ago

It appears to be a bug.

As a workaround if you refresh the browser tab where the editor is (F5), it will update that correctly and the warning/error will disappear.

andrea-tomassi commented 1 month ago

It appears to be a bug.

As a workaround if you refresh the browser tab where the editor is (F5), it will update that correctly and the warning/error will disappear.

Thanks a lot for your workaround, it makes the bug much less annoying!