Skip to content

Fix select radio true or 0 #1629

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

Merged
merged 1 commit into from
Apr 2, 2025

Conversation

bartbutenaers
Copy link
Contributor

@bartbutenaers bartbutenaers commented Mar 14, 2025

Description

When a false or 0 are being injected, the corresponding radio button won't be selected.

Example flow:

[{"id":"e0105bcf3af92b99","type":"ui-radio-group","z":"5d03484c007ac7f6","group":"5bde3fe84abbcbaf","name":"","label":"Select Option:","order":0,"width":0,"height":0,"columns":1,"passthru":true,"options":[{"label":"Off","value":0,"type":"num"},{"label":"Low","value":1,"type":"num"},{"label":"High","value":2,"type":"num"}],"payload":"","topic":"topic","topicType":"msg","className":"","x":460,"y":940,"wires":[["34f607209e25f895"]]},{"id":"34f607209e25f895","type":"debug","z":"5d03484c007ac7f6","name":"debug 6","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":640,"y":940,"wires":[]},{"id":"411da9aa0484ed94","type":"inject","z":"5d03484c007ac7f6","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":250,"y":940,"wires":[["e0105bcf3af92b99"]]},{"id":"ce04fd252b609a4f","type":"inject","z":"5d03484c007ac7f6","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":250,"y":980,"wires":[["e0105bcf3af92b99"]]},{"id":"7b195dd7d0f74a10","type":"inject","z":"5d03484c007ac7f6","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":250,"y":1020,"wires":[["e0105bcf3af92b99"]]},{"id":"1398ec7fc375a710","type":"ui-radio-group","z":"5d03484c007ac7f6","group":"5bde3fe84abbcbaf","name":"","label":"Select Option:","order":0,"width":0,"height":0,"columns":1,"passthru":true,"options":[{"label":"True","value":true,"type":"bool"},{"label":"False","value":false,"type":"bool"}],"payload":"","topic":"topic","topicType":"msg","className":"","x":460,"y":1140,"wires":[["5d97a63bcc4cad76"]]},{"id":"5d97a63bcc4cad76","type":"debug","z":"5d03484c007ac7f6","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":640,"y":1140,"wires":[]},{"id":"bc9f537362a9f75a","type":"inject","z":"5d03484c007ac7f6","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":250,"y":1140,"wires":[["1398ec7fc375a710"]]},{"id":"e3c1dd31ac3394d0","type":"inject","z":"5d03484c007ac7f6","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":250,"y":1180,"wires":[["1398ec7fc375a710"]]},{"id":"0de51ac814c7874f","type":"inject","z":"5d03484c007ac7f6","name":"Clear","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":250,"y":1220,"wires":[["1398ec7fc375a710"]]},{"id":"d1592ff11973f25c","type":"inject","z":"5d03484c007ac7f6","name":"Clear","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":250,"y":1060,"wires":[["e0105bcf3af92b99"]]},{"id":"5bde3fe84abbcbaf","type":"ui-group","name":"DIVERT SETTINGS","page":"aa252e1357c80c3d","width":"6","height":"1","order":1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"aa252e1357c80c3d","type":"ui-page","name":"PV Divert Settings","ui":"ba0979b23b606ba0","path":"/page22","icon":"home","layout":"grid","theme":"dd49ca461bb3be9b","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":2,"className":"","visible":"true","disabled":"false"},{"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":"dd49ca461bb3be9b","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"}}]

dashboard_radio_select

Note that the empty string (for cleaning the selection) still works.

Related Issue(s)

Closes #1628

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

@joepavitt joepavitt merged commit 0a37d06 into FlowFuse:main Apr 2, 2025
1 of 2 checks passed
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.

Passing Radio Group a 'zero' value has no effect
2 participants