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

Update to 1.0.22 of dashboard-2 #2

Open
wants to merge 152 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
97db494
Widget Sync - Add new widget-sync event that permits clients to stay …
joepavitt Nov 13, 2024
44dfae8
Update store.save/bind functions to merge rather than replace
joepavitt Nov 13, 2024
1560da9
Update Slider, text Input and Text widgets to remove (now) unnecessar…
joepavitt Nov 13, 2024
9e03f7a
Clean Number Input
joepavitt Nov 13, 2024
fbe4b9c
Clean Button Group
joepavitt Nov 13, 2024
34bf3ad
sanetize target attr fix
bartbutenaers Nov 13, 2024
a7d8268
update edit tracking for widgets resizing/reordering
Steve-Mcl Nov 14, 2024
2bd2297
add widgets resizing/reordering support
Steve-Mcl Nov 14, 2024
9150668
add comments to keep defaults in sync
Steve-Mcl Nov 14, 2024
50df10f
update api for widgets resizing/reordering
Steve-Mcl Nov 14, 2024
3aa8428
update styles for widgets resizing/reordering
Steve-Mcl Nov 14, 2024
031ee68
Merge branch 'main' into widget-wysiwyg
Steve-Mcl Nov 14, 2024
79718da
Improve DX - dont minify dev build
Steve-Mcl Nov 14, 2024
781c359
update contributing docs
Steve-Mcl Nov 14, 2024
36b104d
dynamic ui-template
bartbutenaers Nov 16, 2024
e5ab020
dynamic ui template
bartbutenaers Nov 16, 2024
9988519
dynamic ui-template
bartbutenaers Nov 16, 2024
73fd78a
Force not needed
bartbutenaers Nov 16, 2024
fc0ab3c
restore commit
bartbutenaers Nov 16, 2024
23e339c
dynamic ui-template
bartbutenaers Nov 16, 2024
e92899d
Permit wysiwyg editing add/remove spacers
Steve-Mcl Nov 19, 2024
105b2c4
Merge pull request #1482 from FlowFuse/wysiwyg-add-rem-spacer
Steve-Mcl Nov 19, 2024
33bdf20
Use an aHTTPS Agent and HTTPS scheme if RED.settings.https is set to …
Steve-Mcl Nov 20, 2024
1771bbe
handle async https settings
Steve-Mcl Nov 20, 2024
4bdadb4
Configurable Connection Notifications
cgjgh Nov 20, 2024
f09a6a3
Add optional text field to slider
cgjgh Nov 21, 2024
c1a3741
Add dynamic update test
cgjgh Nov 21, 2024
24521f9
Update Slider Docs
cgjgh Nov 21, 2024
bee0036
Update UISlider.vue
cgjgh Nov 22, 2024
53f222a
Add text field min/max validation tests
cgjgh Nov 22, 2024
13b453b
Add optional text field to slider
cgjgh Nov 21, 2024
85d01f1
Add dynamic update test
cgjgh Nov 21, 2024
de2dd99
Add text field min/max validation tests
cgjgh Nov 22, 2024
9cb1fdf
Update Slider Docs
cgjgh Nov 21, 2024
d898237
Update ui/src/widgets/ui-switch/UISwitch.vue
joepavitt Nov 22, 2024
ae9863a
Update validation tests
cgjgh Nov 22, 2024
7839a24
Merge branch 'Slider-Text-Field' of https://github.com/cgjgh/node-red…
cgjgh Nov 22, 2024
c483184
new ui-audio widget
bartbutenaers Nov 29, 2024
95a9d8a
play src from config
bartbutenaers Nov 29, 2024
2f95a3b
Fix documentation half-word
joepavitt Nov 29, 2024
86d915d
UI Spaceer - typeof undefined
joepavitt Nov 29, 2024
1e92072
Better undefined handlers
joepavitt Nov 29, 2024
73b8dc2
switch no clickable area
bartbutenaers Dec 1, 2024
71de81b
switch all cursors default
bartbutenaers Dec 1, 2024
33ace38
Fix text field not emitting value, not respecting step
cgjgh Dec 1, 2024
bfc95f7
Add tests for text field emit value, slider step validation
cgjgh Dec 1, 2024
aa47069
Merge remote-tracking branch 'upstream/main' into Slider-Text-Field
cgjgh Dec 1, 2024
f75931b
Improve icons & field ordering
joepavitt Dec 2, 2024
80f3543
Use vuex store instead of localstorage
joepavitt Dec 2, 2024
13357b9
Remove console.logs
joepavitt Dec 2, 2024
0079d23
CSS fix
bartbutenaers Dec 2, 2024
ca23b6d
sidebar strikethrough reset fix
bartbutenaers Dec 3, 2024
5cdc339
remove debugger
bartbutenaers Dec 3, 2024
cba6e30
Merge pull request #1471 from FlowFuse/no-dev-minify
joepavitt Dec 4, 2024
4d17baa
Merge pull request #1513 from bartbutenaers/ui-page-visibility-reset-fix
joepavitt Dec 4, 2024
5a3ac99
Merge pull request #1511 from bartbutenaers/ui-switch-clickable-none
joepavitt Dec 4, 2024
e477c5d
Merge pull request #1492 from cgjgh/Slider-Text-Field
joepavitt Dec 4, 2024
9bac4c2
Merge pull request #1490 from cgjgh/UI-Base-Notification-Config
joepavitt Dec 4, 2024
ddf8c9c
Merge branch 'main' into 679-sync-widgets
joepavitt Dec 4, 2024
a437b72
Fix merge conflict
joepavitt Dec 4, 2024
841834e
Update this.value to this.sliderValue after merge
joepavitt Dec 4, 2024
85a9cf1
Merge pull request #1463 from FlowFuse/679-sync-widgets
joepavitt Dec 4, 2024
536952d
Merge branch 'main' into sanetize-href-target-fix
joepavitt Dec 4, 2024
1d1a397
Merge pull request #1466 from bartbutenaers/sanetize-href-target-fix
joepavitt Dec 4, 2024
588de62
v1.20.0
joepavitt Dec 4, 2024
151273e
Merge pull request #1514 from FlowFuse/v1.20.0
joepavitt Dec 4, 2024
eb0438a
cannot play without src
bartbutenaers Dec 4, 2024
ef36b1d
Gauge Tank rendering issue - FF expects styles to be given with leng…
hotNipi Dec 5, 2024
ef7c722
Fix the prefix to use in the input element ids
GogoVega Dec 5, 2024
6674d0d
Merge pull request #1515 from hotNipi/main
joepavitt Dec 6, 2024
af1d14f
Merge pull request #1516 from GogoVega/fix-spacer
joepavitt Dec 6, 2024
0a9d381
Improved styling for handles and widget bordering in edit mode
joepavitt Dec 6, 2024
2e9548c
Add Audio docs to nav sidebar
joepavitt Dec 6, 2024
b9a95a2
Re-order the nodes in the NR Editor
joepavitt Dec 6, 2024
0a51568
Add in CSS for width/height setting, rather than inline HTML attrs
joepavitt Dec 6, 2024
fd37c72
Merge pull request #1475 from bartbutenaers/template-dynamic
joepavitt Dec 6, 2024
987f78d
Add concurrency settings to build and publish workflow
ppawlowski Dec 6, 2024
5f63a6e
Merge pull request #1518 from FlowFuse/ci-publish-concurrency
hardillb Dec 6, 2024
b5cd5f3
click custom switch icon fix
bartbutenaers Dec 7, 2024
ac607c2
switch custom icon not clickable
bartbutenaers Dec 7, 2024
6398e73
Bump flowfuse/github-actions-workflows from 0.37.0 to 0.38.0
dependabot[bot] Dec 9, 2024
e12dcbf
Merge pull request #1523 from bartbutenaers/switch_custom_icon_fix
joepavitt Dec 10, 2024
8746318
Merge branch 'main' into switch-custom-icon-non-clickable
joepavitt Dec 10, 2024
cf43fea
Include pointer-events: none
joepavitt Dec 10, 2024
ea6a54d
notification sanetized style fix
bartbutenaers Dec 10, 2024
a85ce73
Merge pull request #1524 from bartbutenaers/switch-custom-icon-non-cl…
joepavitt Dec 11, 2024
b32cdc3
Merge pull request #1525 from FlowFuse/dependabot/github_actions/flow…
joepavitt Dec 11, 2024
c562a41
Bump nanoid from 3.3.7 to 3.3.8
dependabot[bot] Dec 11, 2024
c992878
typo in comment
bartbutenaers Dec 11, 2024
23e82cd
Merge pull request #1529 from bartbutenaers/notification-injected-css…
joepavitt Dec 11, 2024
87d5b3b
Merge pull request #1530 from FlowFuse/dependabot/npm_and_yarn/nanoid…
hardillb Dec 12, 2024
8397cbd
Bump express to pick up path-to-regex
hardillb Dec 12, 2024
c492bc0
add fix for client data with multiple outputs
luisthieme Dec 12, 2024
0fd297e
Merge pull request #1531 from FlowFuse/bump-express
Steve-Mcl Dec 12, 2024
e1652cf
v1.20.1
joepavitt Dec 13, 2024
2d3d2a9
Merge pull request #1535 from FlowFuse/v1.20.1
Steve-Mcl Dec 13, 2024
c1b8f20
fix slider widths
Steve-Mcl Dec 13, 2024
cb0f1df
fix group widget widths
Steve-Mcl Dec 13, 2024
281e3c2
Merge pull request #1488 from FlowFuse/1480-https-editing
Steve-Mcl Dec 13, 2024
e410fba
fix handbook link
Steve-Mcl Dec 13, 2024
6a1f164
Merge pull request #1537 from FlowFuse/Steve-Mcl-patch-1
Steve-Mcl Dec 13, 2024
9d52ea9
Merge pull request #1469 from FlowFuse/widget-wysiwyg
joepavitt Dec 13, 2024
a0c4941
Merge pull request #1506 from bartbutenaers/ui-audio-widget
joepavitt Dec 13, 2024
fa255c0
Merge remote-tracking branch 'origin/main' into 1294-data-storage
joepavitt Dec 16, 2024
bb7363a
Allow RED.settings.ui as fallback settings for size
hardillb Dec 17, 2024
c9e45ff
Merge pull request #1540 from FlowFuse/hardillb-patch-1
Steve-Mcl Dec 18, 2024
357ebba
Merge pull request #1465 from FlowFuse/1294-data-storage
Steve-Mcl Dec 18, 2024
7c47522
Merge commit 'refs/pull/1533/head' of github.com:FlowFuse/node-red-da…
Steve-Mcl Dec 18, 2024
f99d34f
linting fixes
Steve-Mcl Dec 18, 2024
abf3130
Merge pull request #1542 from FlowFuse/fix-for-fix-client-data-for-mu…
joepavitt Dec 18, 2024
14da347
prevent exceptions rendering empty table
Steve-Mcl Dec 19, 2024
3de169c
only use props.width/height in group layout css
Steve-Mcl Dec 19, 2024
8197214
Merge pull request #1546 from FlowFuse/pre-release-niggles
Steve-Mcl Dec 20, 2024
e495ed7
bump for release
Steve-Mcl Dec 20, 2024
d79bf6e
Merge pull request #1547 from FlowFuse/bump_1_21_0
Steve-Mcl Dec 20, 2024
beab2aa
Update ui-audio doc
Steve-Mcl Dec 20, 2024
d29cffc
Update ui-audio.md
Steve-Mcl Dec 20, 2024
d27fd37
Merge pull request #1548 from FlowFuse/Steve-Mcl-patch-1
Steve-Mcl Dec 20, 2024
6c13efc
selectable header content
bartbutenaers Dec 20, 2024
c3b1976
Revert change
bartbutenaers Dec 20, 2024
8a14562
select first tab after navigation
bartbutenaers Dec 21, 2024
b7de15d
dropdown msg.options info fix
bartbutenaers Dec 22, 2024
ed9d9b2
Sidebar 'add group' missing
bartbutenaers Dec 22, 2024
fbc2020
Merge pull request #1552 from bartbutenaers/select-first-tab
joepavitt Dec 23, 2024
b820289
Change the browser tab title to match the page title
joepavitt Dec 23, 2024
c450bf4
Merge pull request #1555 from bartbutenaers/dropdown-options-info-fix
joepavitt Dec 23, 2024
5829d5a
Merge pull request #1556 from bartbutenaers/sidebar-add-group-missing
joepavitt Dec 23, 2024
6e66c17
Merge pull request #1551 from bartbutenaers/selectable-header-content
joepavitt Dec 23, 2024
bed3138
Add Time Picker Lab Component
cgjgh Jan 1, 2025
1b1e420
buttongroup html option labels
bartbutenaers Jan 7, 2025
2c21492
lint fixes
bartbutenaers Jan 7, 2025
c72347a
ui-page layout editor button
bartbutenaers Jan 9, 2025
2ebcf0b
ui-dropdown sync issue
bartbutenaers Jan 9, 2025
db4f99c
lint fixes
bartbutenaers Jan 9, 2025
58406e9
Layout does not edit the `ui-spacer` node with `editConfig`
GogoVega Jan 9, 2025
1d95f57
ui-switch sync issue
bartbutenaers Jan 9, 2025
b74b055
ui-page: align layout edit button
bartbutenaers Jan 9, 2025
f317921
Only show tooltip value if > 0 in a stacked bar chart
joepavitt Jan 10, 2025
69faee5
Merge pull request #1572 from bartbutenaers/ui-switch-sync-issue
joepavitt Jan 10, 2025
11c4f0a
Merge pull request #1570 from bartbutenaers/ui-dropdown-sync-issue
joepavitt Jan 10, 2025
96cd5c0
Add "Edit Layout" text to the button & fix linting error
joepavitt Jan 10, 2025
2f63593
Merge remote-tracking branch 'origin/main' into ui-page-selectable-fl…
joepavitt Jan 10, 2025
f83430d
Fix "+ group" showing on groups as well
joepavitt Jan 10, 2025
a4ef6a5
Merge pull request #1568 from bartbutenaers/ui-page-selectable-flex-l…
joepavitt Jan 10, 2025
8cef180
Merge remote-tracking branch 'origin/main' into fix-ui-spacer-layout
joepavitt Jan 10, 2025
6433973
Fix tray for new spacers too
joepavitt Jan 10, 2025
5dc8466
Merge pull request #1571 from GogoVega/fix-ui-spacer-layout
joepavitt Jan 10, 2025
319010d
Merge pull request #1567 from bartbutenaers/buttongroup-options-html-…
joepavitt Jan 10, 2025
237b40c
Merge pull request #1565 from cgjgh/Vuetify-Time-Picker
joepavitt Jan 10, 2025
a39d576
Merge pull request #1573 from FlowFuse/bar-tooltip-0
Steve-Mcl Jan 10, 2025
ea2c244
v1.22.0 Version Bump
joepavitt Jan 10, 2025
b1874f8
Merge pull request #1574 from FlowFuse/v1.22.0
joepavitt Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ body:
id: estimation
attributes:
label: Have you provided an initial effort estimate for this issue?
description: See our [handbook](https://flowfuse.com/handbook/development/releases/planning/#effort-estimation) for more details.
description: See our [handbook](https://flowfuse.com/handbook/development/project-management/#sizing-issues) for more details.
multiple: false
options:
- I have provided an initial effort estimate
- I am not a FlowFuse team member
- I can not provide an initial effort estimate
validations:
required: true
required: true
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request:
jobs:
build:
uses: 'flowfuse/github-actions-workflows/.github/workflows/build_node_package.yml@v0.37.0'
uses: 'flowfuse/github-actions-workflows/.github/workflows/build_node_package.yml@v0.38.0'
with:
node: '[
{"version": "18", "tests": true, "lint": true},
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/publish-private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
uses: 'flowfuse/github-actions-workflows/.github/workflows/build_node_package.yml@v0.37.0'
uses: 'flowfuse/github-actions-workflows/.github/workflows/build_node_package.yml@v0.38.0'
with:
node: '[
{"version": "18", "tests": true, "lint": true},
Expand All @@ -16,7 +20,7 @@ jobs:
needs: build
if: |
github.ref == 'refs/heads/main'
uses: 'flowfuse/github-actions-workflows/.github/workflows/publish_node_package.yml@v0.37.0'
uses: 'flowfuse/github-actions-workflows/.github/workflows/publish_node_package.yml@v0.38.0'
with:
package_name: node-red-dashboard
publish_package: true
Expand Down
144 changes: 144 additions & 0 deletions cypress/fixtures/flows/dashboard-slider.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,5 +329,149 @@
"dashboard-ui-slider"
]
]
},
{
"id": "dashboard-ui-button-dynamic-textfield",
"type": "ui-button",
"z": "node-red-tab-slider",
"group": "dashboard-ui-group",
"name": "Show Text Field",
"label": "Show Text Field",
"order": 0,
"width": 0,
"height": 0,
"emulateClick": false,
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"iconPosition": "left",
"payload": "",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"buttonColor": "",
"textColor": "",
"iconColor": "",
"enableClick": true,
"enablePointerdown": false,
"pointerdownPayload": "",
"pointerdownPayloadType": "str",
"enablePointerup": false,
"pointerupPayload": "",
"pointerupPayloadType": "str",
"x": 180,
"y": 280,
"wires": [
[
"dashboard-ui-set-property-textfield"
]
]
},
{
"id": "dashboard-ui-set-property-textfield",
"type": "change",
"z": "node-red-tab-slider",
"name": "",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "delete",
"p": "topic",
"pt": "msg"
},
{
"t": "set",
"p": "ui_update.showTextField",
"pt": "msg",
"to": "true",
"tot": "bool"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 380,
"y": 280,
"wires": [
[
"dashboard-ui-slider"
]
]
},
{
"id": "dashboard-ui-set-property-step",
"type": "change",
"z": "node-red-tab-slider",
"name": "",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "delete",
"p": "topic",
"pt": "msg"
},
{
"t": "set",
"p": "msg.ui_update.step",
"pt": "msg",
"to": "2",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 380,
"y": 320,
"wires": [["dashboard-ui-slider"]]
},
{
"id": "dashboard-ui-button-dynamic-step",
"type": "ui-button",
"z": "node-red-tab-slider",
"group": "dashboard-ui-group",
"name": "Set Step",
"label": "Set Step",
"order": 0,
"width": 0,
"height": 0,
"emulateClick": false,
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"iconPosition": "left",
"payload": "",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"buttonColor": "",
"textColor": "",
"iconColor": "",
"enableClick": true,
"enablePointerdown": false,
"pointerdownPayload": "",
"pointerdownPayloadType": "str",
"enablePointerup": false,
"pointerupPayload": "",
"pointerupPayloadType": "str",
"x": 160,
"y": 320,
"wires": [["dashboard-ui-set-property-step"]]
}
]
59 changes: 59 additions & 0 deletions cypress/tests/widgets/slider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,63 @@ describe('Node-RED Dashboard 2.0 - Slider (Dynamic Properties)', () => {
// check the min value is updated
cy.get('#nrdb-ui-widget-dashboard-ui-slider').find('.v-slider-thumb').should('have.attr', 'aria-valuemax', '50')
})
it('include "showTextField"', () => {
// First, check that the text field does not exist
cy.get('#nrdb-ui-widget-dashboard-ui-slider').within(() => { cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field').should('not.exist') })
cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-button-dynamic-textfield'))
// Check if the text field is present when showTextField is true
cy.get('#nrdb-ui-widget-dashboard-ui-slider').within(() => { cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field').should('exist') })
})
})

describe('Node-RED Dashboard 2.0 - Slider (Text Field Input)', () => {
beforeEach(() => {
cy.deployFixture('dashboard-slider')
cy.visit('/dashboard/page1')
})

it('text field emits a value on blur', () => {
cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field'), 200)
// then we can type into the input
cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field').type('{selectall}{del}40')
cy.focused().blur()
cy.checkOutput('msg.payload', 40)
})

it('text field validation for max value', () => {
// Extract the max value from the slider thumb and store it in a variable
// eslint-disable-next-line promise/always-return, promise/catch-or-return
cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field').invoke('attr', 'max').then((maxValue) => {
const greaterThanMaxValue = parseInt(maxValue) + 10
cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field'), 200)
// then we can type into the input
cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field').type(`{selectall}{del}${greaterThanMaxValue}`)
cy.focused().blur()
cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field').should('have.value', maxValue)
})
})
it('text field validation for min value', () => {
// Extract the min value from the slider thumb and store it in a variable
// eslint-disable-next-line promise/catch-or-return, promise/always-return
cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field').invoke('attr', 'min').then((minValue) => {
const lessThanMinValue = parseInt(minValue) - 20
cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field'), 200)
// then we can type into the input
cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field').type(`{selectall}{del}${lessThanMinValue}`)
cy.focused().blur()
cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field').should('have.value', minValue)
})
})

