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-dropdown - Not parsing options when widget is reload based on message widget-load #1022

Open
arturv2000 opened this issue Jun 24, 2024 · 1 comment
Labels
bug Something isn't working needs-triage Needs looking at to decide what to do

Comments

@arturv2000
Copy link
Contributor

Current Behavior

The Widget ui-dropdown no longer accepts/parse the options part of the message that receives when it is loaded widget-load

Was working at least in V1.8.1.

It seems that the function:

Should not only call the select , but it seems to be more practical to call onDynamicProperties to reload the proprieties/options/payload for this widget.

Expected Behavior

Options should load on widget load based on the last message.

Steps To Reproduce

Small example:

[{"id":"ea3e5bce236e8acb","type":"inject","z":"08258208cc944d94","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":390,"y":620,"wires":[["15f02d9187400bf7"]]},{"id":"15f02d9187400bf7","type":"function","z":"08258208cc944d94","name":"function 49","func":"msg.payload = '-1';\nmsg.options = [];\n\nmsg.options.push({ value: '-1', label: `Unknown`});\nmsg.options.push({ value: '0', label: 'None' });\nmsg.options.push({ value: '1', label: '1' });\nmsg.options.push({ value: '2', label: '2' });\nmsg.options.push({ value: '3', label: '3'});\n\nreturn msg;\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":620,"wires":[["3a7b3ff5da2f3d2a"]]},{"id":"3a7b3ff5da2f3d2a","type":"ui-dropdown","z":"08258208cc944d94","group":"b23855b34abcb2f9","name":"","label":"Select Option:","tooltip":"","order":0,"width":0,"height":0,"passthru":false,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"topic","topicType":"msg","className":"","x":760,"y":620,"wires":[[]]},{"id":"b23855b34abcb2f9","type":"ui-group","name":"My Group","page":"8a2139abc63ea4cd","width":"6","height":"1","order":-1,"showTitle":true,"className":"","visible":"true","disabled":"false"},{"id":"8a2139abc63ea4cd","type":"ui-page","name":"Page N","ui":"9df4836d2f5c3db3","path":"/pageN1","icon":"home","layout":"flex","theme":"6abc079232f2e7a5","order":-1,"className":"","visible":"true","disabled":"false"},{"id":"9df4836d2f5c3db3","type":"ui-base","name":"My Dashboard","path":"/dashboard","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"navigationStyle":"default"},{"id":"6abc079232f2e7a5","type":"ui-theme","name":"Default Theme","colors":{"surface":"#097479","primary":"#097479","bgPage":"#111111","groupBg":"#333333","groupOutline":"#cccccc"},"sizes":{"pagePadding":"6px","groupGap":"6px","groupBorderRadius":"4px","widgetGap":"6px"}}]

After selecting the value on the dropdown, force a page refresh.

Environment

  • Dashboard version: v1.12.1
  • Node-RED version: 4.0.0
  • Node.js version:
  • npm version:
  • Platform/OS:
  • Browser:

Have you provided an initial effort estimate for this issue?

I am not a FlowFuse team member

@arturv2000 arturv2000 added bug Something isn't working needs-triage Needs looking at to decide what to do labels Jun 24, 2024
@arturv2000
Copy link
Contributor Author

Is the change from

onLoad (msg) {
            // update vuex store to reflect server-state
            this.$store.commit('data/bind', {
                widgetId: this.id,
                msg
            })
            this.select(this.messages[this.id]?.payload)
        },

to

onLoad (msg) {
            // update vuex store to reflect server-state
            this.$store.commit('data/bind', {
                widgetId: this.id,
                msg
            })
            // this.select(this.messages[this.id]?.payload)
            this.onDynamicProperties(msg)
        },

A valid option?

It it is, I can create a PR with this change to close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Needs looking at to decide what to do
Projects
None yet
Development

No branches or pull requests

1 participant