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

Add repeat indicator to inject node label

Closes #887
This commit is contained in:
Nick O'Leary 2016-05-17 23:36:09 +01:00
parent 9e26aeea1d
commit e50659af09

View File

@ -1,5 +1,5 @@
<!-- <!--
Copyright 2013,2015 IBM Corp. Copyright 2013, 2016 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -200,28 +200,32 @@
outputs:1, outputs:1,
icon: "inject.png", icon: "inject.png",
label: function() { label: function() {
var suffix = "";
if (this.repeat || this.crontab) {
suffix = " ⟳";
}
if (this.name) { if (this.name) {
return this.name; return this.name+suffix;
} else if (this.payloadType === "string" || } else if (this.payloadType === "string" ||
this.payloadType === "str" || this.payloadType === "str" ||
this.payloadType === "num" || this.payloadType === "num" ||
this.payloadType === "bool" || this.payloadType === "bool" ||
this.payloadType === "json") { this.payloadType === "json") {
if ((this.topic !== "") && ((this.topic.length + this.payload.length) <= 32)) { if ((this.topic !== "") && ((this.topic.length + this.payload.length) <= 32)) {
return this.topic + ":" + this.payload; return this.topic + ":" + this.payload+suffix;
} else if (this.payload.length > 0 && this.payload.length < 24) { } else if (this.payload.length > 0 && this.payload.length < 24) {
return this.payload; return this.payload+suffix;
} else { } else {
return this._("inject.inject"); return this._("inject.inject")+suffix;
} }
} else if (this.payloadType === 'date') { } else if (this.payloadType === 'date') {
return this._("inject.timestamp") return this._("inject.timestamp")+suffix;
} else if (this.payloadType === 'flow' && this.payload.length < 19) { } else if (this.payloadType === 'flow' && this.payload.length < 19) {
return 'flow.'+this.payload; return 'flow.'+this.payload+suffix;
} else if (this.payloadType === 'global' && this.payload.length < 17) { } else if (this.payloadType === 'global' && this.payload.length < 17) {
return 'global.'+this.payload; return 'global.'+this.payload+suffix;
} else { } else {
return this._("inject.inject"); return this._("inject.inject")+suffix;
} }
}, },
labelStyle: function() { labelStyle: function() {