');
$('
').appendTo(content);
var row = $('
').appendTo(content);
var bg = $('').appendTo(row);
@@ -269,16 +294,15 @@ RED.sidebar.context = (function() {
if (container.children().length === 0) {
$('
| |
').appendTo(container).i18n();
}
+ delete expandedPaths[id + "." + k]
} else {
payload = data.msg;
format = data.format;
tools.detach();
$(propRow.children()[1]).empty();
RED.utils.createObjectElement(RED.utils.decodeObject(payload,format), {
- typeHint: data.format,
- sourceId: id+"."+k,
- tools: tools,
- path: k
+ ...objectElementOptions,
+ typeHint: data.format
}).appendTo(propRow.children()[1]);
}
});
@@ -293,14 +317,7 @@ RED.sidebar.context = (function() {
});
RED.popover.tooltip(deleteItem,RED._("sidebar.context.delete"));
- var payload = v.msg;
- var format = v.format;
- RED.utils.createObjectElement(RED.utils.decodeObject(payload,format), {
- typeHint: v.format,
- sourceId: id+"."+k,
- tools: tools,
- path: k
- }).appendTo(propRow.children()[1]);
+ RED.utils.createObjectElement(RED.utils.decodeObject(payload,format), objectElementOptions).appendTo(propRow.children()[1]);
if (contextStores.length > 1) {
$("
",{class:"red-ui-sidebar-context-property-storename"}).text(v.store).appendTo($(propRow.children()[0]))
}
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js
index cfc7f65de..49ad15d87 100644
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/utils.js
@@ -230,7 +230,7 @@ RED.utils = (function() {
var pinnedPaths = {};
var formattedPaths = {};
- function addMessageControls(obj,sourceId,key,msg,rootPath,strippedKey,extraTools) {
+ function addMessageControls(obj,sourceId,key,msg,rootPath,strippedKey,extraTools,enablePinning) {
if (!pinnedPaths.hasOwnProperty(sourceId)) {
pinnedPaths[sourceId] = {}
}
@@ -250,7 +250,7 @@ RED.utils = (function() {
RED.clipboard.copyText(msg,copyPayload,"clipboard.copyMessageValue");
})
RED.popover.tooltip(copyPayload,RED._("node-red:debug.sidebar.copyPayload"));
- if (strippedKey !== undefined && strippedKey !== '') {
+ if (enablePinning && strippedKey !== undefined && strippedKey !== '') {
var isPinned = pinnedPaths[sourceId].hasOwnProperty(strippedKey);
var pinPath = $('').appendTo(tools).on("click", function(e) {
@@ -281,13 +281,16 @@ RED.utils = (function() {
}
}
}
- function checkExpanded(strippedKey,expandPaths,minRange,maxRange) {
+ function checkExpanded(strippedKey, expandPaths, { minRange, maxRange, expandLeafNodes }) {
if (expandPaths && expandPaths.length > 0) {
if (strippedKey === '' && minRange === undefined) {
return true;
}
for (var i=0;i').appendTo(element);
if (sourceId) {
- addMessageControls(header,sourceId,path,obj,rootPath,strippedKey,tools);
+ addMessageControls(header,sourceId,path,obj,rootPath,strippedKey,tools, enablePinning);
}
if (!key) {
element.addClass("red-ui-debug-msg-top-level");
- if (sourceId) {
+ if (sourceId && !expandPaths) {
var pinned = pinnedPaths[sourceId];
expandPaths = [];
if (pinned) {
@@ -476,7 +481,7 @@ RED.utils = (function() {
$('').text(typeHint||'string').appendTo(header);
var row = $('
').appendTo(element);
$('
').text(obj).appendTo(row);
- },function(state) {if (ontoggle) { ontoggle(path,state);}}, checkExpanded(strippedKey,expandPaths));
+ },function(state) {if (ontoggle) { ontoggle(path,state);}}, checkExpanded(strippedKey, expandPaths, { expandLeafNodes }));
}
e = $('').html('"'+formatString(sanitize(obj))+'"').appendTo(entryObj);
if (/^#[0-9a-f]{6}$/i.test(obj)) {
@@ -592,14 +597,16 @@ RED.utils = (function() {
typeHint: type==='buffer'?'hex':false,
hideKey: false,
path: path+"["+i+"]",
- sourceId: sourceId,
- rootPath: rootPath,
- expandPaths: expandPaths,
- ontoggle: ontoggle,
- exposeApi: exposeApi,
+ sourceId,
+ rootPath,
+ expandPaths,
+ expandLeafNodes,
+ ontoggle,
+ exposeApi,
// tools: tools // Do not pass tools down as we
// keep them attached to the top-level header
nodeSelector: options.nodeSelector,
+ enablePinning
}
).appendTo(row);
}
@@ -623,21 +630,23 @@ RED.utils = (function() {
typeHint: type==='buffer'?'hex':false,
hideKey: false,
path: path+"["+i+"]",
- sourceId: sourceId,
- rootPath: rootPath,
- expandPaths: expandPaths,
- ontoggle: ontoggle,
- exposeApi: exposeApi,
+ sourceId,
+ rootPath,
+ expandPaths,
+ expandLeafNodes,
+ ontoggle,
+ exposeApi,
// tools: tools // Do not pass tools down as we
// keep them attached to the top-level header
nodeSelector: options.nodeSelector,
+ enablePinning
}
).appendTo(row);
}
}
})(),
(function() { var path = path+"["+i+"]"; return function(state) {if (ontoggle) { ontoggle(path,state);}}})(),
- checkExpanded(strippedKey,expandPaths,minRange,Math.min(fullLength-1,(minRange+9))));
+ checkExpanded(strippedKey,expandPaths,{ minRange, maxRange: Math.min(fullLength-1,(minRange+9)), expandLeafNodes}));
$('
').html("["+minRange+" … "+Math.min(fullLength-1,(minRange+9))+"]").appendTo(header);
}
if (fullLength < originalLength) {
@@ -646,7 +655,7 @@ RED.utils = (function() {
}
},
function(state) {if (ontoggle) { ontoggle(path,state);}},
- checkExpanded(strippedKey,expandPaths));
+ checkExpanded(strippedKey, expandPaths, { expandLeafNodes }));
}
} else if (typeof obj === 'object') {
element.addClass('collapsed');
@@ -680,14 +689,16 @@ RED.utils = (function() {
typeHint: false,
hideKey: false,
path: newPath,
- sourceId: sourceId,
- rootPath: rootPath,
- expandPaths: expandPaths,
- ontoggle: ontoggle,
- exposeApi: exposeApi,
+ sourceId,
+ rootPath,
+ expandPaths,
+ expandLeafNodes,
+ ontoggle,
+ exposeApi,
// tools: tools // Do not pass tools down as we
// keep them attached to the top-level header
nodeSelector: options.nodeSelector,
+ enablePinning
}
).appendTo(row);
}
@@ -696,7 +707,7 @@ RED.utils = (function() {
}
},
function(state) {if (ontoggle) { ontoggle(path,state);}},
- checkExpanded(strippedKey,expandPaths));
+ checkExpanded(strippedKey, expandPaths, { expandLeafNodes }));
}
if (key) {
$('
').text(type).appendTo(entryObj);
diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js
index 8ce6dc630..92d4593c6 100644
--- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js
+++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js
@@ -1265,11 +1265,6 @@ RED.view = (function() {
var targetGroup = options.group;
var touchTrigger = options.touchTrigger;
- if (targetGroup) {
- selectedGroups.add(targetGroup,false);
- RED.view.redraw();
- }
-
// `point` is the place in the workspace the mouse has clicked.
// This takes into account scrolling and scaling of the workspace.
var ox = point[0];
@@ -1591,9 +1586,6 @@ RED.view = (function() {
// auto select dropped node - so info shows (if visible)
clearSelection();
nn.selected = true;
- if (targetGroup) {
- selectedGroups.add(targetGroup,false);
- }
movingSet.add(nn);
updateActiveNodes();
updateSelection();
diff --git a/packages/node_modules/@node-red/nodes/core/common/21-debug.js b/packages/node_modules/@node-red/nodes/core/common/21-debug.js
index fe9827fce..45deb5ab3 100644
--- a/packages/node_modules/@node-red/nodes/core/common/21-debug.js
+++ b/packages/node_modules/@node-red/nodes/core/common/21-debug.js
@@ -148,7 +148,7 @@ module.exports = function(RED) {
var st = (typeof output === 'string') ? output : util.inspect(output);
var fill = "grey";
var shape = "dot";
- if (typeof output === 'object' && hasOwnProperty.call(output, "fill") && hasOwnProperty.call(output, "shape") && hasOwnProperty.call(output, "text")) {
+ if (typeof output === 'object' && output?.fill && output?.shape && output?.text) {
fill = output.fill;
shape = output.shape;
st = output.text;
diff --git a/packages/node_modules/@node-red/nodes/core/common/lib/debug/debug-utils.js b/packages/node_modules/@node-red/nodes/core/common/lib/debug/debug-utils.js
index b244273dc..0a84b24c7 100644
--- a/packages/node_modules/@node-red/nodes/core/common/lib/debug/debug-utils.js
+++ b/packages/node_modules/@node-red/nodes/core/common/lib/debug/debug-utils.js
@@ -511,9 +511,10 @@ RED.debug = (function() {
typeHint: format,
hideKey: false,
path: path,
- sourceId: sourceNode&&sourceNode.id,
+ sourceId: sourceNode && sourceNode.id,
rootPath: path,
nodeSelector: config.messageSourceClick,
+ enablePinning: true
});
// Do this in a separate step so the element functions aren't stripped
debugMessage.appendTo(el);
diff --git a/packages/node_modules/@node-red/nodes/core/function/10-switch.js b/packages/node_modules/@node-red/nodes/core/function/10-switch.js
index fdc345f47..9d68f6b0b 100644
--- a/packages/node_modules/@node-red/nodes/core/function/10-switch.js
+++ b/packages/node_modules/@node-red/nodes/core/function/10-switch.js
@@ -352,7 +352,9 @@ module.exports = function(RED) {
if (msgs.length === 0) {
done()
} else {
- drainMessageGroup(msgs,count,done);
+ setImmediate(() => {
+ drainMessageGroup(msgs,count,done);
+ })
}
}
})
@@ -505,7 +507,9 @@ module.exports = function(RED) {
if (err) {
node.error(err,nextMsg);
}
- processMessageQueue()
+ setImmediate(() => {
+ processMessageQueue()
+ })
});
}
diff --git a/packages/node_modules/@node-red/runtime/lib/flows/Flow.js b/packages/node_modules/@node-red/runtime/lib/flows/Flow.js
index c4f4e39a2..0b6045326 100644
--- a/packages/node_modules/@node-red/runtime/lib/flows/Flow.js
+++ b/packages/node_modules/@node-red/runtime/lib/flows/Flow.js
@@ -719,6 +719,14 @@ class Flow {
});
}
+ getContext(scope) {
+ if (scope === 'flow') {
+ return this.context
+ } else if (scope === 'global') {
+ return context.get('global')
+ }
+ }
+
dump() {
console.log("==================")
console.log(this.TYPE, this.id);
diff --git a/packages/node_modules/@node-red/runtime/lib/flows/Group.js b/packages/node_modules/@node-red/runtime/lib/flows/Group.js
index 589cdf115..d95b4e553 100644
--- a/packages/node_modules/@node-red/runtime/lib/flows/Group.js
+++ b/packages/node_modules/@node-red/runtime/lib/flows/Group.js
@@ -49,6 +49,14 @@ class Group {
}
return this.parent.getSetting(key);
}
+
+ error(msg) {
+ this.parent.error(msg);
+ }
+
+ getContext(scope) {
+ return this.parent.getContext(scope);
+ }
}
module.exports = {
diff --git a/packages/node_modules/@node-red/runtime/lib/flows/util.js b/packages/node_modules/@node-red/runtime/lib/flows/util.js
index 6b7f659b9..d50825212 100644
--- a/packages/node_modules/@node-red/runtime/lib/flows/util.js
+++ b/packages/node_modules/@node-red/runtime/lib/flows/util.js
@@ -100,7 +100,24 @@ async function evaluateEnvProperties(flow, env, credentials) {
}
} else if (type ==='jsonata') {
pendingEvaluations.push(new Promise((resolve, _) => {
- redUtil.evaluateNodeProperty(value, 'jsonata', {_flow: flow}, null, (err, result) => {
+ redUtil.evaluateNodeProperty(value, 'jsonata',{
+ // Fake a node object to provide access to _flow and context
+ _flow: flow,
+ context: () => {
+ return {
+ flow: {
+ get: (value, store, callback) => {
+ return flow.getContext('flow').get(value, store, callback)
+ }
+ },
+ global: {
+ get: (value, store, callback) => {
+ return flow.getContext('global').get(value, store, callback)
+ }
+ }
+ }
+ }
+ }, null, (err, result) => {
if (!err) {
if (typeof result === 'object') {
result = { value: result, __clone__: true}