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"},
|
||||
split: {value:"[\\r]{0,1}\\n"},
|
||||
filename: {value:""},
|
||||
inputs: {value:1}
|
||||
inputs: {value:0}
|
||||
},
|
||||
color:"BurlyWood",
|
||||
inputs:1,
|
||||
inputs:0,
|
||||
outputs:1,
|
||||
icon: "file.png",
|
||||
label: function() {
|
||||
@ -68,11 +68,8 @@
|
||||
},
|
||||
oneditsave: function() {
|
||||
var that = this;
|
||||
if($("#node-input-filename").val()===""){
|
||||
that.inputs = 1;
|
||||
} else {
|
||||
that.inputs = 0;
|
||||
}
|
||||
if ($("#node-input-filename").val()==="") { that.inputs = 1; }
|
||||
else { that.inputs = 0; }
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -30,7 +30,6 @@ module.exports = function(RED) {
|
||||
}
|
||||
else {
|
||||
msg.payload = Buffer.from(data,"binary");
|
||||
//msg.payload = data;
|
||||
node.send(msg);
|
||||
}
|
||||
}
|
||||
@ -55,8 +54,6 @@ module.exports = function(RED) {
|
||||
node.on('input', function (msg) {
|
||||
if (!msg.hasOwnProperty("filename")) {
|
||||
node.error(RED._("tail.state.nofilename"));
|
||||
}else if (msg.filename === node.filename) {
|
||||
node.warn(RED._("tail.state.nofilechange"));
|
||||
} else if (msg.filename === "") {
|
||||
node.filename = "";
|
||||
if (node.tail) { node.tail.unwatch(); }
|
||||
@ -67,7 +64,7 @@ module.exports = function(RED) {
|
||||
if (node.tail) { node.tail.unwatch(); }
|
||||
if (!node.tout) { fileTail(); }
|
||||
node.status({ fill: "green", text: node.filename });
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-node-tail",
|
||||
"version": "0.0.3",
|
||||
"version": "0.1.0",
|
||||
"description": "A node to tail files for Node-RED",
|
||||
"dependencies": {
|
||||
"tail": "^2.0.2"
|
||||
|
Loading…
x
Reference in New Issue
Block a user