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", "uknownNodes": "Unknown nodes",
"unusedSubflows": "Unused subflows", "unusedSubflows": "Unused subflows",
"hiddenFlows": "Hidden flows", "hiddenFlows": "Hidden flows",
"modifiedNodes": "Modified nodes and flows" "modifiedNodes": "Modified nodes and flows",
"thisFlow": "This flow"
} }
}, },
"expressionEditor": { "expressionEditor": {

View File

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