Ensure link call node label updates when link-in changes

This commit is contained in:
Nick O'Leary 2021-10-14 12:00:27 +01:00
parent de4944cd83
commit 21fd6e3c21
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 9 additions and 4 deletions

View File

@ -242,6 +242,12 @@
}, },
oneditsave: function() { oneditsave: function() {
onEditSave(this); onEditSave(this);
// In case the name has changed, ensure any link call nodes on this
// tab are redrawn with the updated name
var localCallNodes = RED.nodes.filterNodes({z:RED.workspaces.active(), type:"link call"});
localCallNodes.forEach(function(node) {
node.dirty = true;
});
}, },
onadd: onAdd, onadd: onAdd,
oneditresize: resizeNodeList oneditresize: resizeNodeList
@ -267,12 +273,12 @@
} }
if (this.links.length > 0) { if (this.links.length > 0) {
var targetNode = RED.nodes.node(this.links[0]); var targetNode = RED.nodes.node(this.links[0]);
return targetNode && (targetNode.name || targetNode.id); return targetNode && (targetNode.name || this._("link.linkCall"));
} }
return this._("link.linkCall"); return this._("inject.none");
}, },
labelStyle: function() { labelStyle: function() {
return (this.name || this.links.length > 0)?"node_label_italic":""; return this.name?"node_label_italic":"";
}, },
oneditprepare: function() { oneditprepare: function() {
onEditPrepare(this,"link in"); onEditPrepare(this,"link in");
@ -283,7 +289,6 @@
oneditresize: resizeNodeList oneditresize: resizeNodeList
}); });
RED.nodes.registerType('link out',{ RED.nodes.registerType('link out',{
category: 'common', category: 'common',
color:"#ddd",//"#87D8CF", color:"#ddd",//"#87D8CF",