From b44ecd8819c4b8a6e484ee2fdeb085de9b542111 Mon Sep 17 00:00:00 2001
From: Hiroyasu Nishiyama
Date: Sat, 14 Jul 2018 14:47:40 +0900
Subject: [PATCH] fix context access appearance of inject node in editor
---
nodes/core/core/20-inject.html | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/nodes/core/core/20-inject.html b/nodes/core/core/20-inject.html
index 87bb807c6..f33fc1385 100644
--- a/nodes/core/core/20-inject.html
+++ b/nodes/core/core/20-inject.html
@@ -238,12 +238,8 @@ If you want every 20 minutes from now - use the "interval" option.
return this._("inject.timestamp")+suffix;
}
} else if (this.payloadType === 'flow' || this.payloadType === 'global') {
- var key = this.payload;
- var m = /^#:\((\S+?)\)::(.*)$/.exec(key);
- if (m) {
- key = m[2];
- }
- return 'flow.'+key+suffix;
+ var key = RED.utils.parseContextKey(this.payload);
+ return this.payloadType+"."+key.key+suffix;
} else {
return this._("inject.inject")+suffix;
}
@@ -505,7 +501,13 @@ If you want every 20 minutes from now - use the "interval" option.
if (this.changed) {
return RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.undeployedChanges")}),"warning");
}
- var label = (this.name||this.payload);
+ var payload = this.payload;
+ if ((this.payloadType === 'flow') ||
+ (this.payloadType === 'global')) {
+ var key = RED.utils.parseContextKey(payload);
+ payload = this.payloadType+"."+key.key;
+ }
+ var label = (this.name||payload);
if (label.length > 30) {
label = label.substring(0,50)+"...";
}