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);
var nsCount = 0;
for(var i=0;i<data.length;i++) {
for (var i=0;i<data.length;i++) {
var ns = data[i];
if (ns.module != "node-red") {
nsCount++;
@ -81,7 +81,7 @@ var RED = (function() {
var parts = topic.split("/");
var node = RED.nodes.node(parts[1]);
if (node) {
if (msg.text) {
if (msg.hasOwnProperty("text")) {
msg.text = node._(msg.text.toString(),{defaultValue:msg.text.toString()});
}
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}
]},
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-add",label:RED._("menu.label.add"),onselect:RED.workspaces.add},
{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.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();
$("#main-container").show();

View File

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