Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui-control: refactoring element identification #1583

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bartbutenaers
Copy link
Contributor

@bartbutenaers bartbutenaers commented Jan 18, 2025

Description

This PR is a replacement of another. Because I got there the feedback from @joepavitt and @Steve-Mcl that it should also be possible to select pages and groups based their node ids.

Moreover I saw another issue passing by, which is a feature request to be able to target also widgets (instead of only groups and pages). However I am stuck with this! Would be nice if anybody could assist me with this, otherwise I cannot finalize this PR. The problem is that the request (to turn off the visibility of a widget) arrives at the frontend but the widget remains visible:

image

I tried to add the part for "ui/widgetstate" in the above screenshot, because I thought that works already for msg.visible (?) but nothing happens ;-(

And finally I experienced myself another bug in the original code, that you can specify "pageName:groupName" and the group is controlled even when the page with that name doesn't exist. That has been fixed in this PR, but that also means a breaking change if some flows relay on that bug. But it makes no sense at all to keep that bug alive...

Due to all the above reasons, I decided that I needed to completely refactor the element identification code. I have done this in a series of iterations, because I was not pleased with my intermediate implementations. Hopefully the current one is ok for you guys...

As you can see in the node info panel, much more selectors are now allowed:
image

The following example flow demonstrates this (except the widget stuff does NOT work yet as explained above):

[{"id":"381db98ea173ca41","type":"inject","z":"a663bb334b6ef130","name":"show group \"Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"show\":[\"Test Group\"]}}","payloadType":"json","x":550,"y":360,"wires":[["558baa9d92a21c55"]]},{"id":"4f8b8c9d230925dc","type":"inject","z":"a663bb334b6ef130","name":"hide group \"accb66f14a9ff4af\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"hide\":[\"accb66f14a9ff4af\"]}}","payloadType":"json","x":540,"y":540,"wires":[["558baa9d92a21c55"]]},{"id":"558baa9d92a21c55","type":"ui-control","z":"a663bb334b6ef130","name":"","ui":"ba0979b23b606ba0","events":"all","x":780,"y":80,"wires":[["7a696699efeb19f0"]]},{"id":"d161d2ef5a0f11ef","type":"comment","z":"a663bb334b6ef130","name":"--- GROUP ---","info":"","x":590,"y":320,"wires":[]},{"id":"1b75b758ab56b004","type":"inject","z":"a663bb334b6ef130","name":"show group \"accb66f14a9ff4af\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"show\":[\"accb66f14a9ff4af\"]}}","payloadType":"json","x":530,"y":400,"wires":[["558baa9d92a21c55"]]},{"id":"7a696699efeb19f0","type":"debug","z":"a663bb334b6ef130","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":960,"y":80,"wires":[]},{"id":"d2d1f2f3bec840ef","type":"inject","z":"a663bb334b6ef130","name":"show page \"Test Page\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"pages\":{\"show\":[\"Test Page\"]}}","payloadType":"json","x":560,"y":80,"wires":[["558baa9d92a21c55"]]},{"id":"90268ab2c4e3e846","type":"inject","z":"a663bb334b6ef130","name":"hide page \"0615b1846821cbdf\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"pages\":{\"hide\":[\"0615b1846821cbdf\"]}}","payloadType":"json","x":530,"y":260,"wires":[["558baa9d92a21c55"]]},{"id":"f8b1f5e060d65b02","type":"inject","z":"a663bb334b6ef130","name":"show page \"0615b1846821cbdf\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"pages\":{\"show\":[\"0615b1846821cbdf\"]}}","payloadType":"json","x":530,"y":120,"wires":[["558baa9d92a21c55"]]},{"id":"1e58e89c53963d56","type":"inject","z":"a663bb334b6ef130","name":"show widget \"d86b48828341464c\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"d86b48828341464c\"]}}","payloadType":"json","x":520,"y":680,"wires":[["558baa9d92a21c55"]]},{"id":"c2506e478c8816b4","type":"inject","z":"a663bb334b6ef130","name":"hide widget \"d86b48828341464c\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"hide\":[\"d86b48828341464c\"]}}","payloadType":"json","x":530,"y":1140,"wires":[["558baa9d92a21c55"]]},{"id":"de7cb515c96c8a8d","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"widget\":\"Test Widget\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"widget\":\"Test Widget\"}]}}","payloadType":"json","x":520,"y":880,"wires":[["558baa9d92a21c55"]]},{"id":"d86b48828341464c","type":"ui-text","z":"a663bb334b6ef130","group":"accb66f14a9ff4af","order":1,"width":0,"height":0,"name":"Test Widget","label":"Test","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":false,"className":"","x":970,"y":140,"wires":[]},{"id":"f68fba6723ccacb1","type":"inject","z":"a663bb334b6ef130","name":"show group \"Test Page:Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"show\":[\"Test Page:Test Group\"]}}","payloadType":"json","x":520,"y":440,"wires":[["558baa9d92a21c55"]]},{"id":"3b791e589e6cbd98","type":"inject","z":"a663bb334b6ef130","name":"show page [{\"page\":\"Test Page\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"pages\":{\"show\":[{\"page\":\"Test Page\"}]}}","payloadType":"json","x":530,"y":160,"wires":[["558baa9d92a21c55"]]},{"id":"3ee391bb7f37de56","type":"inject","z":"a663bb334b6ef130","name":"show page {\"page\":\"0615b1846821cbdf\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"pages\":{\"show\":[{\"page\":\"0615b1846821cbdf\"}]}}","payloadType":"json","x":500,"y":200,"wires":[["558baa9d92a21c55"]]},{"id":"20834b69a746c4aa","type":"comment","z":"a663bb334b6ef130","name":"--- PAGE ---","info":"","x":590,"y":40,"wires":[]},{"id":"a83dc51b0667d06d","type":"inject","z":"a663bb334b6ef130","name":"show group \"0615b1846821cbdf:Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"show\":[\"0615b1846821cbdf:Test Group\"]}}","payloadType":"json","x":490,"y":480,"wires":[["558baa9d92a21c55"]]},{"id":"3644b23649b11bc1","type":"comment","z":"a663bb334b6ef130","name":"--- WIDGET ---","info":"","x":580,"y":600,"wires":[]},{"id":"7d49b36a7aa308a8","type":"inject","z":"a663bb334b6ef130","name":"show widget \"Test Widget\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"Test Widget\"]}}","payloadType":"json","x":550,"y":640,"wires":[["558baa9d92a21c55"]]},{"id":"f965b2a4541bb6c4","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"page\":\"Test Page\",\"group\":\"Test Group\",\"widget\":\"Test Widget\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"page\":\"Test Page\",\"group\":\"Test Group\",\"widget\":\"Test Widget\"}]}}","payloadType":"json","x":390,"y":1040,"wires":[["558baa9d92a21c55"]]},{"id":"c713dd31f5b9e45f","type":"inject","z":"a663bb334b6ef130","name":"show widget \"accb66f14a9ff4af:Test Widget\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"accb66f14a9ff4af:Test Widget\"]}}","payloadType":"json","x":490,"y":760,"wires":[["558baa9d92a21c55"]]},{"id":"33a80dfb378f1c65","type":"inject","z":"a663bb334b6ef130","name":"show widget \"Test Group:Test Widget\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"Test Group:Test Widget\"]}}","payloadType":"json","x":510,"y":720,"wires":[["558baa9d92a21c55"]]},{"id":"b65d779b0b7acc43","type":"inject","z":"a663bb334b6ef130","name":"show widget \"0615b1846821cbdf:Test Group:Test Widget\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"0615b1846821cbdf:Test Group:Test Widget\"]}}","payloadType":"json","x":450,"y":840,"wires":[["558baa9d92a21c55"]]},{"id":"2472f9d72277bb68","type":"inject","z":"a663bb334b6ef130","name":"show widget \"Test Page:Test Group:Test Widget\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"Test Page:Test Group:Test Widget\"]}}","payloadType":"json","x":480,"y":800,"wires":[["558baa9d92a21c55"]]},{"id":"31f6b7f3033f8186","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"widget\":\"d86b48828341464c\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"widget\":\"d86b48828341464c\"}]}}","payloadType":"json","x":490,"y":920,"wires":[["558baa9d92a21c55"]]},{"id":"78539a011fcbef6d","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"group\":\"Test Group\",\"widget\":\"Test Widget\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"group\":\"Test Group\",\"widget\":\"Test Widget\"}]}}","payloadType":"json","x":450,"y":960,"wires":[["558baa9d92a21c55"]]},{"id":"36b4cb462df3a4cb","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"group\":\"accb66f14a9ff4af\",\"widget\":\"Test Widget\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"group\":\"accb66f14a9ff4af\",\"widget\":\"Test Widget\"}]}}","payloadType":"json","x":430,"y":1000,"wires":[["558baa9d92a21c55"]]},{"id":"def4b7e35c859195","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"page\":\"0615b1846821cbdf\",\"group\":\"Test Group\",\"widget\":\"Test Widget\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"page\":\"0615b1846821cbdf\",\"group\":\"Test Group\",\"widget\":\"Test Widget\"}]}}","payloadType":"json","x":360,"y":1080,"wires":[["558baa9d92a21c55"]]},{"id":"ba0979b23b606ba0","type":"ui-base","name":"My Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true},{"id":"accb66f14a9ff4af","type":"ui-group","name":"Test Group","page":"0615b1846821cbdf","width":6,"height":1,"order":1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"0615b1846821cbdf","type":"ui-page","name":"Test Page","ui":"ba0979b23b606ba0","path":"/Test-Page","icon":"home","layout":"grid","theme":"c049776195a75b90","breakpoints":[{"name":"Default","px":"0","cols":"3"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":1,"className":"","visible":"true","disabled":"false"},{"id":"c049776195a75b90","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094CE","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"density":"default","pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}}]

