mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
a7932da207
commit
b9919b0a9c
@ -48,7 +48,7 @@
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
|
||||
var treeList;
|
||||
let treeList;
|
||||
|
||||
function onEditPrepare(node,targetType) {
|
||||
if (!node.links) {
|
||||
@ -56,7 +56,7 @@
|
||||
}
|
||||
node.oldLinks = [];
|
||||
|
||||
var activeSubflow = RED.nodes.subflow(node.z);
|
||||
const activeSubflow = RED.nodes.subflow(node.z);
|
||||
|
||||
treeList = $("<div>")
|
||||
.css({width: "100%", height: "100%"})
|
||||
@ -76,10 +76,10 @@
|
||||
RED.view.redraw();
|
||||
}
|
||||
});
|
||||
var candidateNodes = RED.nodes.filterNodes({type:targetType});
|
||||
var candidateNodesCount = 0;
|
||||
const candidateNodes = RED.nodes.filterNodes({type:targetType});
|
||||
let candidateNodesCount = 0;
|
||||
|
||||
var search = $("#node-input-link-target-filter").searchBox({
|
||||
const search = $("#node-input-link-target-filter").searchBox({
|
||||
style: "compact",
|
||||
delay: 300,
|
||||
change: function() {
|
||||
@ -88,7 +88,7 @@
|
||||
treeList.treeList("filter", null);
|
||||
search.searchBox("count","");
|
||||
} else {
|
||||
var count = treeList.treeList("filter", function(item) {
|
||||
const count = treeList.treeList("filter", function(item) {
|
||||
return item.label.toLowerCase().indexOf(val) > -1 || (item.node && item.node.type.toLowerCase().indexOf(val) > -1)
|
||||
});
|
||||
search.searchBox("count",count+" / "+candidateNodesCount);
|
||||
@ -96,9 +96,8 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var flows = [];
|
||||
var flowMap = {};
|
||||
const flows = [];
|
||||
const flowMap = {};
|
||||
|
||||
if (activeSubflow) {
|
||||
flowMap[activeSubflow.id] = {
|
||||
@ -109,7 +108,10 @@
|
||||
children: []
|
||||
};
|
||||
flows.push(flowMap[activeSubflow.id])
|
||||
} else {
|
||||
}
|
||||
if (!activeSubflow || node.type === "link call") {
|
||||
// Only "Link Call" can look outside of its own subflow
|
||||
// Link In and Link Out nodes outside of a subflow should be ignored
|
||||
RED.nodes.eachWorkspace(function (ws) {
|
||||
flowMap[ws.id] = {
|
||||
id: ws.id,
|
||||
@ -127,10 +129,9 @@
|
||||
if (targetType === "link out" && n.mode === 'return') {
|
||||
// Link In nodes looking for Link Out nodes should not
|
||||
// include return-mode nodes.
|
||||
return
|
||||
return;
|
||||
}
|
||||
var isChecked = false;
|
||||
isChecked = (node.links.indexOf(n.id) !== -1) || (n.links||[]).indexOf(node.id) !== -1;
|
||||
const isChecked = (node.links.indexOf(n.id) !== -1) || (n.links || []).indexOf(node.id) !== -1;
|
||||
if (isChecked) {
|
||||
node.oldLinks.push(n.id);
|
||||
}
|
||||
@ -145,8 +146,8 @@
|
||||
candidateNodesCount++;
|
||||
}
|
||||
});
|
||||
flows = flows.filter(function(f) { return f.children.length > 0 })
|
||||
treeList.treeList('data',flows);
|
||||
const flowsFiltered = flows.filter(function(f) { return f.children.length > 0 })
|
||||
treeList.treeList('data',flowsFiltered);
|
||||
setTimeout(function() {
|
||||
treeList.treeList('show',node.z);
|
||||
},100);
|
||||
@ -218,8 +219,6 @@
|
||||
}
|
||||
|
||||
function onAdd() {
|
||||
RED.actions.invoke("core:generate-node-names",this)
|
||||
|
||||
for (var i=0;i<this.links.length;i++) {
|
||||
var n = RED.nodes.node(this.links[i]);
|
||||
if (n && n.links.indexOf(this.id) === -1) {
|
||||
@ -316,10 +315,7 @@
|
||||
oneditsave: function() {
|
||||
onEditSave(this);
|
||||
},
|
||||
oneditresize: resizeNodeList,
|
||||
onadd: function() {
|
||||
RED.actions.invoke("core:generate-node-names",this)
|
||||
}
|
||||
oneditresize: resizeNodeList
|
||||
});
|
||||
|
||||
RED.nodes.registerType('link out',{
|
||||
|
Loading…
Reference in New Issue
Block a user