Skip to content
Snippets Groups Projects
Commit cd9acff4 authored by Maximilian Giller's avatar Maximilian Giller :squid:
Browse files

Adding artificial node type ids for now

parent 3bb8fce6
No related branches found
No related tags found
1 merge request!2Implemented editor in the react framework
Pipeline #56650 passed
...@@ -305,7 +305,12 @@ export class Graph extends ManagedData { ...@@ -305,7 +305,12 @@ export class Graph extends ManagedData {
// No need to replace node ids with proper node objects, since that should be done in the graph itself. Only have to prepare valid GraphData // No need to replace node ids with proper node objects, since that should be done in the graph itself. Only have to prepare valid GraphData
}); });
// Collect all node types // Collect all node types and give id of none given yet
let typeId: number = undefined;
if (data.nodes[0].type.id === undefined) {
typeId = 0;
}
// TODO: Remove, when types are directly parsed and not just implicit // TODO: Remove, when types are directly parsed and not just implicit
data.nodes.forEach((node) => { data.nodes.forEach((node) => {
const sharedType: NodeType = data.types.find( const sharedType: NodeType = data.types.find(
...@@ -318,6 +323,11 @@ export class Graph extends ManagedData { ...@@ -318,6 +323,11 @@ export class Graph extends ManagedData {
return; return;
} }
if (typeId !== undefined) {
node.type.id = typeId;
typeId += 1;
}
// Doesn't exist in list yet, so add // Doesn't exist in list yet, so add
data.types.push(node.type); data.types.push(node.type);
}); });
......
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