1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge branch 'master' into adding-timeout-to-functio-node

This commit is contained in:
Kilian Hertel 2023-05-22 17:42:59 +02:00 committed by GitHub
commit c2812b05a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 5 deletions

View File

@ -491,6 +491,7 @@
"unassigned": "未割当", "unassigned": "未割当",
"global": "グローバル", "global": "グローバル",
"workspace": "ワークスペース", "workspace": "ワークスペース",
"editor": "編集ダイアログ",
"selectAll": "全てのノードを選択", "selectAll": "全てのノードを選択",
"selectNone": "選択を外す", "selectNone": "選択を外す",
"selectAllConnected": "接続されたノードを選択", "selectAllConnected": "接続されたノードを選択",

View File

@ -37,13 +37,13 @@ RED.clipboard = (function() {
// IE11 workaround // IE11 workaround
// IE does not support data uri scheme for downloading data // IE does not support data uri scheme for downloading data
var blob = new Blob([data], { var blob = new Blob([data], {
type: "data:text/plain;charset=utf-8" type: "data:application/json;charset=utf-8"
}); });
navigator.msSaveBlob(blob, file); navigator.msSaveBlob(blob, file);
} }
else { else {
var element = document.createElement('a'); var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(data)); element.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(data));
element.setAttribute('download', file); element.setAttribute('download', file);
element.style.display = 'none'; element.style.display = 'none';
document.body.appendChild(element); document.body.appendChild(element);

View File

@ -2646,6 +2646,16 @@ RED.view = (function() {
var result = RED.nodes.removeJunction(node) var result = RED.nodes.removeJunction(node)
removedJunctions.push(node); removedJunctions.push(node);
removedLinks = removedLinks.concat(result.links); removedLinks = removedLinks.concat(result.links);
if (node.g) {
var group = RED.nodes.group(node.g);
if (selectedGroups.indexOf(group) === -1) {
// Don't use RED.group.removeFromGroup as that emits
// a change event on the node - but we're deleting it
var index = group.nodes.indexOf(node);
group.nodes.splice(index,1);
RED.group.markDirty(group);
}
}
} else { } else {
if (node.direction === "out") { if (node.direction === "out") {
removedSubflowOutputs.push(node); removedSubflowOutputs.push(node);

View File

@ -35,7 +35,11 @@ module.exports = function(RED) {
} }
else { node.previous = {}; } else { node.previous = {}; }
} }
var value = RED.util.getMessageProperty(msg,node.property); var value;
try {
value = RED.util.getMessageProperty(msg,node.property);
}
catch(e) { }
if (value !== undefined) { if (value !== undefined) {
var t = "_no_topic"; var t = "_no_topic";
if (node.septopics) { t = topic || t; } if (node.septopics) { t = topic || t; }

View File

@ -697,7 +697,8 @@ module.exports = function(RED) {
node.options.rejectUnauthorized = (node.verifyservercert == "true" || node.verifyservercert === true); node.options.rejectUnauthorized = (node.verifyservercert == "true" || node.verifyservercert === true);
} }
} }
node.v5 = () => node.options && node.options.protocolVersion == 5
node.subscriptionIdentifiersAvailable = () => node.v5() && node.serverProperties && node.serverProperties.subscriptionIdentifiersAvailable
n.autoConnect = n.autoConnect === "false" || n.autoConnect === false ? false : true; n.autoConnect = n.autoConnect === "false" || n.autoConnect === false ? false : true;
node.setOptions(n, true); node.setOptions(n, true);
@ -920,7 +921,12 @@ module.exports = function(RED) {
}; };
node.subscriptions[topic][ref] = sub; node.subscriptions[topic][ref] = sub;
if (node.connected) { if (node.connected) {
const subIdsAvailable = node.subscriptionIdentifiersAvailable()
node._clientOn('message',sub.handler); node._clientOn('message',sub.handler);
// if the broker doesn't support subscription identifiers (e.g. AWS core), then don't send them
if (options.properties && options.properties.subscriptionIdentifier && subIdsAvailable !== true) {
delete options.properties.subscriptionIdentifier
}
node.client.subscribe(topic, options); node.client.subscribe(topic, options);
} }
}; };

View File

@ -854,7 +854,7 @@ describe('inject node', function() {
}); });
n1.on("call:error", function(err) { n1.on("call:error", function(err) {
count++; count++;
if (count == 2) { if (count == 1) {
done(); done();
} }
}); });