diff --git a/src/app/app.component.html b/src/app/app.component.html index 2194a0666..e6b19beb3 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -14,6 +14,7 @@ class="main-layout-padding" templatename="app_menu" (click)="menu.close()" + [ignoreQueryParamChanges]="true" > diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 5b4e555a3..be85b7f70 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -49,6 +49,7 @@ export class AppComponent { this.themeService.init(); this.platform.ready().then(async () => { this.dbService.init(); + this.hackSetDeveloperOptions(); const user = await this.userMetaService.init(); if (!user.first_app_open) { await this.surveyService.runSurvey("introSplash"); @@ -104,6 +105,16 @@ export class AppComponent { } } + /** ensure localhost dev can see all non-user content */ + private hackSetDeveloperOptions() { + if (location.hostname === "localhost" && !environment.production) { + const isUserMode = this.templateService.getField("user_mode"); + if (isUserMode !== false) { + this.templateService.setField("user_mode", "false"); + } + } + } + /** * temporary fix: set initial fields to avoid doubling up of quickstart buttons * TODO CC 2021-07-23 - Review if methods still required diff --git a/src/app/shared/components/template/template-container.component.ts b/src/app/shared/components/template/template-container.component.ts index b78fef883..230f85e72 100644 --- a/src/app/shared/components/template/template-container.component.ts +++ b/src/app/shared/components/template/template-container.component.ts @@ -38,6 +38,8 @@ export class TemplateContainerComponent implements OnInit, OnDestroy, ITemplateC @Input() templatename: string; @Input() parent?: TemplateContainerComponent; @Input() row?: FlowTypes.TemplateRow; + /** Query params are used for trigger template actions such as opening popups or enabling debug_mode. Ignored if required (e.g. app sidemenu template) */ + @Input() ignoreQueryParamChanges?: boolean; children: { [name: string]: TemplateContainerComponent } = {}; template: FlowTypes.Template; @@ -68,7 +70,9 @@ export class TemplateContainerComponent implements OnInit, OnDestroy, ITemplateC } async ngOnInit() { - this.subscribeToQueryParamChanges(); + if (!this.ignoreQueryParamChanges) { + this.subscribeToQueryParamChanges(); + } // add logging if default disabled and in debug view if (this.debugMode) { this.setLogging(true);