image

P.S. Don't know if it is possible to share such flows somewhere (via the Import menu examples perhaps), because it would really help users to get started...

Summarized the changes of this refactoring:

  • There are now more ways to identify a page, group or widget.
  • The bug with the : inside the names is fixed.
  • The backend code only sends id's to the frontend code. I decided that it is useless to have code in the frontend to identify elements based on their name. Hopefully that is fine. Not sure if I somehow introduced a breaking change this way, if statestores containing element names have been persisted for some flows somehow? No idea...

Related Issue(s)

1550 and 711

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • Includes a DB migration? -> add the area:migration label

@bartbutenaers bartbutenaers mentioned this pull request Jan 18, 2025
10 tasks
@bartbutenaers
Copy link
Contributor Author

Not sure why the unit test fails:
I have update my example flow to test enabling/disabling of groups:

[{"id":"381db98ea173ca41","type":"inject","z":"a663bb334b6ef130","name":"show group \"Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"show\":[\"Test Group\"]}}","payloadType":"json","x":550,"y":360,"wires":[["558baa9d92a21c55"]]},{"id":"4f8b8c9d230925dc","type":"inject","z":"a663bb334b6ef130","name":"hide group \"accb66f14a9ff4af\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"hide\":[\"accb66f14a9ff4af\"]}}","payloadType":"json","x":540,"y":540,"wires":[["558baa9d92a21c55"]]},{"id":"558baa9d92a21c55","type":"ui-control","z":"a663bb334b6ef130","name":"","ui":"ba0979b23b606ba0","events":"all","x":780,"y":80,"wires":[["7a696699efeb19f0"]]},{"id":"d161d2ef5a0f11ef","type":"comment","z":"a663bb334b6ef130","name":"--- GROUP ---","info":"","x":590,"y":320,"wires":[]},{"id":"1b75b758ab56b004","type":"inject","z":"a663bb334b6ef130","name":"show group \"accb66f14a9ff4af\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"show\":[\"accb66f14a9ff4af\"]}}","payloadType":"json","x":530,"y":400,"wires":[["558baa9d92a21c55"]]},{"id":"7a696699efeb19f0","type":"debug","z":"a663bb334b6ef130","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":960,"y":80,"wires":[]},{"id":"d2d1f2f3bec840ef","type":"inject","z":"a663bb334b6ef130","name":"show page \"Test Page\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"pages\":{\"show\":[\"Test Page\"]}}","payloadType":"json","x":560,"y":80,"wires":[["558baa9d92a21c55"]]},{"id":"90268ab2c4e3e846","type":"inject","z":"a663bb334b6ef130","name":"hide page \"0615b1846821cbdf\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"pages\":{\"hide\":[\"0615b1846821cbdf\"]}}","payloadType":"json","x":530,"y":260,"wires":[["558baa9d92a21c55"]]},{"id":"f8b1f5e060d65b02","type":"inject","z":"a663bb334b6ef130","name":"show page \"0615b1846821cbdf\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"pages\":{\"show\":[\"0615b1846821cbdf\"]}}","payloadType":"json","x":530,"y":120,"wires":[["558baa9d92a21c55"]]},{"id":"1e58e89c53963d56","type":"inject","z":"a663bb334b6ef130","name":"show widget \"d86b48828341464c\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"d86b48828341464c\"]}}","payloadType":"json","x":520,"y":680,"wires":[["558baa9d92a21c55"]]},{"id":"c2506e478c8816b4","type":"inject","z":"a663bb334b6ef130","name":"hide widget \"d86b48828341464c\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"hide\":[\"d86b48828341464c\"]}}","payloadType":"json","x":530,"y":1140,"wires":[["558baa9d92a21c55"]]},{"id":"de7cb515c96c8a8d","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"widget\":\"Test Widget\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"widget\":\"Test Widget\"}]}}","payloadType":"json","x":520,"y":880,"wires":[["558baa9d92a21c55"]]},{"id":"d86b48828341464c","type":"ui-text","z":"a663bb334b6ef130","group":"accb66f14a9ff4af","order":1,"width":0,"height":0,"name":"Test Widget","label":"Test","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":false,"className":"","x":970,"y":140,"wires":[]},{"id":"f68fba6723ccacb1","type":"inject","z":"a663bb334b6ef130","name":"show group \"Test Page:Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"show\":[\"Test Page:Test Group\"]}}","payloadType":"json","x":520,"y":440,"wires":[["558baa9d92a21c55"]]},{"id":"3b791e589e6cbd98","type":"inject","z":"a663bb334b6ef130","name":"show page [{\"page\":\"Test Page\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"pages\":{\"show\":[{\"page\":\"Test Page\"}]}}","payloadType":"json","x":530,"y":160,"wires":[["558baa9d92a21c55"]]},{"id":"3ee391bb7f37de56","type":"inject","z":"a663bb334b6ef130","name":"show page {\"page\":\"0615b1846821cbdf\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"pages\":{\"show\":[{\"page\":\"0615b1846821cbdf\"}]}}","payloadType":"json","x":500,"y":200,"wires":[["558baa9d92a21c55"]]},{"id":"20834b69a746c4aa","type":"comment","z":"a663bb334b6ef130","name":"--- PAGE ---","info":"","x":590,"y":40,"wires":[]},{"id":"a83dc51b0667d06d","type":"inject","z":"a663bb334b6ef130","name":"show group \"0615b1846821cbdf:Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"show\":[\"0615b1846821cbdf:Test Group\"]}}","payloadType":"json","x":490,"y":480,"wires":[["558baa9d92a21c55"]]},{"id":"3644b23649b11bc1","type":"comment","z":"a663bb334b6ef130","name":"--- WIDGET ---","info":"","x":580,"y":600,"wires":[]},{"id":"7d49b36a7aa308a8","type":"inject","z":"a663bb334b6ef130","name":"show widget \"Test Widget\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"Test Widget\"]}}","payloadType":"json","x":550,"y":640,"wires":[["558baa9d92a21c55"]]},{"id":"f965b2a4541bb6c4","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"page\":\"Test Page\",\"group\":\"Test Group\",\"widget\":\"Test Widget\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"page\":\"Test Page\",\"group\":\"Test Group\",\"widget\":\"Test Widget\"}]}}","payloadType":"json","x":390,"y":1040,"wires":[["558baa9d92a21c55"]]},{"id":"c713dd31f5b9e45f","type":"inject","z":"a663bb334b6ef130","name":"show widget \"accb66f14a9ff4af:Test Widget\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"accb66f14a9ff4af:Test Widget\"]}}","payloadType":"json","x":490,"y":760,"wires":[["558baa9d92a21c55"]]},{"id":"33a80dfb378f1c65","type":"inject","z":"a663bb334b6ef130","name":"show widget \"Test Group:Test Widget\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"Test Group:Test Widget\"]}}","payloadType":"json","x":510,"y":720,"wires":[["558baa9d92a21c55"]]},{"id":"b65d779b0b7acc43","type":"inject","z":"a663bb334b6ef130","name":"show widget \"0615b1846821cbdf:Test Group:Test Widget\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"0615b1846821cbdf:Test Group:Test Widget\"]}}","payloadType":"json","x":450,"y":840,"wires":[["558baa9d92a21c55"]]},{"id":"2472f9d72277bb68","type":"inject","z":"a663bb334b6ef130","name":"show widget \"Test Page:Test Group:Test Widget\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[\"Test Page:Test Group:Test Widget\"]}}","payloadType":"json","x":480,"y":800,"wires":[["558baa9d92a21c55"]]},{"id":"31f6b7f3033f8186","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"widget\":\"d86b48828341464c\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"widget\":\"d86b48828341464c\"}]}}","payloadType":"json","x":490,"y":920,"wires":[["558baa9d92a21c55"]]},{"id":"78539a011fcbef6d","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"group\":\"Test Group\",\"widget\":\"Test Widget\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"group\":\"Test Group\",\"widget\":\"Test Widget\"}]}}","payloadType":"json","x":450,"y":960,"wires":[["558baa9d92a21c55"]]},{"id":"36b4cb462df3a4cb","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"group\":\"accb66f14a9ff4af\",\"widget\":\"Test Widget\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"group\":\"accb66f14a9ff4af\",\"widget\":\"Test Widget\"}]}}","payloadType":"json","x":430,"y":1000,"wires":[["558baa9d92a21c55"]]},{"id":"def4b7e35c859195","type":"inject","z":"a663bb334b6ef130","name":"show widget {\"page\":\"0615b1846821cbdf\",\"group\":\"Test Group\",\"widget\":\"Test Widget\"}","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"widgets\":{\"show\":[{\"page\":\"0615b1846821cbdf\",\"group\":\"Test Group\",\"widget\":\"Test Widget\"}]}}","payloadType":"json","x":360,"y":1080,"wires":[["558baa9d92a21c55"]]},{"id":"d423e937c5767c58","type":"inject","z":"a663bb334b6ef130","name":"enable group \"accb66f14a9ff4af\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"enable\":[\"accb66f14a9ff4af\"]}}","payloadType":"json","x":950,"y":400,"wires":[["558baa9d92a21c55"]]},{"id":"4ec9eb24cbfc2922","type":"inject","z":"a663bb334b6ef130","name":"enable group \"Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"enable\":[\"Test Group\"]}}","payloadType":"json","x":930,"y":360,"wires":[["558baa9d92a21c55"]]},{"id":"1870a8cfc79238cf","type":"inject","z":"a663bb334b6ef130","name":"enable group \"Test Page:Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"enable\":[\"Test Page:Test Group\"]}}","payloadType":"json","x":960,"y":440,"wires":[["558baa9d92a21c55"]]},{"id":"1a48ef0a1c5aae0d","type":"inject","z":"a663bb334b6ef130","name":"enable group \"0615b1846821cbdf:Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"enable\":[\"0615b1846821cbdf:Test Group\"]}}","payloadType":"json","x":990,"y":480,"wires":[["558baa9d92a21c55"]]},{"id":"3bfea4231ab65e3f","type":"inject","z":"a663bb334b6ef130","name":"disable group \"accb66f14a9ff4af\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"disable\":[\"accb66f14a9ff4af\"]}}","payloadType":"json","x":1390,"y":400,"wires":[["558baa9d92a21c55"]]},{"id":"9ed1947cf7e5647c","type":"inject","z":"a663bb334b6ef130","name":"disable group \"Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"disable\":[\"Test Group\"]}}","payloadType":"json","x":1370,"y":360,"wires":[["558baa9d92a21c55"]]},{"id":"e6e7f36976810a23","type":"inject","z":"a663bb334b6ef130","name":"disable group \"Test Page:Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"disable\":[\"Test Page:Test Group\"]}}","payloadType":"json","x":1410,"y":440,"wires":[["558baa9d92a21c55"]]},{"id":"e2c354139e9fe358","type":"inject","z":"a663bb334b6ef130","name":"disable group \"0615b1846821cbdf:Test Group\"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"groups\":{\"disable\":[\"0615b1846821cbdf:Test Group\"]}}","payloadType":"json","x":1430,"y":480,"wires":[["558baa9d92a21c55"]]},{"id":"ba0979b23b606ba0","type":"ui-base","name":"My Dashboard","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":true,"notificationDisplayTime":1,"showDisconnectNotification":true},{"id":"accb66f14a9ff4af","type":"ui-group","name":"Test Group","page":"0615b1846821cbdf","width":6,"height":1,"order":1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"0615b1846821cbdf","type":"ui-page","name":"Test Page","ui":"ba0979b23b606ba0","path":"/Test-Page","icon":"home","layout":"grid","theme":"c049776195a75b90","breakpoints":[{"name":"Default","px":"0","cols":"3"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":1,"className":"","visible":"true","disabled":"false"},{"id":"c049776195a75b90","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094CE","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"density":"default","pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}}]

And that "looks" to work fine for multiple input formats:

disable_group

@bartbutenaers
Copy link
Contributor Author

image

Seems the failed test was about enabling/disabling pages (instead of groups).
But I "think" that also still works fine:

disable_page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant