mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Compare commits
13 Commits
fix-ungrou
...
Fix-delay-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
495a81768d | ||
|
|
cb2efb14f7 | ||
|
|
1af56a7f00 | ||
|
|
09973ba8cf | ||
|
|
dd3174c40f | ||
|
|
f0293b8f52 | ||
|
|
5561e89201 | ||
|
|
0f2420576a | ||
|
|
d1b74675d9 | ||
|
|
e04f5cb277 | ||
|
|
a4603a4396 | ||
|
|
1141f9de86 | ||
|
|
bbc32c4cd0 |
@@ -907,7 +907,8 @@
|
||||
"uknownNodes": "Unknown nodes",
|
||||
"unusedSubflows": "Unused subflows",
|
||||
"hiddenFlows": "Hidden flows",
|
||||
"modifiedNodes": "Modified nodes and flows"
|
||||
"modifiedNodes": "Modified nodes and flows",
|
||||
"thisFlow": "Current flow"
|
||||
}
|
||||
},
|
||||
"expressionEditor": {
|
||||
|
||||
@@ -108,7 +108,6 @@ RED.search = (function() {
|
||||
|
||||
function search(val) {
|
||||
var results = [];
|
||||
var keys = [];
|
||||
var typeFilter;
|
||||
var m = /(?:^| )type:([^ ]+)/.exec(val);
|
||||
if (m) {
|
||||
@@ -122,19 +121,24 @@ 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 = 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("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) {
|
||||
val = val.toLowerCase();
|
||||
var i;
|
||||
var j;
|
||||
var list = [];
|
||||
var nodes = {};
|
||||
let keys = [];
|
||||
if (flags.uses) {
|
||||
keys = flags.uses;
|
||||
} else {
|
||||
@@ -188,6 +192,11 @@ RED.search = (function() {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (flags.hasOwnProperty("flow")) {
|
||||
if (flags.flow.indexOf(node.node.z || node.node.id) < 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!typeFilter || node.node.type === typeFilter) {
|
||||
nodes[node.node.id] = nodes[node.node.id] = {
|
||||
node: node.node,
|
||||
@@ -592,8 +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:"flow:current"},
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
@@ -93,7 +93,6 @@ RED.view = (function() {
|
||||
var selectNodesOptions;
|
||||
|
||||
let flashingNodeId;
|
||||
let flashingNodeTimer;
|
||||
|
||||
var clipboard = "";
|
||||
|
||||
@@ -5853,27 +5852,26 @@ RED.view = (function() {
|
||||
if(typeof node === "string") { node = RED.nodes.node(n); }
|
||||
if(!node) { return; }
|
||||
|
||||
const flashingNode = flashingNodeTimer && flashingNodeId && RED.nodes.node(flashingNodeId);
|
||||
const flashingNode = flashingNodeId && RED.nodes.node(flashingNodeId);
|
||||
if(flashingNode) {
|
||||
//cancel current flashing node before flashing new node
|
||||
clearInterval(flashingNodeTimer);
|
||||
flashingNodeTimer = null;
|
||||
clearInterval(flashingNode.__flashTimer);
|
||||
delete flashingNode.__flashTimer;
|
||||
flashingNode.dirty = true;
|
||||
flashingNode.highlighted = false;
|
||||
}
|
||||
|
||||
flashingNodeTimer = setInterval(function(flashEndTime) {
|
||||
node.dirty = true;
|
||||
node.__flashTimer = setInterval(function(flashEndTime, n) {
|
||||
n.dirty = true;
|
||||
if (flashEndTime >= Date.now()) {
|
||||
node.highlighted = !node.highlighted;
|
||||
n.highlighted = !n.highlighted;
|
||||
} else {
|
||||
clearInterval(flashingNodeTimer);
|
||||
flashingNodeTimer = null;
|
||||
node.highlighted = false;
|
||||
clearInterval(n.__flashTimer);
|
||||
delete n.__flashTimer;
|
||||
flashingNodeId = null;
|
||||
n.highlighted = false;
|
||||
}
|
||||
RED.view.redraw();
|
||||
}, 100, Date.now() + 2200)
|
||||
}, 100, Date.now() + 2200, node)
|
||||
flashingNodeId = node.id;
|
||||
node.highlighted = true;
|
||||
RED.view.redraw();
|
||||
|
||||
@@ -530,7 +530,6 @@
|
||||
if (type !== 'full') {
|
||||
comp = $("#node-input-typed-complete").typedInput('value');
|
||||
}
|
||||
console.log('hihi')
|
||||
that.statusType = "auto";
|
||||
that.statusVal = comp;
|
||||
}
|
||||
|
||||
@@ -302,7 +302,6 @@
|
||||
return this.name?"node_label_italic":"";
|
||||
},
|
||||
oneditprepare: function() {
|
||||
console.log("link call oneditprepare")
|
||||
const updateVisibility = function() {
|
||||
const static = $('#node-input-linkType').val() !== "dynamic";
|
||||
if(static) {
|
||||
|
||||
@@ -275,18 +275,22 @@ module.exports = function(RED) {
|
||||
if (msg.hasOwnProperty("flush")) {
|
||||
var len = node.buffer.length;
|
||||
if (typeof(msg.flush) == 'number') { len = Math.min(Math.floor(msg.flush),len); }
|
||||
while (len > 0) {
|
||||
const msgInfo = node.buffer.shift();
|
||||
if (Object.keys(msgInfo.msg).length > 1) {
|
||||
node.send(msgInfo.msg);
|
||||
msgInfo.done();
|
||||
}
|
||||
len = len - 1;
|
||||
}
|
||||
if (node.buffer.length === 0) {
|
||||
if (len === 0) {
|
||||
clearInterval(node.intervalID);
|
||||
node.intervalID = -1;
|
||||
}
|
||||
else {
|
||||
while (len > 0) {
|
||||
const msgInfo = node.buffer.shift();
|
||||
if (Object.keys(msgInfo.msg).length > 1) {
|
||||
node.send(msgInfo.msg);
|
||||
msgInfo.done();
|
||||
}
|
||||
len = len - 1;
|
||||
}
|
||||
clearInterval(node.intervalID);
|
||||
node.intervalID = setInterval(sendMsgFromBuffer, node.rate);
|
||||
}
|
||||
node.status({fill:"blue",shape:"dot",text:node.buffer.length});
|
||||
done();
|
||||
}
|
||||
|
||||
149
packages/node_modules/@node-red/nodes/examples/function/delay/06 - Simple Queue with release
vendored
Normal file
149
packages/node_modules/@node-red/nodes/examples/function/delay/06 - Simple Queue with release
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
[
|
||||
{
|
||||
"id": "48d660b3a4109400",
|
||||
"type": "inject",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "inject",
|
||||
"props": [
|
||||
{
|
||||
"p": "payload"
|
||||
}
|
||||
],
|
||||
"repeat": "",
|
||||
"crontab": "",
|
||||
"once": false,
|
||||
"onceDelay": 0.1,
|
||||
"topic": "",
|
||||
"payload": "",
|
||||
"payloadType": "date",
|
||||
"x": 185,
|
||||
"y": 795,
|
||||
"wires": [
|
||||
[
|
||||
"e0f9e206681f3504"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "e0f9e206681f3504",
|
||||
"type": "delay",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "",
|
||||
"pauseType": "rate",
|
||||
"timeout": "5",
|
||||
"timeoutUnits": "seconds",
|
||||
"rate": "1",
|
||||
"nbRateUnits": "30",
|
||||
"rateUnits": "second",
|
||||
"randomFirst": "1",
|
||||
"randomLast": "5",
|
||||
"randomUnits": "seconds",
|
||||
"drop": false,
|
||||
"allowrate": false,
|
||||
"outputs": 1,
|
||||
"x": 430,
|
||||
"y": 795,
|
||||
"wires": [
|
||||
[
|
||||
"e470f1d794e1bef9",
|
||||
"af7cea1dfb797a75"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "943543cf7a1958e4",
|
||||
"type": "change",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "set flush to 1",
|
||||
"rules": [
|
||||
{
|
||||
"t": "set",
|
||||
"p": "flush",
|
||||
"pt": "msg",
|
||||
"to": "1",
|
||||
"tot": "num"
|
||||
},
|
||||
{
|
||||
"t": "delete",
|
||||
"p": "payload",
|
||||
"pt": "msg"
|
||||
}
|
||||
],
|
||||
"action": "",
|
||||
"property": "",
|
||||
"from": "",
|
||||
"to": "",
|
||||
"reg": false,
|
||||
"x": 510,
|
||||
"y": 915,
|
||||
"wires": [
|
||||
[
|
||||
"e0f9e206681f3504"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "e470f1d794e1bef9",
|
||||
"type": "function",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "Do something that takes a few seconds",
|
||||
"func": "\n//send on the message between 3 and 6 seconds later\nsetTimeout(\n function() { \n node.send(msg) \n }, \n Math.random() * 3000 + 3000\n);\nreturn null;",
|
||||
"outputs": 1,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 760,
|
||||
"y": 795,
|
||||
"wires": [
|
||||
[
|
||||
"943543cf7a1958e4",
|
||||
"859258551b8389b7"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "af7cea1dfb797a75",
|
||||
"type": "debug",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "IN",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
"console": false,
|
||||
"tostatus": false,
|
||||
"complete": "payload",
|
||||
"targetType": "msg",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 710,
|
||||
"y": 735,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "859258551b8389b7",
|
||||
"type": "debug",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "OUT",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
"console": false,
|
||||
"tostatus": false,
|
||||
"complete": "payload",
|
||||
"targetType": "msg",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 895,
|
||||
"y": 735,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "ecaaf26326da10ee",
|
||||
"type": "comment",
|
||||
"z": "9e5f48c16729e4f0",
|
||||
"name": "Simple Queue with release",
|
||||
"info": "This example shows how to use a delay node set to rate limit mode as a simple queue to feed a\nprocess that may take some time to complete. Once that process completes the feedback is then\nset to flush out the next message - thus running the \"loop\" as fast as possible with no overlaps.\n\n**Note**: only the `msg.flush` property msut be set - otherwise the other properties that are fed \nback will be added as another new message to the queue.",
|
||||
"x": 235,
|
||||
"y": 915,
|
||||
"wires": []
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user