it('text field rounds input to nearest step', () => {
// eslint-disable-next-line promise/catch-or-return, promise/always-return

cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-button-dynamic-step'))

cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field'), 200)
// then we can type into the input
cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field').type('{selectall}{del}27')
cy.focused().blur()
cy.get('#nrdb-ui-widget-dashboard-ui-slider-text-field').should('have.value', 28)
})
})
1 change: 1 addition & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default ({ mode }) => {
text: 'Widgets',
collapsed: false,
items: [
{ text: 'ui-audio', link: '/nodes/widgets/ui-audio' },
{ text: 'ui-button', link: '/nodes/widgets/ui-button' },
{ text: 'ui-button-group', link: '/nodes/widgets/ui-button-group' },
{ text: 'ui-control', link: '/nodes/widgets/ui-control' },
Expand Down
Binary file modified docs/assets/images/events-arch-client-events.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions docs/contributing/guides/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ Some examples of events that are emitted from the Dashboard to Node-RED include:
- `widget-action` - When a user interacts with a widget, and state of the widget is not important, e.g. a button click
- `widget-send` - Used by `ui-template` to send a custom `msg` object, e.g. `send(msg)`, which will be stored in the server-side data store.

#### Syncing Widgets

The `widget-change` event is used to emit input from the server, and represents a change of state for that widget, e.g. a switch can be on/off by a user clicking it. In this case, if you have multiple clients connected to the same Node-RED instance, Dashboard will ensure that clients are in-sync when values change.

For Example if you move a slider on one instance of the Dashboard, all sliders connected will also auto-update.

To disable this "single source of truth" design pattern, you can check the widget type in the ["Client Data"](../../user/multi-tenancy#configuring-client-data) tab of the Dashboard settings.

## Events List

This is a comprehensive list of all events that are sent between Node-RED and the Dashboard via socket.io.
Expand Down Expand Up @@ -100,6 +108,11 @@ and the `widget-change` received a new value of `40`, then the newly emitted mes

Any value received here will also be stored against the widget in the datastore.

### `widget-sync`
- Payload: `<msg>`

Triggered from the server-side `onChange` handler. This send a message out to all connected clients and informs relevant widgets of state/value changes. For example, when a slider is moved, the `widget-sync` message will ensure all connected clients, and their respective slider, are updated with the new value.

### `widget-action`
- ID: `<node-id>`
- Payload: `<msg>`
Expand Down
11 changes: 9 additions & 2 deletions docs/contributing/guides/registration.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ Similar to `onAction`, when used as a boolean, this flag will trigger the defaul
2. Appends any `msg.topic` defined on the node config
3. Runs `evts.beforeSend()` _(if provided)_
4. Store the most recent message on the widget under the `._msg` property which will contain the latest state/value of the widget
5. Sends the `msg` onwards to any connected nodes
5. Pushes a `widget-sync` event to synchronize the widgets in all clients.
6. Sends the `msg` onwards to any connected nodes

#### Custom `onChange` Handler

Expand All @@ -111,8 +112,10 @@ Alternatively, you can override this default behaviour by providing a custom `on
* Handle the input from the widget
* @param {object} msg - the last known msg received (prior to this new value)
* @param {boolean} value - the updated value sent by the widget
* @param {Socket} conn - socket.io socket connecting to the server
* @param {String} id - widget id sending the action
*/
onChange: async function (msg, value) {
onChange: async function (msg, value, conn, id) {
// ensure we have latest instance of the widget's node
const wNode = RED.nodes.getNode(node.id)

Expand All @@ -127,6 +130,10 @@ onChange: async function (msg, value) {
const off = RED.util.evaluateNodeProperty(config.offvalue, config.offvalueType, wNode)
msg.payload = value ? on : off

// sync this change to all clients with the same widget
const exclude = [conn.id]
base.emit('widget-sync:' + id, msg, node, exclude)

// simulate Node-RED node receiving an input
wNode.send(msg)
}
Expand Down
2 changes: 2 additions & 0 deletions docs/contributing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ A [VitePress](https://vitepress.dev/) documentation site that is used to generat
```bash
npm run build
```
Alternatively, use `npm run build:dev` to build a developer version or use `npm run dev` to build a developer version and watch for changes (hot reload)


### Install into Node-RED

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/chart-bar-election-grouped.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "icon",
"titleBarStyle": "default"
},
Expand All @@ -166,4 +166,4 @@
"widgetGap": "12px"
}
}
]
]
4 changes: 2 additions & 2 deletions docs/examples/chart-bar-finance-grouped.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "icon",
"titleBarStyle": "default"
},
Expand All @@ -166,4 +166,4 @@
"widgetGap": "12px"
}
}
]
]
4 changes: 2 additions & 2 deletions docs/examples/chart-bar-sw-characters.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "icon",
"titleBarStyle": "default"
},
Expand All @@ -229,4 +229,4 @@
"widgetGap": "12px"
}
}
]
]
Loading