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

catch node extended

This commit is contained in:
NetHans 2022-08-14 20:28:34 +02:00
parent 08ce6cce97
commit 371253a4f6
4 changed files with 15 additions and 2 deletions

View File

@ -4,6 +4,7 @@
<label style="width: auto" for="node-input-scope" data-i18n="catch.label.source"></label> <label style="width: auto" for="node-input-scope" data-i18n="catch.label.source"></label>
<select id="node-input-scope-select"> <select id="node-input-scope-select">
<option value="all" data-i18n="catch.scope.all"></option> <option value="all" data-i18n="catch.scope.all"></option>
<option value="group" data-i18n="status.scope.group"></option>
<option value="target" data-i18n="catch.scope.selected"></options> <option value="target" data-i18n="catch.scope.selected"></options>
</select> </select>
</div> </div>
@ -170,6 +171,8 @@
}); });
if (this.scope === null) { if (this.scope === null) {
$("#node-input-scope-select").val("all"); $("#node-input-scope-select").val("all");
} else if(this.scope === "group"){
$("#node-input-scope-select").val("group");
} else { } else {
$("#node-input-scope-select").val("target"); $("#node-input-scope-select").val("target");
} }
@ -179,6 +182,8 @@
var scope = $("#node-input-scope-select").val(); var scope = $("#node-input-scope-select").val();
if (scope === 'all') { if (scope === 'all') {
this.scope = null; this.scope = null;
} else if(scope === 'group') {
this.scope = "group";
} else { } else {
$("#node-input-uncaught").prop("checked",false); $("#node-input-uncaught").prop("checked",false);
this.scope = $("#node-input-catch-target-container-div").treeList('selected').map(function(i) { return i.node.id}) this.scope = $("#node-input-catch-target-container-div").treeList('selected').map(function(i) { return i.node.id})

View File

@ -98,6 +98,7 @@
}, },
"scope": { "scope": {
"all": "allen Nodes", "all": "allen Nodes",
"group": "in gleicher Gruppe",
"selected": "ausgewählten Nodes" "selected": "ausgewählten Nodes"
} }
}, },

View File

@ -103,6 +103,7 @@
}, },
"scope": { "scope": {
"all": "all nodes", "all": "all nodes",
"group": "in same group",
"selected": "selected nodes" "selected": "selected nodes"
} }
}, },

View File

@ -734,11 +734,17 @@ class Flow {
} else { } else {
var handledByUncaught = false; var handledByUncaught = false;
const flow = this;
this.catchNodes.forEach(function(targetCatchNode) { this.catchNodes.forEach(function(targetCatchNode) {
if (targetCatchNode.scope && targetCatchNode.scope.indexOf(reportingNode.id) === -1) { if (Array.isArray(targetCatchNode.scope) && targetCatchNode.scope.indexOf(reportingNode.id) === -1) {
return; return;
} }
if (!targetCatchNode.scope && targetCatchNode.uncaught && !handledByUncaught) {
if (targetCatchNode.scope === "group" && flow.isNodeInSameGroup(targetCatchNode, reportingNode) === false){
return;
}
if ((!targetCatchNode.scope || targetCatchNode.scope === "group") && targetCatchNode.uncaught && !handledByUncaught) {
if (handled) { if (handled) {
// This has been handled by a !uncaught catch node // This has been handled by a !uncaught catch node
return; return;