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

change search term is:thisflow to flow:active

this also permits flow:<flow-id>
This commit is contained in:
Steve-Mcl 2022-05-08 14:23:47 +01:00
parent 1141f9de86
commit d1b74675d9

View File

@ -108,7 +108,6 @@ RED.search = (function() {
function search(val) {
var results = [];
var keys = [];
var typeFilter;
var m = /(?:^| )type:([^ ]+)/.exec(val);
if (m) {
@ -122,22 +121,24 @@ RED.search = (function() {
val = extractFlag(val,"subflow",flags);
val = extractFlag(val,"hidden",flags);
val = extractFlag(val,"modified",flags);
val = extractFlag(val,"thisflow",flags);
if (flags.thisflow === true) {
flags.thisflow = RED.workspaces.active();
} else {
delete flags.thisflow;
}
val = extractValue(val,"flow",flags);// flow:active or flow:<flow-id>
val = extractValue(val,"uses",flags);// uses:<node-id>
val = val.trim();
var hasFlags = Object.keys(flags).length > 0;
if (flags.flow && flags.flow.indexOf("active") >= 0) {
let idx = flags.flow.indexOf("active");
flags.flow[idx] = RED.workspaces.active();//convert active to flow ID
}
if (flags.flow && flags.flow.length) {
flags.flow = [ ...new Set(flags.flow) ]; //deduplicate
}
if (val.length > 0 || typeFilter || hasFlags) {
val = val.toLowerCase();
var i;
var j;
var list = [];
var nodes = {};
let keys = [];
if (flags.uses) {
keys = flags.uses;
} else {
@ -191,8 +192,8 @@ RED.search = (function() {
continue;
}
}
if (flags.hasOwnProperty("thisflow")) {
if (flags.thisflow !== node.node.z) {
if (flags.hasOwnProperty("flow")) {
if (flags.flow.indexOf(node.node.z || node.node.id) < 0) {
continue;
}
}
@ -600,9 +601,8 @@ 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"},
{label:RED._("search.options.thisFlow"), value:"flow:active"},
]
}
function init() {