Skip to content

Commit

Permalink
Merge pull request #1 from FlowFuse/main
Browse files Browse the repository at this point in the history
resync fork
  • Loading branch information
bartbutenaers authored Jan 11, 2025
2 parents d27fd37 + b1874f8 commit 0d24e9d
Show file tree
Hide file tree
Showing 32 changed files with 213 additions and 120 deletions.
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
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"
}
}
]
]
4 changes: 2 additions & 2 deletions docs/examples/chart-histogram-bins.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "icon",
"titleBarStyle": "default"
},
Expand All @@ -153,4 +153,4 @@
"widgetGap": "12px"
}
}
]
]
4 changes: 2 additions & 2 deletions docs/examples/chart-histogram-categories.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "icon",
"titleBarStyle": "default"
},
Expand All @@ -347,4 +347,4 @@
"widgetGap": "12px"
}
}
]
]
4 changes: 2 additions & 2 deletions docs/examples/chart-histogram-series.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "icon",
"titleBarStyle": "default"
},
Expand All @@ -205,4 +205,4 @@
"widgetGap": "12px"
}
}
]
]
4 changes: 2 additions & 2 deletions docs/examples/chart-line-multiple.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "icon",
"titleBarStyle": "default"
},
Expand All @@ -199,4 +199,4 @@
"widgetGap": "12px"
}
}
]
]
4 changes: 2 additions & 2 deletions docs/examples/chart-line-timestamp.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "icon",
"titleBarStyle": "default"
},
Expand All @@ -185,4 +185,4 @@
"widgetGap": "12px"
}
}
]
]
4 changes: 2 additions & 2 deletions docs/examples/chart-pie-doughnut.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "icon",
"titleBarStyle": "default"
},
Expand All @@ -273,4 +273,4 @@
"widgetGap": "12px"
}
}
]
]
4 changes: 2 additions & 2 deletions docs/examples/chart-scatter-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/group-dialog-type.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "icon",
"titleBarStyle": "default"
},
Expand Down Expand Up @@ -212,4 +212,4 @@
"density": "default"
}
}
]
]
4 changes: 2 additions & 2 deletions docs/examples/ui-button-hold.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "icon",
"titleBarStyle": "default"
},
Expand All @@ -260,4 +260,4 @@
"density": "default"
}
}
]
]
4 changes: 2 additions & 2 deletions docs/examples/ui-text-suffix.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"ui-notification"
],
"showPathInSidebar": false,
"showPageTitle": false,
"headerContent": "none",
"navigationStyle": "default",
"titleBarStyle": "default"
},
Expand All @@ -131,4 +131,4 @@
"widgetGap": "6px"
}
}
]
]
2 changes: 1 addition & 1 deletion docs/nodes/widgets/ui-button-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ props:
Appearance: Specify whether the shape of the widget should be rectangular or have rounded corners.
Use theme colors: Specify whether the theme colors should be used. If not active, custom colors can be specified for each option separately.
Options:
description: Specify which options need to be displayed. Each option can specify a label, icon, value and color.
description: Specify which options need to be displayed. Each option can specify a label, icon, value and color. Html content is allowed for the labels.
dynamic: true
Topic: The text that needs to be send in the msg.topic field.
Passthrough: Specify whether input messages should be passed through as output messages.
Expand Down
8 changes: 6 additions & 2 deletions nodes/config/locales/en-US/ui_base.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
"titleBarStyleFixed": "Fixed",
"sidebar": "Sidebar Options",
"showPath": "Include Page Path in Label",
"showPageTitle": "Show Page Name in Header",
"headerContent": "Content",
"headerDashboard": "Dashboard name",
"headerPage": "Page name",
"headerDashboardPage": "Dashboard name (Page name)",
"headerNone": "None",
"navigationStyle": "Style",
"navigationStyleDefault": "Collapsing (default)",
"navigationStyleFixed": "Fixed",
Expand Down Expand Up @@ -63,4 +67,4 @@
"darkest": "var(--nrdb-node-darkest)"
}
}
}
}
1 change: 1 addition & 0 deletions nodes/config/locales/en-US/ui_page.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"icon": "Icon",
"theme": "Theme",
"layout": "Layout",
"editLayout": "Edit Layout",
"grid": "Grid",
"fixed": "Fixed",
"tabs": "Tabs",
Expand Down
Loading

0 comments on commit 0d24e9d

Please sign in to comment.