Skip to content
Snippets Groups Projects
Commit eb074911 authored by Angelo Capossele's avatar Angelo Capossele Committed by Wolfgang Welz
Browse files

:recycle: refactor connectNode (#183)

parent cae647a5
No related branches found
No related tags found
No related merge requests found
......@@ -277,16 +277,12 @@ func index(w http.ResponseWriter, r *http.Request) {
function connectNodes(sourceNodeId, targetNodeId) {
if(existingLinks[sourceNodeId + targetNodeId] == undefined) {
if (!(sourceNodeId in nodesById)) {
addNode(sourceNodeId);
if ((sourceNodeId in nodesById) && (targetNodeId in nodesById)) {
//nodesById[sourceNodeId].online = true;
//nodesById[targetNodeId].online = true;
existingLinks[sourceNodeId + targetNodeId] = true
data.links = [...data.links, { source: sourceNodeId, target: targetNodeId }];
}
if (!(targetNodeId in nodesById)) {
addNode(targetNodeId);
}
nodesById[sourceNodeId].online = true;
nodesById[targetNodeId].online = true;
existingLinks[sourceNodeId + targetNodeId] = true
data.links = [...data.links, { source: sourceNodeId, target: targetNodeId }];
updateGraph();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment