diff --git a/package.json b/package.json index 562c129e..2c449f0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@spcl/sdfv", - "version": "1.2.0", + "version": "1.2.1", "description": "A standalone viewer for SDFGs", "homepage": "https://github.com/spcl/dace-webclient", "main": "out/index.js", diff --git a/src/renderer/renderer.ts b/src/renderer/renderer.ts index 7f838f1b..0f023bf7 100644 --- a/src/renderer/renderer.ts +++ b/src/renderer/renderer.ts @@ -1035,6 +1035,10 @@ export class SDFGRenderer extends EventEmitter { obj.attributes.sdfg) { this.cfgTree[obj.attributes.sdfg.cfg_list_id] = oInfo.sdfg.cfg_list_id; + this.cfgList[obj.attributes.sdfg.cfg_list_id] = { + jsonObj: obj.attributes.sdfg as JsonSDFG, + graph: null, + }; } else if (cfgId !== undefined && cfgId >= 0) { this.cfgTree[cfgId] = oInfo.cfgId; this.cfgList[cfgId] = { diff --git a/src/utils/sdfg/json_serializer.ts b/src/utils/sdfg/json_serializer.ts index ba96f7bf..d46fac82 100644 --- a/src/utils/sdfg/json_serializer.ts +++ b/src/utils/sdfg/json_serializer.ts @@ -8,11 +8,11 @@ const propertyReplacements_0_16_0: { [key: string]: { replaceWith: string, recursive: boolean, }} = { - 'start_block': { + 'start_state': { replaceWith: 'start_block', recursive: false, }, - 'cfg_list_id': { + 'sdfg_list_id': { replaceWith: 'cfg_list_id', recursive: true, }, diff --git a/src/utils/sdfg/sdfg_utils.ts b/src/utils/sdfg/sdfg_utils.ts index b20ef97b..16154a12 100644 --- a/src/utils/sdfg/sdfg_utils.ts +++ b/src/utils/sdfg/sdfg_utils.ts @@ -120,25 +120,24 @@ export function findGraphElementByUUID( return null; const graph = cfgList[cfgId].graph; - if (graph === null) - return null; - - let state = null; - if (stateId !== '-1') - state = graph.node(stateId); - - let element = null; - if (nodeId !== '-1' && state !== null && state.data.graph !== null) - element = state.data.graph.node(nodeId); // SDFG Dataflow graph node - else if (edgeId !== '-1' && state !== null && state.data.graph !== null) - element = state.data.graph.edge(edgeId); // Memlet - else if (edgeId !== '-1' && state === null) - element = graph.edge(edgeId as any); // Interstate edge - - if (element) - return element; - if (state) - return state; + if (graph) { + let state = null; + if (stateId !== '-1') + state = graph.node(stateId); + + let element = null; + if (nodeId !== '-1' && state !== null && state.data.graph !== null) + element = state.data.graph.node(nodeId); // SDFG Dataflow graph node + else if (edgeId !== '-1' && state !== null && state.data.graph !== null) + element = state.data.graph.edge(edgeId); // Memlet + else if (edgeId !== '-1' && state === null) + element = graph.edge(edgeId as any); // Interstate edge + + if (element) + return element; + if (state) + return state; + } const parentCfgId = cfgTree[Number(cfgId)]; if (parentCfgId === undefined || parentCfgId === null)