Merge branch 'dev' into outliner

This commit is contained in:
Nick O'Leary 2020-05-05 17:47:59 +01:00
commit 9fbfc3d677
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
4 changed files with 35 additions and 39 deletions

View File

@ -224,38 +224,6 @@
return lab; return lab;
}, },
label: function() { label: function() {
if (Array.isArray(this.props)) {
// find the payload & topic
var payloadProperty;
var topicProperty;
var payload;
var payloadType;
var topic;
for (var i=0,l=this.props.length; i<l; i++) {
if (this.props[i].p === 'payload') {
payloadProperty = this.props[i];
} else if (this.props[i].p === 'topic' && this.props[i].vt === 'str') {
topicProperty = this.props[i];
}
}
// If no payload/topic are found, use the first property instead
if (this.props[0]){
payloadProperty = payloadProperty === undefined ? this.props[0] : payloadProperty;
topicProperty = topicProperty === undefined ? {v: payloadProperty.p} : topicProperty; // if no topic, use the property name of the payload
}
payload = payloadProperty === undefined ? "" : payloadProperty.v;
payloadType = payloadProperty === undefined ? "str" : payloadProperty.vt;
topic = topicProperty === undefined ? "" : topicProperty.v;
} else {
/* Legacy */
payload = this.payload;
payloadType = this.payloadType;
topic = this.topic;
}
var suffix = ""; var suffix = "";
// if fire once then add small indication // if fire once then add small indication
if (this.once) { if (this.once) {
@ -267,7 +235,34 @@
} }
if (this.name) { if (this.name) {
return this.name+suffix; return this.name+suffix;
} else if (payloadType === "string" || }
var payloadProperty;
var topicProperty;
var payload;
var payloadType;
var topic;
if (Array.isArray(this.props)) {
// find the payload & topic if they are set
for (var i=0,l=this.props.length; i<l; i++) {
if (this.props[i].p === 'payload') {
payloadProperty = this.props[i];
} else if (this.props[i].p === 'topic' && this.props[i].vt === 'str') {
topicProperty = this.props[i];
}
}
payload = payloadProperty === undefined ? "" : payloadProperty.v;
payloadType = payloadProperty === undefined ? "str" : payloadProperty.vt;
topic = topicProperty === undefined ? "" : topicProperty.v;
} else {
/* Legacy */
payload = this.payload || "";
payloadType = this.payloadType || "str";
topic = this.topic || "";
}
if (payloadType === "string" ||
payloadType === "str" || payloadType === "str" ||
payloadType === "num" || payloadType === "num" ||
payloadType === "bool" || payloadType === "bool" ||
@ -281,9 +276,9 @@
} }
} else if (payloadType === 'date' || payloadType === 'bin' || payloadType === 'env') { } else if (payloadType === 'date' || payloadType === 'bin' || payloadType === 'env') {
if ((topic !== "") && (topic.length <= 16)) { if ((topic !== "") && (topic.length <= 16)) {
return topic + ":" + this._(`inject.label.${payloadType}`)+suffix; return topic + ":" + this._('inject.label.'+payloadType)+suffix;
} else { } else {
return this._(`inject.label.${payloadType}`)+suffix; return this._('inject.label.'+payloadType)+suffix;
} }
} else if (payloadType === 'flow' || payloadType === 'global') { } else if (payloadType === 'flow' || payloadType === 'global') {
var key = RED.utils.parseContextKey(payload); var key = RED.utils.parseContextKey(payload);

View File

@ -74,7 +74,7 @@ module.exports = function(RED) {
buffer = (node.datatype == 'buffer') ? Buffer.alloc(0) : ""; buffer = (node.datatype == 'buffer') ? Buffer.alloc(0) : "";
node.connected = true; node.connected = true;
node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port})); node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));
node.status({fill:"green",shape:"dot",text:"common.status.connected"}); node.status({fill:"green",shape:"dot",text:"common.status.connected",_session:{type:"tcp",id:id}});
}); });
client.setKeepAlive(true,120000); client.setKeepAlive(true,120000);
connectionPool[id] = client; connectionPool[id] = client;
@ -121,7 +121,7 @@ module.exports = function(RED) {
client.on('close', function() { client.on('close', function() {
delete connectionPool[id]; delete connectionPool[id];
node.connected = false; node.connected = false;
node.status({fill:"red",shape:"ring",text:"common.status.disconnected"}); node.status({fill:"red",shape:"ring",text:"common.status.disconnected",_session:{type:"tcp",id:id}});
if (!node.closing) { if (!node.closing) {
if (end) { // if we were asked to close then try to reconnect once very quick. if (end) { // if we were asked to close then try to reconnect once very quick.
end = false; end = false;

View File

@ -732,7 +732,7 @@
"errors": { "errors": {
"csv_js": "This node only handles CSV strings or js objects.", "csv_js": "This node only handles CSV strings or js objects.",
"obj_csv": "No columns template specified for object -> CSV.", "obj_csv": "No columns template specified for object -> CSV.",
"bad_csv": "Malformed CSV file - output probably corrupt." "bad_csv": "Malformed CSV data - output probably corrupt."
} }
}, },
"html": { "html": {

View File

@ -726,7 +726,8 @@
}, },
"errors": { "errors": {
"csv_js": "本ードが処理できる形式は、CSV文字列またはJSONのみです", "csv_js": "本ードが処理できる形式は、CSV文字列またはJSONのみです",
"obj_csv": "オブジェクトをCSVへ変換する際の列名が設定されていません" "obj_csv": "オブジェクトをCSVへ変換する際の列名が設定されていません",
"bad_csv": "不正なCSVデータ - 出力の修正を試みました"
} }
}, },
"html": { "html": {