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

Fix node.status to check hasOwnProperty("text")

This commit is contained in:
Dave Conway-Jones 2016-07-06 17:22:45 +01:00
parent c5753a013c
commit e360e57a5b
2 changed files with 9 additions and 9 deletions

View File

@ -27,7 +27,7 @@ var RED = (function() {
RED.nodes.setNodeList(data); RED.nodes.setNodeList(data);
var nsCount = 0; var nsCount = 0;
for(var i=0;i<data.length;i++) { for (var i=0;i<data.length;i++) {
var ns = data[i]; var ns = data[i];
if (ns.module != "node-red") { if (ns.module != "node-red") {
nsCount++; nsCount++;
@ -81,7 +81,7 @@ var RED = (function() {
var parts = topic.split("/"); var parts = topic.split("/");
var node = RED.nodes.node(parts[1]); var node = RED.nodes.node(parts[1]);
if (node) { if (node) {
if (msg.text) { if (msg.hasOwnProperty("text")) {
msg.text = node._(msg.text.toString(),{defaultValue:msg.text.toString()}); msg.text = node._(msg.text.toString(),{defaultValue:msg.text.toString()});
} }
node.status = msg; node.status = msg;
@ -188,7 +188,7 @@ var RED = (function() {
{id:"menu-item-export-library",label:RED._("menu.label.library"),disabled:true,onselect:RED.library.export} {id:"menu-item-export-library",label:RED._("menu.label.library"),disabled:true,onselect:RED.library.export}
]}, ]},
null, null,
{id:"menu-item-config-nodes",label:RED._("menu.label.displayConfig"),onselect:function(){}}, {id:"menu-item-config-nodes",label:RED._("menu.label.displayConfig"),onselect:function() {}},
{id:"menu-item-workspace",label:RED._("menu.label.flows"),options:[ {id:"menu-item-workspace",label:RED._("menu.label.flows"),options:[
{id:"menu-item-workspace-add",label:RED._("menu.label.add"),onselect:RED.workspaces.add}, {id:"menu-item-workspace-add",label:RED._("menu.label.add"),onselect:RED.workspaces.add},
{id:"menu-item-workspace-edit",label:RED._("menu.label.rename"),onselect:RED.workspaces.edit}, {id:"menu-item-workspace-edit",label:RED._("menu.label.rename"),onselect:RED.workspaces.edit},
@ -222,7 +222,7 @@ var RED = (function() {
RED.deploy.init(RED.settings.theme("deployButton",null)); RED.deploy.init(RED.settings.theme("deployButton",null));
RED.keyboard.add("workspace", /* ? */ 191,{shift:true},function(){RED.keyboard.showHelp();d3.event.preventDefault();}); RED.keyboard.add("workspace", /* ? */ 191,{shift:true},function() {RED.keyboard.showHelp();d3.event.preventDefault();});
RED.comms.connect(); RED.comms.connect();
$("#main-container").show(); $("#main-container").show();

View File

@ -39,7 +39,7 @@ function Flow(global,flow) {
var configNodes = Object.keys(flow.configs); var configNodes = Object.keys(flow.configs);
var configNodeAttempts = {}; var configNodeAttempts = {};
while(configNodes.length > 0) { while (configNodes.length > 0) {
id = configNodes.shift(); id = configNodes.shift();
node = flow.configs[id]; node = flow.configs[id];
if (!activeNodes[id]) { if (!activeNodes[id]) {
@ -176,7 +176,7 @@ function Flow(global,flow) {
var targetStatusNodes = null; var targetStatusNodes = null;
var reportingNode = node; var reportingNode = node;
var handled = false; var handled = false;
while(reportingNode && !handled) { while (reportingNode && !handled) {
targetStatusNodes = statusNodeMap[reportingNode.z]; targetStatusNodes = statusNodeMap[reportingNode.z];
if (targetStatusNodes) { if (targetStatusNodes) {
targetStatusNodes.forEach(function(targetStatusNode) { targetStatusNodes.forEach(function(targetStatusNode) {
@ -193,8 +193,8 @@ function Flow(global,flow) {
} }
} }
}; };
if (statusMessage.text) { if (statusMessage.hasOwnProperty("text")) {
message.status.text = statusMessage.text; message.status.text = statusMessage.text.toString();
} }
targetStatusNode.receive(message); targetStatusNode.receive(message);
handled = true; handled = true;
@ -485,7 +485,7 @@ function createSubflow(sf,sfn,subflows,globalSubflows,activeNodes) {
subflowNode.instanceNodes = {}; subflowNode.instanceNodes = {};
nodes.forEach(function(node) { nodes.forEach(function(node) {
subflowNode.instanceNodes[node.id] = node; subflowNode.instanceNodes[node.id] = node;
}); });
return nodes; return nodes;
} }