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

Remove 'retined' property from node.status calls

This commit is contained in:
Nick O'Leary 2014-05-30 20:30:26 +01:00
parent 2cdaed1325
commit 70147d0b6b
6 changed files with 32 additions and 32 deletions

View File

@ -59,10 +59,10 @@ module.exports = function(RED) {
this.board = this.serverConfig.board; this.board = this.serverConfig.board;
//this.repeat = this.serverConfig.repeat; //this.repeat = this.serverConfig.repeat;
var node = this; var node = this;
node.status({fill:"red",shape:"ring",text:"connecting"},true); node.status({fill:"red",shape:"ring",text:"connecting"});
node.board.on('connect', function() { node.board.on('connect', function() {
node.status({fill:"green",shape:"dot",text:"connected"},true); node.status({fill:"green",shape:"dot",text:"connected"});
//console.log("i",node.state,node.pin); //console.log("i",node.state,node.pin);
if (node.state == "ANALOG") { if (node.state == "ANALOG") {
node.board.on('analogChange', function(e) { node.board.on('analogChange', function(e) {
@ -102,10 +102,10 @@ module.exports = function(RED) {
if (typeof this.serverConfig === "object") { if (typeof this.serverConfig === "object") {
this.board = this.serverConfig.board; this.board = this.serverConfig.board;
var node = this; var node = this;
node.status({fill:"red",shape:"ring",text:"connecting"},true); node.status({fill:"red",shape:"ring",text:"connecting"});
node.board.on('connect', function() { node.board.on('connect', function() {
node.status({fill:"green",shape:"dot",text:"connected"},true); node.status({fill:"green",shape:"dot",text:"connected"});
//console.log("o",node.state,node.pin); //console.log("o",node.state,node.pin);
node.board.pinMode(node.pin, node.state); node.board.pinMode(node.pin, node.state);
node.on("input", function(msg) { node.on("input", function(msg) {

View File

@ -79,7 +79,7 @@ module.exports = function(RED) {
this.brokerConfig = RED.nodes.getNode(this.broker); this.brokerConfig = RED.nodes.getNode(this.broker);
var node = this; var node = this;
if (this.brokerConfig) { if (this.brokerConfig) {
this.status({fill:"red",shape:"ring",text:"disconnected"},true); this.status({fill:"red",shape:"ring",text:"disconnected"});
this.client = connectionPool.get(this.brokerConfig.broker,this.brokerConfig.port,this.brokerConfig.clientid,this.brokerConfig.username,this.brokerConfig.password); this.client = connectionPool.get(this.brokerConfig.broker,this.brokerConfig.port,this.brokerConfig.clientid,this.brokerConfig.username,this.brokerConfig.password);
var node = this; var node = this;
this.client.subscribe(this.topic,2,function(topic,payload,qos,retain) { this.client.subscribe(this.topic,2,function(topic,payload,qos,retain) {
@ -90,10 +90,10 @@ module.exports = function(RED) {
node.send(msg); node.send(msg);
}); });
this.client.on("connectionlost",function() { this.client.on("connectionlost",function() {
node.status({fill:"red",shape:"ring",text:"disconnected"},true); node.status({fill:"red",shape:"ring",text:"disconnected"});
}); });
this.client.on("connect",function() { this.client.on("connect",function() {
node.status({fill:"green",shape:"dot",text:"connected"},true); node.status({fill:"green",shape:"dot",text:"connected"});
}); });
this.client.connect(); this.client.connect();
} else { } else {
@ -131,10 +131,10 @@ module.exports = function(RED) {
} }
}); });
this.client.on("connectionlost",function() { this.client.on("connectionlost",function() {
node.status({fill:"red",shape:"ring",text:"disconnected"},true); node.status({fill:"red",shape:"ring",text:"disconnected"});
}); });
this.client.on("connect",function() { this.client.on("connect",function() {
node.status({fill:"green",shape:"dot",text:"connected"},true); node.status({fill:"green",shape:"dot",text:"connected"});
}); });
this.client.connect(); this.client.connect();

View File

@ -71,10 +71,10 @@ module.exports = function(RED) {
}); });
}); });
node.port.on('ready', function() { node.port.on('ready', function() {
node.status({fill:"green",shape:"dot",text:"connected"},true); node.status({fill:"green",shape:"dot",text:"connected"});
}); });
node.port.on('closed', function() { node.port.on('closed', function() {
node.status({fill:"red",shape:"ring",text:"not connected"},true); node.status({fill:"red",shape:"ring",text:"not connected"});
}); });
} else { } else {
this.error("missing serial config"); this.error("missing serial config");
@ -97,7 +97,7 @@ module.exports = function(RED) {
if (this.serialConfig) { if (this.serialConfig) {
var node = this; var node = this;
node.status({fill:"grey",shape:"dot",text:"unknown"},true); node.status({fill:"grey",shape:"dot",text:"unknown"});
node.port = serialPool.get(this.serialConfig.serialport, node.port = serialPool.get(this.serialConfig.serialport,
this.serialConfig.serialbaud, this.serialConfig.serialbaud,
this.serialConfig.databits, this.serialConfig.databits,
@ -108,10 +108,10 @@ module.exports = function(RED) {
node.send({ "payload": msg }); node.send({ "payload": msg });
}); });
this.port.on('ready', function() { this.port.on('ready', function() {
node.status({fill:"green",shape:"dot",text:"connected"},true); node.status({fill:"green",shape:"dot",text:"connected"});
}); });
this.port.on('closed', function() { this.port.on('closed', function() {
node.status({fill:"red",shape:"ring",text:"not connected"},true); node.status({fill:"red",shape:"ring",text:"not connected"});
}); });
} else { } else {
this.error("missing serial config"); this.error("missing serial config");

View File

@ -41,12 +41,12 @@ module.exports = function(RED) {
var reconnectTimeout; var reconnectTimeout;
var setupTcpClient = function() { var setupTcpClient = function() {
node.log("connecting to "+node.host+":"+node.port); node.log("connecting to "+node.host+":"+node.port);
node.status({fill:"grey",shape:"dot",text:"connecting"},true); node.status({fill:"grey",shape:"dot",text:"connecting"});
var id = (1+Math.random()*4294967295).toString(16); var id = (1+Math.random()*4294967295).toString(16);
client = net.connect(node.port, node.host, function() { client = net.connect(node.port, node.host, function() {
buffer = (node.datatype == 'buffer')? new Buffer(0):""; buffer = (node.datatype == 'buffer')? new Buffer(0):"";
node.log("connected to "+node.host+":"+node.port); node.log("connected to "+node.host+":"+node.port);
node.status({fill:"green",shape:"dot",text:"connected"},true); node.status({fill:"green",shape:"dot",text:"connected"});
}); });
connectionPool[id] = client; connectionPool[id] = client;
@ -198,11 +198,11 @@ module.exports = function(RED) {
var setupTcpClient = function() { var setupTcpClient = function() {
node.log("connecting to "+node.host+":"+node.port); node.log("connecting to "+node.host+":"+node.port);
node.status({fill:"grey",shape:"dot",text:"connecting"},true); node.status({fill:"grey",shape:"dot",text:"connecting"});
client = net.connect(node.port, node.host, function() { client = net.connect(node.port, node.host, function() {
connected = true; connected = true;
node.log("connected to "+node.host+":"+node.port); node.log("connected to "+node.host+":"+node.port);
node.status({fill:"green",shape:"dot",text:"connected"},true); node.status({fill:"green",shape:"dot",text:"connected"});
}); });
client.on('error', function (err) { client.on('error', function (err) {
node.log('error : '+err); node.log('error : '+err);
@ -211,7 +211,7 @@ module.exports = function(RED) {
}); });
client.on('close', function() { client.on('close', function() {
node.log("connection lost to "+node.host+":"+node.port); node.log("connection lost to "+node.host+":"+node.port);
node.status({fill:"red",shape:"ring",text:"disconnected"},true); node.status({fill:"red",shape:"ring",text:"disconnected"});
connected = false; connected = false;
client.destroy(); client.destroy();
if (!node.closing) { if (!node.closing) {

View File

@ -69,7 +69,7 @@ module.exports = function(RED) {
this.on("input", function(msg) { this.on("input", function(msg) {
if (msg != null) { if (msg != null) {
node.status({fill:"blue",shape:"dot",text:"sending"},true); node.status({fill:"blue",shape:"dot",text:"sending"});
if (smtpTransport) { if (smtpTransport) {
smtpTransport.sendMail({ smtpTransport.sendMail({
from: node.userid, // sender address from: node.userid, // sender address
@ -79,10 +79,10 @@ module.exports = function(RED) {
}, function(error, response) { }, function(error, response) {
if (error) { if (error) {
node.error(error); node.error(error);
node.status({fill:"red",shape:"ring",text:"post error"},true); node.status({fill:"red",shape:"ring",text:"post error"});
} else { } else {
node.log("Message sent: " + response.message); node.log("Message sent: " + response.message);
node.status({},true); node.status({});
} }
}); });
} }
@ -135,7 +135,7 @@ module.exports = function(RED) {
this.on("input", function(msg) { this.on("input", function(msg) {
imap.once('ready', function() { imap.once('ready', function() {
node.status({fill:"blue",shape:"dot",text:"fetching"},true); node.status({fill:"blue",shape:"dot",text:"fetching"});
var pay = {}; var pay = {};
imap.openBox('INBOX', true, function(err, box) { imap.openBox('INBOX', true, function(err, box) {
if (box.messages.total > 0) { if (box.messages.total > 0) {
@ -173,7 +173,7 @@ module.exports = function(RED) {
}); });
f.on('error', function(err) { f.on('error', function(err) {
node.warn('fetch error: ' + err); node.warn('fetch error: ' + err);
node.status({fill:"red",shape:"ring",text:"fetch error"},true); node.status({fill:"red",shape:"ring",text:"fetch error"});
}); });
f.on('end', function() { f.on('end', function() {
if (JSON.stringify(pay) !== oldmail) { if (JSON.stringify(pay) !== oldmail) {
@ -182,26 +182,26 @@ module.exports = function(RED) {
node.log('received new email: '+pay.topic); node.log('received new email: '+pay.topic);
} }
else { node.log('duplicate not sent: '+pay.topic); } else { node.log('duplicate not sent: '+pay.topic); }
//node.status({fill:"green",shape:"dot",text:"ok"},true); //node.status({fill:"green",shape:"dot",text:"ok"});
node.status({},true); node.status({});
imap.end(); imap.end();
}); });
} }
else { else {
node.log("you have achieved inbox zero"); node.log("you have achieved inbox zero");
//node.status({fill:"green",shape:"dot",text:"ok"},true); //node.status({fill:"green",shape:"dot",text:"ok"});
node.status({},true); node.status({});
imap.end(); imap.end();
} }
}); });
}); });
node.status({fill:"grey",shape:"dot",text:"connecting"},true); node.status({fill:"grey",shape:"dot",text:"connecting"});
imap.connect(); imap.connect();
}); });
imap.on('error', function(err) { imap.on('error', function(err) {
node.log(err); node.log(err);
node.status({fill:"red",shape:"ring",text:"connect error"},true); node.status({fill:"red",shape:"ring",text:"connect error"});
}); });
this.on("error", function(err) { this.on("error", function(err) {

View File

@ -137,7 +137,7 @@ Node.prototype.error = function(msg) {
/** /**
* status: { fill:"red|green", shape:"dot|ring", text:"blah" } * status: { fill:"red|green", shape:"dot|ring", text:"blah" }
*/ */
Node.prototype.status = function(status,retain) { Node.prototype.status = function(status) {
comms.publish("status/"+this.id,status,retain); comms.publish("status/"+this.id,status,true);
} }
module.exports = Node; module.exports = Node;