Skip to content
Snippets Groups Projects
Commit 51ee49d3 authored by mathias.chouet's avatar mathias.chouet
Browse files

Modules Diagram: fix blank diagram issue with PreBarrage

parent 939393c8
No related branches found
No related tags found
Loading
Pipeline #138139 canceled
...@@ -105,41 +105,47 @@ export class ModulesDiagramComponent implements AfterContentInit, AfterViewCheck ...@@ -105,41 +105,47 @@ export class ModulesDiagramComponent implements AfterContentInit, AfterViewCheck
} }
public ngAfterViewInit(): void { public ngAfterViewInit(): void {
// add click listener on every calculator node in the graph, that setTimeout(() => { // clodo trick
// corresponds to an open module // add click listener on every calculator node in the graph, that
this.nativeElement.querySelectorAll("g.node").forEach(item => { // corresponds to an open module
if (item.id && this.formIsOpen(item.id)) { this.nativeElement.querySelectorAll("g.node").forEach(item => {
item.style.cursor = "pointer"; if (item.id && this.formIsOpen(item.id)) {
item.addEventListener("click", () => { item.style.cursor = "pointer";
this.openCalc(item.id); item.addEventListener("click", () => {
}); this.openCalc(item.id);
} });
}); }
});
}, 20); // @WARNING keep timeout > the one in ngAfterContentInit() below
} }
public ngAfterContentInit(): void { public ngAfterContentInit(): void {
this.error = false; this.error = false;
mermaid.initialize({ // clodo trick or displaying modules diagram coming from a
// theme: "forest" // PreBarrage module results in a blank diagram
flowchart: { setTimeout(() => {
curve: "basis" mermaid.initialize({
} // theme: "forest"
}); flowchart: {
this.nativeElement = this.diagram.nativeElement; curve: "basis"
}
if (this.hasModules) { });
// generate graph description this.nativeElement = this.diagram.nativeElement;
const graphDefinition = this.graphDefinition();
// draw if (this.hasModules) {
try { // generate graph description
mermaid.render("graphDiv", graphDefinition, (svgCode, bindFunctions) => { const graphDefinition = this.graphDefinition();
this.nativeElement.innerHTML = svgCode; // draw
}); try {
} catch (e) { mermaid.render("graphDiv", graphDefinition, (svgCode, bindFunctions) => {
console.error(e); this.nativeElement.innerHTML = svgCode;
this.error = true; });
} catch (e) {
console.error(e);
this.error = true;
}
} }
} }, 10);
} }
public resetZoom() { public resetZoom() {
......
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