mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add port labels to inject node (to show types)
This commit is contained in:
parent
84077505b0
commit
4a8a5ed8d4
@ -181,9 +181,21 @@
|
|||||||
crontab: {value:""},
|
crontab: {value:""},
|
||||||
once: {value:false}
|
once: {value:false}
|
||||||
},
|
},
|
||||||
|
icon: "inject.png",
|
||||||
inputs:0,
|
inputs:0,
|
||||||
outputs:1,
|
outputs:1,
|
||||||
icon: "inject.png",
|
outputLabels: function(index) {
|
||||||
|
var labels = { str:"string", num:"number", bool:"boolean", json:"object", flow:"flow context", global:"global context" };
|
||||||
|
var lab = labels[this.payloadType] || this.payloadType;
|
||||||
|
if (lab === "object") {
|
||||||
|
try {
|
||||||
|
lab = typeof JSON.parse(this.payload);
|
||||||
|
if (lab === "object") {
|
||||||
|
if (Array.isArray(JSON.parse(this.payload))) { lab = "Array"; }
|
||||||
|
}
|
||||||
|
} catch(e) { lab = "Invalid JSON Object"; }
|
||||||
|
}
|
||||||
|
return lab; },
|
||||||
label: function() {
|
label: function() {
|
||||||
var suffix = "";
|
var suffix = "";
|
||||||
// if fire once then add small indication
|
// if fire once then add small indication
|
||||||
|
Loading…
Reference in New Issue
Block a user