Add an option to hide link nodes from the list

This adds an hide option to link in and link out in order to be able to hide both from the respective linking list.
This commit is contained in:
Benjamin Ihrig 2022-11-08 14:34:42 +01:00
parent 14c362d4ba
commit 5be20a50c2
No known key found for this signature in database
GPG Key ID: 8EA4801DC4035EED
4 changed files with 41 additions and 2 deletions

View File

@ -4,6 +4,14 @@
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label> <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name"> <input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div> </div>
<div class="form-row">
<label for="node-input-hide"><i class="fa fa-eye"></i> <span data-i18n="link.visibility"></span></label>
<select id="node-input-visibility">
<option value="global" data-i18n="link.visibilityGlobal"></option>
<option value="flow" data-i18n="link.visibilityFlow"></option>
<option value="none" data-i18n="link.visibilityNone"></option>
</select>
</div>
<div style="position:relative; height: 30px; text-align: right;"><div style="display:inline-block"><input type="text" id="node-input-link-target-filter"></div></div> <div style="position:relative; height: 30px; text-align: right;"><div style="display:inline-block"><input type="text" id="node-input-link-target-filter"></div></div>
<div class="form-row node-input-link-row"></div> <div class="form-row node-input-link-row"></div>
</script> </script>
@ -12,6 +20,14 @@
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label> <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name"> <input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div> </div>
<div class="form-row">
<label for="node-input-visibility"><i class="fa fa-eye"></i> <span data-i18n="link.visibility"></span></label>
<select id="node-input-visibility">
<option value="global" data-i18n="link.visibilityGlobal"></option>
<option value="flow" data-i18n="link.visibilityFlow"></option>
<option value="none" data-i18n="link.visibilityNone"></option>
</select>
</div>
<div class="form-row"> <div class="form-row">
<label for="node-input-mode"><span data-i18n="link.outMode"></span></label> <label for="node-input-mode"><span data-i18n="link.outMode"></span></label>
<select id="node-input-mode" style="width: 70%"> <select id="node-input-mode" style="width: 70%">
@ -76,7 +92,18 @@
RED.view.redraw(); RED.view.redraw();
} }
}); });
const candidateNodes = RED.nodes.filterNodes({type:targetType}); const candidateNodes = RED.nodes.filterNodes({type:targetType}).filter(n => {
console.log(node);
console.log(n);
if (n.visibility === "none") {
return false;
}
if (n.visibility === "global") {
return true;
}
// visibility === "flow"
return n.z === node.z;
});
let candidateNodesCount = 0; let candidateNodesCount = 0;
const search = $("#node-input-link-target-filter").searchBox({ const search = $("#node-input-link-target-filter").searchBox({
@ -236,6 +263,7 @@
color:"#ddd",//"#87D8CF", color:"#ddd",//"#87D8CF",
defaults: { defaults: {
name: { value: "_DEFAULT_" }, name: { value: "_DEFAULT_" },
visibility: { value: "global" },
links: { value: [], type:"link out[]" } links: { value: [], type:"link out[]" }
}, },
inputs:0, inputs:0,
@ -330,6 +358,7 @@
color:"#ddd",//"#87D8CF", color:"#ddd",//"#87D8CF",
defaults: { defaults: {
name: { value:"_DEFAULT_" }, name: { value:"_DEFAULT_" },
visibility: { value: "global" },
mode: { value: "link" },// link || return mode: { value: "link" },// link || return
links: { value: [], type:"link in[]" } links: { value: [], type:"link in[]" }
}, },

View File

@ -158,7 +158,9 @@
}, },
"link": { "link": {
"linkIn": "Eingehende Verbindung", "linkIn": "Eingehende Verbindung",
"linkOut": "Ausgehende Verbindung" "linkOut": "Ausgehende Verbindung",
"visibility": "Sichtbarkeit",
"visibilityNone": "Nicht"
}, },
"tls": { "tls": {
"tls": "TLS-Konfiguration", "tls": "TLS-Konfiguration",

View File

@ -22,6 +22,8 @@
<p>The wires between link nodes are only displayed when a link node is selected. <p>The wires between link nodes are only displayed when a link node is selected.
If there are any wires to other tabs, a virtual node is shown that can be clicked If there are any wires to other tabs, a virtual node is shown that can be clicked
on to jump to the appropriate tab.</p> on to jump to the appropriate tab.</p>
<p>The link visibility makes it possible to hide links from other flows, or from all
other links to provide a better overview.</p>
<p><b>Note: </b>Links cannot be created going into, or out of, a subflow.</p> <p><b>Note: </b>Links cannot be created going into, or out of, a subflow.</p>
</script> </script>
@ -34,6 +36,8 @@
<p>When in 'send to all' mode, the wires between link nodes are only displayed when <p>When in 'send to all' mode, the wires between link nodes are only displayed when
the node is selected. If there are any wires to other tabs, a virtual node the node is selected. If there are any wires to other tabs, a virtual node
is shown that can be clicked on to jump to the appropriate tab.</p> is shown that can be clicked on to jump to the appropriate tab.</p>
<p>The link visibility makes it possible to hide links from other flows, or from all
other links to provide a better overview.</p>
<p><b>Note: </b>Links cannot be created going into, or out of, a subflow.</p> <p><b>Note: </b>Links cannot be created going into, or out of, a subflow.</p>
</script> </script>

View File

@ -179,6 +179,10 @@
"timeout": "timeout", "timeout": "timeout",
"linkCallType": "Link Type", "linkCallType": "Link Type",
"staticLinkCall": "Fixed target", "staticLinkCall": "Fixed target",
"visibility": "Visibility",
"visibilityGlobal": "Global",
"visibilityFlow": "Flow",
"visibilityNone": "None",
"dynamicLinkCall": "Dynamic target (msg.target)", "dynamicLinkCall": "Dynamic target (msg.target)",
"dynamicLinkLabel": "Dynamic", "dynamicLinkLabel": "Dynamic",
"error": { "error": {