@node-red/nodes
Advanced tools
Comparing version 3.0.0-beta.4 to 3.0.0
@@ -32,19 +32,19 @@ /** | ||
const targetCache = (function () { | ||
const registry = { id: {}, name: {} }; | ||
function getIndex(/** @type {[LinkTarget]}*/ targets, id) { | ||
let registry = { id: {}, name: {} } | ||
function getIndex (/** @type {[LinkTarget]} */ targets, id) { | ||
for (let index = 0; index < (targets || []).length; index++) { | ||
const element = targets[index]; | ||
const element = targets[index] | ||
if (element.id === id) { | ||
return index; | ||
return index | ||
} | ||
} | ||
return -1; | ||
return -1 | ||
} | ||
/** | ||
* Generate a target object from a node | ||
* @param {LinkInNode} node | ||
* @param {LinkInNode} node | ||
* @returns {LinkTarget} a link target object | ||
*/ | ||
function generateTarget(node) { | ||
const isSubFlow = node._flow.TYPE === "subflow"; | ||
function generateTarget (node) { | ||
const isSubFlow = node._flow.TYPE === 'subflow' | ||
return { | ||
@@ -62,11 +62,11 @@ id: node.id, | ||
* @param {string} name Name of the target | ||
* @param {boolean} [excludeSubflows] set `true` to exclude | ||
* @param {boolean} [excludeSubflows] set `true` to exclude | ||
* @returns {[LinkTarget]} Targets registerd to this name. | ||
*/ | ||
getTargets(name, excludeSubflows) { | ||
const targets = registry.name[name] || []; | ||
getTargets (name, excludeSubflows) { | ||
const targets = registry.name[name] || [] | ||
if (excludeSubflows) { | ||
return targets.filter(e => e.isSubFlow != true); | ||
return targets.filter(e => e.isSubFlow !== true) | ||
} | ||
return targets; | ||
return targets | ||
}, | ||
@@ -78,17 +78,17 @@ /** | ||
* @param {string} name Name of the node | ||
* @param {string} [flowId] | ||
* @param {string} [flowId] | ||
* @returns {LinkTarget} target | ||
*/ | ||
getTarget(name, flowId) { | ||
/** @type {[LinkTarget]}*/ | ||
let possibleTargets = this.getTargets(name); | ||
/** @type {LinkTarget}*/ | ||
let target; | ||
getTarget (name, flowId) { | ||
/** @type {[LinkTarget]} */ | ||
let possibleTargets = this.getTargets(name) | ||
/** @type {LinkTarget} */ | ||
let target | ||
if (possibleTargets.length && flowId) { | ||
possibleTargets = possibleTargets.filter(e => e.flowId == flowId); | ||
possibleTargets = possibleTargets.filter(e => e.flowId === flowId) | ||
} | ||
if (possibleTargets.length === 1) { | ||
target = possibleTargets[0]; | ||
target = possibleTargets[0] | ||
} | ||
return target; | ||
return target | ||
}, | ||
@@ -100,32 +100,32 @@ /** | ||
*/ | ||
getTargetById(nodeId) { | ||
return registry.id[nodeId]; | ||
getTargetById (nodeId) { | ||
return registry.id[nodeId] | ||
}, | ||
register(/** @type {LinkInNode} */ node) { | ||
const target = generateTarget(node); | ||
const tByName = this.getTarget(target.name, target.flowId); | ||
register (/** @type {LinkInNode} */ node) { | ||
const target = generateTarget(node) | ||
const tByName = this.getTarget(target.name, target.flowId) | ||
if (!tByName || tByName.id !== target.id) { | ||
registry.name[target.name] = registry.name[target.name] || []; | ||
registry.name[target.name] = registry.name[target.name] || [] | ||
registry.name[target.name].push(target) | ||
} | ||
registry.id[target.id] = target; | ||
return target; | ||
registry.id[target.id] = target | ||
return target | ||
}, | ||
remove(node) { | ||
const target = generateTarget(node); | ||
const targs = this.getTargets(target.name); | ||
const idx = getIndex(targs, target.id); | ||
remove (node) { | ||
const target = generateTarget(node) | ||
const targs = this.getTargets(target.name) | ||
const idx = getIndex(targs, target.id) | ||
if (idx > -1) { | ||
targs.splice(idx, 1); | ||
targs.splice(idx, 1) | ||
} | ||
if (targs.length === 0) { | ||
delete registry.name[tn.name]; | ||
delete registry.name[target.name] | ||
} | ||
delete registry.id[target.id]; | ||
delete registry.id[target.id] | ||
}, | ||
clear() { | ||
registry = { id: {}, name: {} }; | ||
clear () { | ||
registry = { id: {}, name: {} } | ||
} | ||
} | ||
})(); | ||
})() | ||
@@ -132,0 +132,0 @@ function LinkInNode(n) { |
@@ -462,26 +462,34 @@ /** | ||
if (!menuOptionMenu) { | ||
menuOptionMenu = RED.menu.init({id:"red-ui-debug-msg-option-menu", | ||
options: [ | ||
{id:"red-ui-debug-msg-menu-item-collapse",label:RED._("node-red:debug.messageMenu.collapseAll"),onselect:function(){ | ||
activeMenuMessage.collapse(); | ||
}}, | ||
var opts = [ | ||
{id:"red-ui-debug-msg-menu-item-collapse",label:RED._("node-red:debug.messageMenu.collapseAll"),onselect:function(){ | ||
activeMenuMessage.collapse(); | ||
}}, | ||
]; | ||
if (activeMenuMessage.clearPinned) { | ||
opts.push( | ||
{id:"red-ui-debug-msg-menu-item-clear-pins",label:RED._("node-red:debug.messageMenu.clearPinned"),onselect:function(){ | ||
activeMenuMessage.clearPinned(); | ||
}}, | ||
null, | ||
{id:"red-ui-debug-msg-menu-item-filter", label:RED._("node-red:debug.messageMenu.filterNode"),onselect:function(){ | ||
var candidateNodes = RED.nodes.filterNodes({type:'debug'}); | ||
candidateNodes.forEach(function(n) { | ||
filteredNodes[n.id] = true; | ||
}); | ||
delete filteredNodes[sourceId]; | ||
$("#red-ui-sidebar-debug-filterSelected").trigger("click"); | ||
RED.settings.set('debug.filteredNodes',Object.keys(filteredNodes)) | ||
refreshMessageList(); | ||
}}, | ||
{id:"red-ui-debug-msg-menu-item-clear-filter",label:RED._("node-red:debug.messageMenu.clearFilter"),onselect:function(){ | ||
$("#red-ui-sidebar-debug-filterAll").trigger("click"); | ||
refreshMessageList(); | ||
}} | ||
] | ||
); | ||
} | ||
opts.push( | ||
null, | ||
{id:"red-ui-debug-msg-menu-item-filter", label:RED._("node-red:debug.messageMenu.filterNode"),onselect:function(){ | ||
var candidateNodes = RED.nodes.filterNodes({type:'debug'}); | ||
candidateNodes.forEach(function(n) { | ||
filteredNodes[n.id] = true; | ||
}); | ||
delete filteredNodes[sourceId]; | ||
$("#red-ui-sidebar-debug-filterSelected").trigger("click"); | ||
RED.settings.set('debug.filteredNodes',Object.keys(filteredNodes)) | ||
refreshMessageList(); | ||
}}, | ||
{id:"red-ui-debug-msg-menu-item-clear-filter",label:RED._("node-red:debug.messageMenu.clearFilter"),onselect:function(){ | ||
$("#red-ui-sidebar-debug-filterAll").trigger("click"); | ||
refreshMessageList(); | ||
}} | ||
); | ||
menuOptionMenu = RED.menu.init({id:"red-ui-debug-msg-option-menu", | ||
options: opts | ||
}); | ||
@@ -488,0 +496,0 @@ menuOptionMenu.css({ |
@@ -171,5 +171,5 @@ /** | ||
var contextKey = RED.util.parseContextStore(rule.from); | ||
if (/\[msg\./.test(context.key)) { | ||
if (/\[msg\./.test(contextKey.key)) { | ||
// The key has a nest msg. reference to evaluate first | ||
context.key = RED.util.normalisePropertyExpression(contextKey.key,msg,true); | ||
contextKey.key = RED.util.normalisePropertyExpression(contextKey.key,msg,true); | ||
} | ||
@@ -176,0 +176,0 @@ node.context()[rule.fromt].get(contextKey.key, contextKey.store, (err,fromValue) => { |
@@ -218,2 +218,3 @@ /** | ||
node._inputNodes = []; | ||
done(); | ||
} | ||
@@ -220,0 +221,0 @@ else { |
{ | ||
"name": "@node-red/nodes", | ||
"version": "3.0.0-beta.4", | ||
"version": "3.0.0", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2251175
23323
1