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

Add ability to search in current flow

fixes #3419
This commit is contained in:
Steve-Mcl 2022-05-04 14:42:47 +01:00
parent 55ecc7a92c
commit 1141f9de86
2 changed files with 16 additions and 6 deletions

View File

@ -907,7 +907,8 @@
"uknownNodes": "Unknown nodes",
"unusedSubflows": "Unused subflows",
"hiddenFlows": "Hidden flows",
"modifiedNodes": "Modified nodes and flows"
"modifiedNodes": "Modified nodes and flows",
"thisFlow": "This flow"
}
},
"expressionEditor": {

View File

@ -122,12 +122,15 @@ RED.search = (function() {
val = extractFlag(val,"subflow",flags);
val = extractFlag(val,"hidden",flags);
val = extractFlag(val,"modified",flags);
// uses:<node-id>
val = extractValue(val,"uses",flags);
var hasFlags = Object.keys(flags).length > 0;
val = extractFlag(val,"thisflow",flags);
if (flags.thisflow === true) {
flags.thisflow = RED.workspaces.active();
} else {
delete flags.thisflow;
}
val = extractValue(val,"uses",flags);// uses:<node-id>
val = val.trim();
var hasFlags = Object.keys(flags).length > 0;
if (val.length > 0 || typeFilter || hasFlags) {
val = val.toLowerCase();
@ -188,6 +191,11 @@ RED.search = (function() {
continue;
}
}
if (flags.hasOwnProperty("thisflow")) {
if (flags.thisflow !== node.node.z) {
continue;
}
}
if (!typeFilter || node.node.type === typeFilter) {
nodes[node.node.id] = nodes[node.node.id] = {
node: node.node,
@ -592,6 +600,7 @@ RED.search = (function() {
{label:RED._("search.options.uknownNodes"), value: "type:unknown"},
{label:RED._("search.options.unusedSubflows"), value:"is:subflow is:unused"},
{label:RED._("search.options.hiddenFlows"), value:"is:hidden"},
{label:RED._("search.options.thisFlow"), value:"is:thisflow"},
]
}