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

Merge pull request #3606 from node-red/dev

Merge minor dev branch fixes and "Search flow:active" V3 item into master
This commit is contained in:
Nick O'Leary 2022-05-10 11:19:03 +01:00 committed by GitHub
commit 8043f5d865
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 23 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": "Current flow"
} }
}, },
"expressionEditor": { "expressionEditor": {

View File

@ -108,7 +108,6 @@ RED.search = (function() {
function search(val) { function search(val) {
var results = []; var results = [];
var keys = [];
var typeFilter; var typeFilter;
var m = /(?:^| )type:([^ ]+)/.exec(val); var m = /(?:^| )type:([^ ]+)/.exec(val);
if (m) { if (m) {
@ -122,19 +121,24 @@ 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 = extractValue(val,"flow",flags);// flow:active or flow:<flow-id>
val = extractValue(val,"uses",flags); val = extractValue(val,"uses",flags);// uses:<node-id>
var hasFlags = Object.keys(flags).length > 0;
val = val.trim(); val = val.trim();
var hasFlags = Object.keys(flags).length > 0;
if (flags.flow && flags.flow.indexOf("current") >= 0) {
let idx = flags.flow.indexOf("current");
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) { if (val.length > 0 || typeFilter || hasFlags) {
val = val.toLowerCase(); val = val.toLowerCase();
var i; var i;
var j; var j;
var list = []; var list = [];
var nodes = {}; var nodes = {};
let keys = [];
if (flags.uses) { if (flags.uses) {
keys = flags.uses; keys = flags.uses;
} else { } else {
@ -188,6 +192,11 @@ RED.search = (function() {
continue; continue;
} }
} }
if (flags.hasOwnProperty("flow")) {
if (flags.flow.indexOf(node.node.z || node.node.id) < 0) {
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,8 +601,8 @@ 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:"flow:current"},
] ]
} }
function init() { function init() {

View File

@ -93,7 +93,6 @@ RED.view = (function() {
var selectNodesOptions; var selectNodesOptions;
let flashingNodeId; let flashingNodeId;
let flashingNodeTimer;
var clipboard = ""; var clipboard = "";
@ -5876,27 +5875,26 @@ RED.view = (function() {
if(typeof node === "string") { node = RED.nodes.node(n); } if(typeof node === "string") { node = RED.nodes.node(n); }
if(!node) { return; } if(!node) { return; }
const flashingNode = flashingNodeTimer && flashingNodeId && RED.nodes.node(flashingNodeId); const flashingNode = flashingNodeId && RED.nodes.node(flashingNodeId);
if(flashingNode) { if(flashingNode) {
//cancel current flashing node before flashing new node //cancel current flashing node before flashing new node
clearInterval(flashingNodeTimer); clearInterval(flashingNode.__flashTimer);
flashingNodeTimer = null; delete flashingNode.__flashTimer;
flashingNode.dirty = true; flashingNode.dirty = true;
flashingNode.highlighted = false; flashingNode.highlighted = false;
} }
node.__flashTimer = setInterval(function(flashEndTime, n) {
flashingNodeTimer = setInterval(function(flashEndTime) { n.dirty = true;
node.dirty = true;
if (flashEndTime >= Date.now()) { if (flashEndTime >= Date.now()) {
node.highlighted = !node.highlighted; n.highlighted = !n.highlighted;
} else { } else {
clearInterval(flashingNodeTimer); clearInterval(n.__flashTimer);
flashingNodeTimer = null; delete n.__flashTimer;
node.highlighted = false;
flashingNodeId = null; flashingNodeId = null;
n.highlighted = false;
} }
RED.view.redraw(); RED.view.redraw();
}, 100, Date.now() + 2200) }, 100, Date.now() + 2200, node)
flashingNodeId = node.id; flashingNodeId = node.id;
node.highlighted = true; node.highlighted = true;
RED.view.redraw(); RED.view.redraw();

View File

@ -530,7 +530,6 @@
if (type !== 'full') { if (type !== 'full') {
comp = $("#node-input-typed-complete").typedInput('value'); comp = $("#node-input-typed-complete").typedInput('value');
} }
console.log('hihi')
that.statusType = "auto"; that.statusType = "auto";
that.statusVal = comp; that.statusVal = comp;
} }

View File

@ -302,7 +302,6 @@
return this.name?"node_label_italic":""; return this.name?"node_label_italic":"";
}, },
oneditprepare: function() { oneditprepare: function() {
console.log("link call oneditprepare")
const updateVisibility = function() { const updateVisibility = function() {
const static = $('#node-input-linkType').val() !== "dynamic"; const static = $('#node-input-linkType').val() !== "dynamic";
if(static) { if(static) {