mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 11:36:53 +00:00
Fix appearrence of change node label for flow/global ref (#1792)
* fix appearence of change node label for flow/global ref * use RED.utils.parseContextKey
This commit is contained in:
parent
d8cf86fd6f
commit
6e9fe3248a
@ -54,6 +54,10 @@
|
|||||||
outputs: 1,
|
outputs: 1,
|
||||||
icon: "swap.png",
|
icon: "swap.png",
|
||||||
label: function() {
|
label: function() {
|
||||||
|
function prop2name(type, key) {
|
||||||
|
var result = RED.utils.parseContextKey(key);
|
||||||
|
return type +"." +result.key;
|
||||||
|
}
|
||||||
if (this.name) {
|
if (this.name) {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
@ -70,13 +74,13 @@
|
|||||||
} else {
|
} else {
|
||||||
if (this.rules.length == 1) {
|
if (this.rules.length == 1) {
|
||||||
if (this.rules[0].t === "set") {
|
if (this.rules[0].t === "set") {
|
||||||
return this._("change.label.set",{property:(this.rules[0].pt||"msg")+"."+this.rules[0].p});
|
return this._("change.label.set",{property:prop2name((this.rules[0].pt||"msg"), this.rules[0].p)});
|
||||||
} else if (this.rules[0].t === "change") {
|
} else if (this.rules[0].t === "change") {
|
||||||
return this._("change.label.change",{property:(this.rules[0].pt||"msg")+"."+this.rules[0].p});
|
return this._("change.label.change",{property:prop2name((this.rules[0].pt||"msg"), this.rules[0].p)});
|
||||||
} else if (this.rules[0].t === "move") {
|
} else if (this.rules[0].t === "move") {
|
||||||
return this._("change.label.move",{property:(this.rules[0].pt||"msg")+"."+this.rules[0].p});
|
return this._("change.label.move",{property:prop2name((this.rules[0].pt||"msg"), this.rules[0].p)});
|
||||||
} else {
|
} else {
|
||||||
return this._("change.label.delete",{property:(this.rules[0].pt||"msg")+"."+this.rules[0].p});
|
return this._("change.label.delete",{property:prop2name((this.rules[0].pt||"msg"), this.rules[0].p)});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return this._("change.label.changeCount",{count:this.rules.length});
|
return this._("change.label.changeCount",{count:this.rules.length});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user