From 3db594975f5bb950fa751c23c400839615c4e032 Mon Sep 17 00:00:00 2001 From: Newatia Date: Mon, 2 Oct 2023 11:43:32 -0400 Subject: [PATCH] fixed ssg4m same structure in scheme view --- ...tance-form-ssg4m-process-card.component.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/app/core/substance-ssg4m/ssg4m-process/substance-form-ssg4m-process-card.component.ts b/src/app/core/substance-ssg4m/ssg4m-process/substance-form-ssg4m-process-card.component.ts index 2fba9f552..edd3d1d05 100644 --- a/src/app/core/substance-ssg4m/ssg4m-process/substance-form-ssg4m-process-card.component.ts +++ b/src/app/core/substance-ssg4m/ssg4m-process/substance-form-ssg4m-process-card.component.ts @@ -60,6 +60,7 @@ export class SubstanceFormSsg4mProcessCardComponent extends SubstanceCardBaseFil loaded = true; //setup viz stuff //TODO: make more configurable and standardized + console.log("About to configure the scheme view"); window['schemeUtil'].debug = false; const url = `${(this.configService.configData && this.configService.configData.apiBaseUrl) || '/'}api/v1/`; const httpp = this.http; @@ -87,10 +88,15 @@ export class SubstanceFormSsg4mProcessCardComponent extends SubstanceCardBaseFil //I just want to show a dialog that shows the step/stage component rendered in a popup for now. //maybe in the future it should instead be a side window, I don't know. }; + //TODO: window['schemeUtil'].onClickMaterial = (d) => { this.openImageModal(d.refuuid, d.name, d.bottomText); }; + + if (window['schemeUtil'].executeWhenLoaded) { + window['schemeUtil'].executeWhenLoaded(); + } } }, 100); @@ -200,8 +206,19 @@ export class SubstanceFormSsg4mProcessCardComponent extends SubstanceCardBaseFil //This is a hacky placeholder way to force viz //TODO finish this const ssgjs = JSON.stringify(this.substanceFormService.cleanSubstance()); + + console.log("About to load the scheme view"); if (window['schemeUtil']) { - window['schemeUtil'].renderScheme(window['schemeUtil'].makeDisplayGraph(JSON.parse(ssgjs)), "#scheme-viz-view"); + if (window['schemeUtil'].debug) { + window['schemeUtil'].executeWhenLoaded = (() => { + console.log("About to render the scheme view"); + window['schemeUtil'].renderScheme(window['schemeUtil'].makeDisplayGraph(JSON.parse(ssgjs)), "#scheme-viz-view"); + window['schemeUtil'].executeWhenLoaded = null; + }); + } else { + console.log("About to render the scheme view"); + window['schemeUtil'].renderScheme(window['schemeUtil'].makeDisplayGraph(JSON.parse(ssgjs)), "#scheme-viz-view"); + } } } else { document.querySelector("#scheme-viz-view").className = "hidden";