Bug Fixed References

This commit is contained in:
Luis Fernando Molina committed 2020-09-10 21:44:45 +02:00
1 parent 601b50b682
commit e3829418b1
3 files changed
+30 -15

No files matched your search

@@ -32,7 +32,7 @@ function newUiObjectsFromNodes() {
let blobService = newFileStorage()
// if (node.config === undefined) {
node.config = '{ \n"includeDataMines": ["Masters", "Sparta", "Masters-Trading"],\n"includeTradingSystems": ["Sparta-WHB-BTC-USDT", "Example-ETH-USDT", "Sparta-BRR-BTC-USDT"],\n"includeSuperScripts": ["Masters"]\n }'
node.config = '{ \n"includeDataMines": ["Masters", "Sparta", "Masters-Trading"],\n"includeTradingSystems": ["Sparta-WHB-BTC-USDT", "Sparta-BRR-BTC-USDT"],\n"includeSuperScripts": ["Masters"]\n }'
// }
let config = JSON.parse(node.config)
@@ -63,7 +63,7 @@ function newUiObjectsFromNodes() {
}
}
receivedNode.isIncluded = true
node.rootNodes.push(receivedNode)
node.rootNodes.unshift(receivedNode)
totalIncluded++
if (totalIncluded === includeDataMines.length + includeTradingSystems.length + includeSuperScripts.length) {
addUserDefinedNodes()
@@ -92,7 +92,7 @@ function newUiObjectsFromNodes() {
}
}
receivedNode.isIncluded = true
node.rootNodes.push(receivedNode)
node.rootNodes.unshift(receivedNode)
totalIncluded++
if (totalIncluded === includeDataMines.length + includeTradingSystems.length + includeSuperScripts.length) {
addUserDefinedNodes()
@@ -121,7 +121,7 @@ function newUiObjectsFromNodes() {
}
}
receivedNode.isIncluded = true
node.rootNodes.push(receivedNode)
node.rootNodes.unshift(receivedNode)
totalIncluded++
if (totalIncluded === includeDataMines.length + includeTradingSystems.length + includeSuperScripts.length) {
addUserDefinedNodes()
@@ -167,10 +167,16 @@ function newUiObjectsFromNodes() {
function tryToConnectChildrenWithReferenceParents() {
/* We reconstruct here the reference relationships. */
for (const [key, node] of mapOfNodes) {
if (node.id === "54854f90-d121-4365-8f40-9a26e7af1097") {
console.log('ACA')
}
if (node.payload === undefined) { continue }
if (node.payload.referenceParent !== undefined) {
if (node.payload.referenceParent.cleaned === true) {
node.payload.referenceParent = mapOfNodes.get(node.payload.referenceParent.id)
if (node.payload.referenceParent === undefined) {
console.log(node.type + ' ' + node.name + ' reference parent lost during re-binding phase.')
}
continue // We were referencing a deleted node, so we replace it potentially with a newly created one.
} else {
continue // In this case the reference is already good.
@@ -179,6 +185,9 @@ function newUiObjectsFromNodes() {
if (node.savedPayload !== undefined) {
if (node.savedPayload.referenceParent !== undefined) { // these are children recreated
node.payload.referenceParent = mapOfNodes.get(node.savedPayload.referenceParent.id)
if (node.payload.referenceParent === undefined) {
console.log(node.type + ' ' + node.name + ' reference parent lost during re-binding phase.')
}
}
}
}
@@ -460,8 +469,13 @@ function newUiObjectsFromNodes() {
if (node.id === undefined) {
node.id = newUniqueId()
} else {
/*
We need to avoid nodes having the same id. If we add nodes to a workspace that already exist with the same Id,
the nodes being added will get a new id at this moment.
*/
let testNode = mapOfNodes.get(node.id)
if (testNode !== undefined && testNode.cleaned !== true) {
console.log(testNode.name + ' already have the id of the node ' + node.name + ' being added.')
node.id = newUniqueId()
}
}
@@ -587,6 +601,7 @@ function newUiObjectsFromNodes() {
/* Now we mount the floating object where the UIOBject will be laying on top of */
canvas.floatingSpace.uiObjectConstructor.createUiObject(userAddingNew, payload)
/* This is the point where we build a map with all nodes present at the workspace */
mapOfNodes.set(node.id, node)
/* Check if there are tasks to run */
+1 -1
View File
@@ -87,7 +87,7 @@ function newEventsServerClient(networkNode) {
if (WEB_SOCKETS_CONNECTION.readyState === 1) {
WEB_SOCKETS_CONNECTION.send(messageToWebSocketServer)
} else {
console.log('WebSocket message could not be sent because the connection was not ready. Will retry soon. Message = ' + JSON.stringify(command))
//console.log('WebSocket message could not be sent because the connection was not ready. Will retry soon. Message = ' + JSON.stringify(command))
}
}
+10 -10
View File
@@ -229,8 +229,8 @@ function newUiObjectConstructor() {
currentStatus: false,
label: undefined,
visible: true,
iconPathOn: 'menu-fix-pinned',
iconPathOff: 'menu-fix-unpinned',
iconPathOn: 'pinned',
iconPathOff: 'unpinned',
rawRadius: 12,
targetRadius: 0,
currentRadius: 0,
@@ -290,8 +290,8 @@ function newUiObjectConstructor() {
currentStatus: true,
label: undefined,
visible: true,
iconPathOn: 'menu-mobility-unfreeze',
iconPathOff: 'menu-mobility-freeze',
iconPathOn: 'unfreeze',
iconPathOff: 'freeze',
rawRadius: 12,
targetRadius: 0,
currentRadius: 0,
@@ -306,8 +306,8 @@ function newUiObjectConstructor() {
currentStatus: false,
label: undefined,
visible: true,
iconPathOn: 'menu-tree-plus',
iconPathOff: 'menu-tree-minus',
iconPathOn: 'expand',
iconPathOff: 'collapse',
rawRadius: 12,
targetRadius: 0,
currentRadius: 0,
@@ -320,8 +320,8 @@ function newUiObjectConstructor() {
actionFunction: floatingObject.payload.onMenuItemClick,
label: undefined,
visible: true,
iconPathOn: 'menu-backup',
iconPathOff: 'menu-backup',
iconPathOn: 'backup',
iconPathOff: 'backup',
rawRadius: 12,
targetRadius: 0,
currentRadius: 0,
@@ -349,8 +349,8 @@ function newUiObjectConstructor() {
actionFunction: floatingObject.payload.onMenuItemClick,
label: undefined,
visible: true,
iconPathOn: 'menu-share',
iconPathOff: 'menu-share',
iconPathOn: 'share',
iconPathOff: 'share',
rawRadius: 12,
targetRadius: 0,
currentRadius: 0,