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

Better attempt at making Inject node label more "useful".

Addresses Issue #489
This commit is contained in:
Dave C-J 2014-11-16 18:22:33 +00:00
parent 7da108e129
commit 977a9e1c83

View File

@ -138,15 +138,17 @@
icon: "inject.png", icon: "inject.png",
label: function() { label: function() {
if (this.payloadType === "string") { if (this.payloadType === "string") {
return this.name||this.topic||this.payload||"inject"; if ((this.topic.length + this.payload.length) <= 32) {
//if (this.topic !== "") { return this.name||this.topic + ":" + this.payload;
// return this.name||this.topic +" : "+this.payload||this.topic;
//}
//else {
// return this.name||this.payload||this.topic||"inject";
//}
} }
else { return this.name||this.topic||"inject"; } else if (this.payload.length < 24) {
return this.name||":"+this.payload;
}
}
if ((this.topic.length < 24) && (this.topic.length > 0)) {
return this.name||this.topic+":";
}
else { return this.name||(this.payloadType==="date"?"timestamp":null)||"inject"; }
}, },
labelStyle: function() { labelStyle: function() {
return this.name?"node_label_italic":""; return this.name?"node_label_italic":"";