mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add updateConfigNodeUsers function to editor
This commit is contained in:
parent
5f047633c3
commit
9d52ed5ff6
@ -165,27 +165,7 @@ RED.nodes = (function() {
|
||||
}
|
||||
}
|
||||
n.dirty = true;
|
||||
var updatedConfigNode = false;
|
||||
for (var d in n._def.defaults) {
|
||||
if (n._def.defaults.hasOwnProperty(d)) {
|
||||
var property = n._def.defaults[d];
|
||||
if (property.type) {
|
||||
var type = registry.getNodeType(property.type);
|
||||
if (type && type.category == "config") {
|
||||
var configNode = configNodes[n[d]];
|
||||
if (configNode) {
|
||||
if (configNode.users.indexOf(n) === -1) {
|
||||
updatedConfigNode = true;
|
||||
configNode.users.push(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (updatedConfigNode) {
|
||||
// TODO: refresh config tab?
|
||||
}
|
||||
updateConfigNodeUsers(n);
|
||||
if (n._def.category == "subflows" && typeof n.i === "undefined") {
|
||||
var nextId = 0;
|
||||
RED.nodes.eachNode(function(node) {
|
||||
@ -990,6 +970,26 @@ RED.nodes = (function() {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Update any config nodes referenced by the provided node to ensure their 'users' list is correct
|
||||
function updateConfigNodeUsers(n) {
|
||||
for (var d in n._def.defaults) {
|
||||
if (n._def.defaults.hasOwnProperty(d)) {
|
||||
var property = n._def.defaults[d];
|
||||
if (property.type) {
|
||||
var type = registry.getNodeType(property.type);
|
||||
if (type && type.category == "config") {
|
||||
var configNode = configNodes[n[d]];
|
||||
if (configNode) {
|
||||
if (configNode.users.indexOf(n) === -1) {
|
||||
configNode.users.push(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
registry:registry,
|
||||
setNodeList: registry.setNodeList,
|
||||
@ -1061,6 +1061,7 @@ RED.nodes = (function() {
|
||||
getAllFlowNodes: getAllFlowNodes,
|
||||
createExportableNodeSet: createExportableNodeSet,
|
||||
createCompleteNodeSet: createCompleteNodeSet,
|
||||
updateConfigNodeUsers: updateConfigNodeUsers,
|
||||
id: getID,
|
||||
dirty: function(d) {
|
||||
if (d == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user