Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@flowfuse/node-red-dashboard

Package Overview
Dependencies
Maintainers
0
Versions
579
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flowfuse/node-red-dashboard - npm Package Compare versions

Comparing version 1.15.1-02b96fb-202408260445.0 to 1.15.1-95f83e6-202408271211.0

69

nodes/widgets/ui_switch.js
const datastore = require('../store/data.js')
const statestore = require('../store/state.js')
const { appendTopic } = require('../utils/index.js')

@@ -17,2 +18,11 @@

// retrieve the assigned on/off values
const on = RED.util.evaluateNodeProperty(config.onvalue, config.onvalueType, node)
const off = RED.util.evaluateNodeProperty(config.offvalue, config.offvalueType, node)
config.evaluated = {
on,
off
}
const evts = {

@@ -22,8 +32,2 @@ // runs on UI interaction

onChange: async function (msg, value) {
// ensure we have latest instance of the widget's node
const wNode = RED.nodes.getNode(node.id)
// retrieve the assigned on/off value
const on = RED.util.evaluateNodeProperty(config.onvalue, config.onvalueType, wNode)
const off = RED.util.evaluateNodeProperty(config.offvalue, config.offvalueType, wNode)
msg.payload = value ? on : off

@@ -36,3 +40,3 @@

if (!config.passthru && config.decouple) {
wNode.send(msg)
node.send(msg)
} else {

@@ -47,3 +51,3 @@ node.status({

// simulate Node-RED node receiving an input
wNode.send(msg)
node.send(msg)
}

@@ -53,9 +57,3 @@ },

let error = null
// ensure we have latest instance of the widget's node
const wNode = RED.nodes.getNode(node.id)
// retrieve the assigned on/off value
const on = RED.util.evaluateNodeProperty(config.onvalue, config.onvalueType, wNode)
const off = RED.util.evaluateNodeProperty(config.offvalue, config.offvalueType, wNode)
if (msg.payload === undefined) {

@@ -108,6 +106,35 @@ // may be setting class dynamically or something else that doesn't require a payload

beforeSend: async function (msg) {
// ensure we have latest instance of the widget's node
const wNode = RED.nodes.getNode(node.id)
const updates = msg.ui_update
if (updates) {
if (typeof updates.label !== 'undefined') {
// dynamically set "label" property
statestore.set(group.getBase(), node, msg, 'label', updates.label)
}
if (typeof updates.passthru !== 'undefined') {
// dynamically set "passthru" property
statestore.set(group.getBase(), node, msg, 'passthru', updates.passthru)
}
if (typeof updates.decouple !== 'undefined') {
// dynamically set "decouple" property
statestore.set(group.getBase(), node, msg, 'decouple', updates.decouple)
}
if (typeof updates.oncolor !== 'undefined') {
// dynamically set "oncolor" property
statestore.set(group.getBase(), node, msg, 'oncolor', updates.oncolor)
}
if (typeof updates.offcolor !== 'undefined') {
// dynamically set "offcolor" property
statestore.set(group.getBase(), node, msg, 'offcolor', updates.offcolor)
}
if (typeof updates.onicon !== 'undefined') {
// dynamically set "onicon" property
statestore.set(group.getBase(), node, msg, 'onicon', updates.onicon)
}
if (typeof updates.officon !== 'undefined') {
// dynamically set "officon" property
statestore.set(group.getBase(), node, msg, 'officon', updates.officon)
}
}
msg = await appendTopic(RED, config, wNode, msg)
msg = await appendTopic(RED, config, node, msg)
return msg

@@ -117,10 +144,2 @@ }

const on = RED.util.evaluateNodeProperty(config.onvalue, config.onvalueType, node)
const off = RED.util.evaluateNodeProperty(config.offvalue, config.offvalueType, node)
config.evaluated = {
on,
off
}
// inform the dashboard UI that we are adding this node

@@ -127,0 +146,0 @@ group.register(node, config, evts)

{
"name": "@flowfuse/node-red-dashboard",
"version": "1.15.1-02b96fb-202408260445.0",
"version": "1.15.1-95f83e6-202408271211.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": [

@@ -5,8 +5,2 @@ # Node-RED Dashboard 2.0

## Motivation
The original [Node-RED Dashboard](https://github.com/node-red/node-red-dashboard) has served us well for many years, providing an intuitive way to create live dashboards for Node-RED flows. However, the original Dashboard is based on Angular v1, which is no longer actively maintained. We identified the need for a secure, updated, and innovative successor.
Node-RED Dashboard 2.0 was re-built from the ground up, learning from the popular features and feedback of Node-RED Dashboard 1.0. It will carry the legacy forward, adapting to future needs while keeping the essence of open-source and community-driven development intact. The project will is licensed under Apache 2.0.
## Installation

@@ -75,4 +69,10 @@

## Motivation
The original [Node-RED Dashboard](https://github.com/node-red/node-red-dashboard) has served us well for many years, providing an intuitive way to create live dashboards for Node-RED flows. However, the original Dashboard is based on Angular v1, which is no longer actively maintained. We identified the need for a secure, updated, and innovative successor.
Node-RED Dashboard 2.0 was re-built from the ground up, learning from the popular features and feedback of Node-RED Dashboard 1.0. It will carry the legacy forward, adapting to future needs while keeping the essence of open-source and community-driven development intact. The project will is licensed under Apache 2.0.
## License
Apache License 2.0

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc