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

Clear dropdown selection fix #775

Merged
merged 1 commit into from
Apr 18, 2024
Merged

Conversation

bartbutenaers
Copy link
Contributor

@bartbutenaers bartbutenaers commented Apr 16, 2024

Description

According to the documentation, the current selection in ui-dropdown should be cleared when msg.payload = [].
However when "Allow Multiple" is deselected in the node's config screen, then the selection is not cleared.

This PR fixes that:

clear_dropdown

[{"id":"79e59c62a86947fc","type":"ui-dropdown","z":"f624e6564f974a57","group":"65805ec358e05ea4","name":"Single select option","label":"Select Option:","tooltip":"","order":0,"width":0,"height":0,"passthru":false,"multiple":false,"options":[{"label":"Option A","value":"A","type":"str"},{"label":"Option B","value":"B","type":"str"},{"label":"Option C","value":"C","type":"str"}],"payload":"","topic":"topic","topicType":"msg","className":"","x":810,"y":340,"wires":[[]]},{"id":"adad1a977d52d7ee","type":"inject","z":"f624e6564f974a57","name":"Select B","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"B\"]","payloadType":"json","x":600,"y":340,"wires":[["79e59c62a86947fc"]]},{"id":"90f3b037c32b470f","type":"inject","z":"f624e6564f974a57","name":"Clear","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[]","payloadType":"json","x":610,"y":380,"wires":[["79e59c62a86947fc"]]},{"id":"184aa25927b97082","type":"ui-dropdown","z":"f624e6564f974a57","group":"65805ec358e05ea4","name":"Multi select option","label":"Select Option:","tooltip":"","order":0,"width":0,"height":0,"passthru":false,"multiple":true,"options":[{"label":"Option A","value":"A","type":"str"},{"label":"Option B","value":"B","type":"str"},{"label":"Option C","value":"C","type":"str"}],"payload":"","topic":"topic","topicType":"msg","className":"","x":810,"y":460,"wires":[[]]},{"id":"d5b1176aa3646600","type":"inject","z":"f624e6564f974a57","name":"Select B","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"B\"]","payloadType":"json","x":600,"y":460,"wires":[["184aa25927b97082"]]},{"id":"c8b98416094457e6","type":"inject","z":"f624e6564f974a57","name":"Clear","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[]","payloadType":"json","x":610,"y":500,"wires":[["184aa25927b97082"]]},{"id":"65805ec358e05ea4","type":"ui-group","name":"Heatmap demo","page":"0a90f52e8742b298","width":"10","height":"10","order":-1,"showTitle":true,"className":"","visible":"true","disabled":"false"},{"id":"0a90f52e8742b298","type":"ui-page","name":"Heatmap","ui":"be29745a6e568f30","path":"/page2","icon":"home","layout":"grid","theme":"092547d34959327c","order":-1,"className":"","visible":"true","disabled":"false"},{"id":"be29745a6e568f30","type":"ui-base","name":"UI Name","path":"/dashboard","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false},{"id":"092547d34959327c","type":"ui-theme","name":"Theme Name","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"}}]

Related Issue(s)

Closes #756

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

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

@bartbutenaers
Copy link
Contributor Author

Not quite sure in what way the 2 failed tests (form & control) could be related to my change ;-(

@joepavitt joepavitt merged commit 87981b4 into FlowFuse:main Apr 18, 2024
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.

ui-dropdown doesn't clear selection with msg.payload = []
2 participants