mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
let tail node accept filename dynamically
This commit is contained in:
parent
78972a68ab
commit
d1cf309214
@ -48,10 +48,10 @@
|
|||||||
filetype: {value:"text"},
|
filetype: {value:"text"},
|
||||||
split: {value:"[\\r]{0,1}\\n"},
|
split: {value:"[\\r]{0,1}\\n"},
|
||||||
filename: {value:""},
|
filename: {value:""},
|
||||||
inputs: {value:1}
|
inputs: {value:0}
|
||||||
},
|
},
|
||||||
color:"BurlyWood",
|
color:"BurlyWood",
|
||||||
inputs:1,
|
inputs:0,
|
||||||
outputs:1,
|
outputs:1,
|
||||||
icon: "file.png",
|
icon: "file.png",
|
||||||
label: function() {
|
label: function() {
|
||||||
@ -68,11 +68,8 @@
|
|||||||
},
|
},
|
||||||
oneditsave: function() {
|
oneditsave: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
if($("#node-input-filename").val()===""){
|
if ($("#node-input-filename").val()==="") { that.inputs = 1; }
|
||||||
that.inputs = 1;
|
else { that.inputs = 0; }
|
||||||
} else {
|
|
||||||
that.inputs = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -30,7 +30,6 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
msg.payload = Buffer.from(data,"binary");
|
msg.payload = Buffer.from(data,"binary");
|
||||||
//msg.payload = data;
|
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,8 +54,6 @@ module.exports = function(RED) {
|
|||||||
node.on('input', function (msg) {
|
node.on('input', function (msg) {
|
||||||
if (!msg.hasOwnProperty("filename")) {
|
if (!msg.hasOwnProperty("filename")) {
|
||||||
node.error(RED._("tail.state.nofilename"));
|
node.error(RED._("tail.state.nofilename"));
|
||||||
}else if (msg.filename === node.filename) {
|
|
||||||
node.warn(RED._("tail.state.nofilechange"));
|
|
||||||
} else if (msg.filename === "") {
|
} else if (msg.filename === "") {
|
||||||
node.filename = "";
|
node.filename = "";
|
||||||
if (node.tail) { node.tail.unwatch(); }
|
if (node.tail) { node.tail.unwatch(); }
|
||||||
@ -67,7 +64,7 @@ module.exports = function(RED) {
|
|||||||
if (node.tail) { node.tail.unwatch(); }
|
if (node.tail) { node.tail.unwatch(); }
|
||||||
if (!node.tout) { fileTail(); }
|
if (!node.tout) { fileTail(); }
|
||||||
node.status({ fill: "green", text: node.filename });
|
node.status({ fill: "green", text: node.filename });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-tail",
|
"name": "node-red-node-tail",
|
||||||
"version": "0.0.3",
|
"version": "0.1.0",
|
||||||
"description": "A node to tail files for Node-RED",
|
"description": "A node to tail files for Node-RED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tail": "^2.0.2"
|
"tail": "^2.0.2"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user