node-red-dashboard icon indicating copy to clipboard operation
node-red-dashboard copied to clipboard

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

Open andrea-tomassi opened this issue 1 year ago • 18 comments

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

  • Dashboard version: 1.14.0
  • Node-RED version: 4.0.2
  • Node.js version: 20.x
  • npm version:
  • Platform/OS: Ubuntu
  • Browser: Chrome

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

andrea-tomassi avatar Aug 04 '24 07:08 andrea-tomassi

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 avatar Aug 04 '24 08:08 andrea-tomassi

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"

andrea-tomassi avatar Aug 04 '24 09:08 andrea-tomassi

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.

arturv2000 avatar Aug 04 '24 09:08 arturv2000

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!

andrea-tomassi avatar Aug 05 '24 22:08 andrea-tomassi

Hello, I'm commenting here to note that this bug still exists and the "workaround" is not working. Refreshing the editor does nothing. Deleting the "unused" pages does exactly what you'd think, delete the page that all those groups were associated with. image

My setup: node-red: V4.0.7 node.js: V20.18.1 flowfuse/node-red-dashboard: V1.22.0

gemini86 avatar Jan 15 '25 15:01 gemini86

Have you got only subflows in the groups showing 0?

colinl avatar Jan 17 '25 09:01 colinl

Have you got only subflows in the groups showing 0?

No subflows in this project. Everything is configured fine when building the dashboard and adding widgets, but at some point something happens and the pages don't seem to think they're associated with the groups, but the groups know they're associated with the pages somehow. Everything serves correctly on the dashboard pages though, so the only real irritation is the constant warning of unused nodes.

gemini86 avatar Jan 17 '25 19:01 gemini86

Does it recover if you restart node-red?

colinl avatar Jan 18 '25 21:01 colinl

No, restarting node-red does not change the situation.

On Sat, Jan 18, 2025, 1:10 PM Colin Law @.***> wrote:

Does it recover if you restart node-red?

— Reply to this email directly, view it on GitHub https://github.com/FlowFuse/node-red-dashboard/issues/1152#issuecomment-2599963628, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCATC2WSUTX5F367UB2QRL2LK7N5AVCNFSM6AAAAABL6TFYISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJZHE3DGNRSHA . You are receiving this because you commented.Message ID: @.***>

gemini86 avatar Jan 19 '25 01:01 gemini86

What happens if you refresh the browser page?

colinl avatar Jan 19 '25 07:01 colinl

As I stated in my earlier post, refreshing the editor browser does nothing to correct the issue.

On Sat, Jan 18, 2025, 11:45 PM Colin Law @.***> wrote:

What happens if you refresh the browser page?

— Reply to this email directly, view it on GitHub https://github.com/FlowFuse/node-red-dashboard/issues/1152#issuecomment-2600743583, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCATC63R2ADFRQAI4Q42332LNJZXAVCNFSM6AAAAABL6TFYISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBQG42DGNJYGM . You are receiving this because you commented.Message ID: @.***>

gemini86 avatar Jan 19 '25 07:01 gemini86

So having refreshed the browser page I presume that you see the Deploy button enabled. If so then save a copy of your flows file, do the deploy, then see what has changed in the flows file?

After deploying, if you refresh the page again, is the Deploy button enabled again?

colinl avatar Jan 19 '25 08:01 colinl

No, a browser refresh for not change the state of the deploy button. The pages are still just stuck saying they have zero groups assigned, but all groups are assigned to pages and load correctly in the dashboard view. To correct this you just delete the pages, which drops all of your layouts and orphans all groups, create new pages and assign your groups and weights, basically start all over. Then it happens again anyway

On Sun, Jan 19, 2025, 12:15 AM Colin Law @.***> wrote:

So having refreshed the browser page I presume that you see the Deploy button enabled. If so then save a copy of your flows file, do the deploy, then see what has changed in the flows file?

After deploying, if you refresh the page again, is the Deploy button enabled again?

— Reply to this email directly, view it on GitHub https://github.com/FlowFuse/node-red-dashboard/issues/1152#issuecomment-2600752270, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCATC7QNFKTNYTWEJ6RFEL2LNNJJAVCNFSM6AAAAABL6TFYISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBQG42TEMRXGA . You are receiving this because you commented.Message ID: @.***>

gemini86 avatar Jan 19 '25 08:01 gemini86

Sorry, I was confused about which issue I was responding to, my previous question was irrelevant.

Can you select the widgets in one of the groups, export them, and paste here. When pasting add triple backtick characters on separate lines before and after the flow so that github does not mess with the formatting.

colinl avatar Jan 19 '25 09:01 colinl

Then it happens again anyway

@gemini86 Do I understand correctly that between the correct state and the incorrect state (i.e. showing unused nodes) you didn't make any changes to "these" pages->groups->widget items?

If I am not mistaken the original issue above was fixed into Node-RED core, instead of in the dashboard. I assume that will be the case now again, because I cannot think of anything that could cause this inside the dashboard. All ui related nodes (e.g. ui-page, ui-group, ...) have a users and hasUsers property, to pass info about the users of the node to Node-RED core (i.e. which other nodes are using a node). But if that would have been configured incorrectly in the dashboard code, then everybody would have your issue...

Would be nice if we could isolate some steps to reproduce your issue, and then ask the Node-RED core guys if they have an idea what could cause it.

Bart

bartbutenaers avatar Jan 19 '25 14:01 bartbutenaers

Not OP but updating from Node-Red 4.0.6 to 4.0.8 solved this issue for me.

webguy16 avatar Jan 21 '25 18:01 webguy16

@webguy16 Thanks for sharing this, and refreshing my brain! Yes now I remember Node-RED 4.0.8 contains a fix for this bug.

@gemini86 I now see you use Node-RED 4.0.7, which contains the unused config node bug (that was introduced in Node-RED 4.0.6). If you have the possibility to upgrade to Node-RED 4.0.8 and share your feedback here, that would be helpful for the Flowfuse people.

bartbutenaers avatar Jan 21 '25 19:01 bartbutenaers

Thank you @webguy16, @bartbutenaers. Updating node-red from 4.0.7 -> 4.0.8 did fix this issue.

gemini86 avatar Jan 21 '25 19:01 gemini86