@flowfuse/node-red-dashboard
Advanced tools
Comparing version 1.20.1-af1d14f-202412061320.0 to 1.20.1-fd37c72-202412061413.0
@@ -0,1 +1,3 @@ | ||
const statestore = require('../store/state.js') | ||
module.exports = function (RED) { | ||
@@ -8,6 +10,2 @@ function TemplateNode (config) { | ||
const evts = { | ||
onAction: true // TODO: think we need an onSend event for template nodes that matches up with a `widget-send` message | ||
} | ||
if (config.templateScope === 'local') { | ||
@@ -35,14 +33,33 @@ config.page = '' | ||
// which group are we rendering this widget | ||
// determine which group/page/ui are we rendering this widget | ||
let group, page, ui | ||
if (config.group) { | ||
const group = RED.nodes.getNode(config.group) | ||
// inform the dashboard UI that we are adding this node | ||
group = RED.nodes.getNode(config.group) | ||
} else if (config.page) { | ||
page = RED.nodes.getNode(config.page) | ||
} else if (config.ui) { | ||
ui = RED.nodes.getNode(config.ui) | ||
} | ||
const evts = { | ||
onAction: true, // TODO: think we need an onSend event for template nodes that matches up with a `widget-send` message | ||
beforeSend: function (msg) { | ||
if (msg.ui_update) { | ||
const update = msg.ui_update | ||
if (typeof update.format !== 'undefined') { | ||
// dynamically set "format" property | ||
const parent = group || page || ui | ||
statestore.set(parent.getBase(), node, msg, 'format', update.format) | ||
} | ||
} | ||
return msg | ||
} | ||
} | ||
// inform the dashboard group/page/ui that we are adding this node | ||
if (group) { | ||
group.register(node, config, evts) | ||
} else if (config.page) { | ||
const page = RED.nodes.getNode(config.page) | ||
// inform the dashboard UI that we are adding this node | ||
} else if (page) { | ||
page.register(null, node, config, evts) | ||
} else if (config.ui) { | ||
const ui = RED.nodes.getNode(config.ui) | ||
// inform the dashboard UI that we are adding this node | ||
} else if (ui) { | ||
ui.register(null, null, node, config, evts) | ||
@@ -49,0 +66,0 @@ } |
{ | ||
"name": "@flowfuse/node-red-dashboard", | ||
"version": "1.20.1-af1d14f-202412061320.0", | ||
"version": "1.20.1-fd37c72-202412061413.0", | ||
"description": "Dashboard 2.0 - A collection of Node-RED nodes that provide functionality to build your own UI applications (inc. forms, buttons, charts).", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
697289
3828