Enabling a node to have children defined in another project

This commit is contained in:
Luis Fernando Molina committed 2020-11-23 12:19:31 +01:00
1 parent ff4ce84240
commit fb92eb4a7b
2 files changed
+14 -25

No files matched your search

+1 -18
View File
@@ -47,24 +47,7 @@
"name": "projectDefinition",
"type": "node",
"childType": "Project Definition",
"autoAdd": true
},
{
"name": "spaces",
"type": "node",
"childType": "Spaces",
"autoAdd": true
},
{
"name": "mines",
"type": "node",
"childType": "Mines",
"autoAdd": true
},
{
"name": "otherHierarchies",
"type": "node",
"childType": "Other Hierarchies",
"project" : "Superalgos",
"autoAdd": true
}
]
@@ -341,10 +341,7 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
project: project
}
let parentNodeDefinition = getNodeDefinition(parentNode, project)
if (parentNodeDefinition === undefined) {
console.log('Cannot addUIOBject from parent of ' + type + ' because that type it is not defined at the APP_SCHEMA.')
}
let parentNodeDefinition
/* Resolve Initial Values */
let nodeDefinition = getNodeDefinition(object, project)
@@ -372,7 +369,14 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
createUiObject(true, object.type, object.name, object, parentNode, undefined)
autoAddChildren()
return object
} else {
parentNodeDefinition = getNodeDefinition(parentNode, parentNode.project)
if (parentNodeDefinition === undefined) {
console.log('Cannot addUIOBject from parent of ' + type + ' because that type it is not defined at the APP_SCHEMA.')
return
}
checkChainToSelfTypeCollection()
initializeArrayProperties()
applyInitialValues()
@@ -384,7 +388,7 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
function checkChainToSelfTypeCollection() {
/* For the cases where a node is not chained to its parent but to the one at the parent before it at its own collection */
if (nodeDefinition.chainedToSameType === true) {
if (parentNodeDefinition.properties !== undefined) {
for (let i = 0; i < parentNodeDefinition.properties.length; i++) {
@@ -474,7 +478,8 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
case 'node': {
if (property.name !== previousPropertyName) {
if (property.autoAdd === true) {
addUIObject(object, property.childType)
let project = property.project
addUIObject(object, property.childType, undefined, project)
previousPropertyName = property.name
}
}
@@ -485,7 +490,8 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
if (object[property.name] === undefined) {
object[property.name] = []
}
addUIObject(object, property.childType)
let project = property.project
addUIObject(object, property.childType, undefined, project)
}
}
break