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

Filter out Link Out Return nodes in Link In edit dialog

Fixes #3187
This commit is contained in:
Nick O'Leary 2021-10-13 14:23:43 +01:00
parent be7e28af5d
commit 44aa1f4a5e
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -68,6 +68,8 @@
} }
}); });
var candidateNodes = RED.nodes.filterNodes({type:targetType}); var candidateNodes = RED.nodes.filterNodes({type:targetType});
var candidateNodesCount = 0;
var search = $("#node-input-link-target-filter").searchBox({ var search = $("#node-input-link-target-filter").searchBox({
style: "compact", style: "compact",
delay: 300, delay: 300,
@ -80,7 +82,7 @@
var count = treeList.treeList("filter", function(item) { var count = treeList.treeList("filter", function(item) {
return item.label.toLowerCase().indexOf(val) > -1 || (item.node && item.node.type.toLowerCase().indexOf(val) > -1) return item.label.toLowerCase().indexOf(val) > -1 || (item.node && item.node.type.toLowerCase().indexOf(val) > -1)
}); });
search.searchBox("count",count+" / "+candidateNodes.length); search.searchBox("count",count+" / "+candidateNodesCount);
} }
} }
}); });
@ -113,6 +115,11 @@
candidateNodes.forEach(function(n) { candidateNodes.forEach(function(n) {
if (flowMap[n.z]) { if (flowMap[n.z]) {
if (targetType === "link out" && n.mode === 'return') {
// Link In nodes looking for Link Out nodes should not
// include return-mode nodes.
return
}
var isChecked = false; var isChecked = false;
isChecked = (node.links.indexOf(n.id) !== -1) || (n.links||[]).indexOf(node.id) !== -1; isChecked = (node.links.indexOf(n.id) !== -1) || (n.links||[]).indexOf(node.id) !== -1;
if (isChecked) { if (isChecked) {
@ -126,6 +133,7 @@
checkbox: node.type !== "link call", checkbox: node.type !== "link call",
radio: node.type === "link call" radio: node.type === "link call"
}) })
candidateNodesCount++;
} }
}); });
flows = flows.filter(function(f) { return f.children.length > 0 }) flows = flows.filter(function(f) { return f.children.length > 0 })