diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts index 2d3b634050..c360846941 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-page.component.ts @@ -134,6 +134,7 @@ import { import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; import cssjs from '@core/css/css'; import { DOCUMENT } from '@angular/common'; +import { IAliasController } from '@core/api/widget-api.models'; // @dynamic @Component({ @@ -179,6 +180,9 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC @Input() parentDashboard?: IDashboardComponent = null; + @Input() + parentAliasController?: IAliasController = null; + @ViewChild('dashboardContainer') dashboardContainer: ElementRef; prevDashboard: Dashboard; @@ -419,7 +423,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC this.readonly = this.embedded || (this.singlePageMode && !this.widgetEditMode && !this.route.snapshot.queryParamMap.get('edit')) || this.forceFullscreen || this.isMobileApp || this.authUser.authority === Authority.CUSTOMER_USER; - this.dashboardCtx.aliasController = new AliasController(this.utils, + this.dashboardCtx.aliasController = this.parentAliasController ? this.parentAliasController : new AliasController(this.utils, this.entityService, this.translate, () => this.dashboardCtx.stateController, diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-state.component.html b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-state.component.html index b7ead22172..c03c253af2 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-state.component.html +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-state.component.html @@ -21,7 +21,8 @@ [hideToolbar]="true" [currentState]="currentState" [dashboard]="dashboard" - [parentDashboard]="parentDashboard"> + [parentDashboard]="parentDashboard" + [parentAliasController]="parentAliasController">
{{ 'dashboard.non-existent-dashboard-state-error' | translate:{stateId} }} diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-state.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-state.component.ts index 88ddfd0082..50863b0595 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-state.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-state.component.ts @@ -19,7 +19,7 @@ import { PageComponent } from '@shared/components/page.component'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { Dashboard, DashboardLayoutId } from '@shared/models/dashboard.models'; -import { StateObject } from '@core/api/widget-api.models'; +import { IAliasController, StateObject } from '@core/api/widget-api.models'; import { updateEntityParams, WidgetContext } from '@home/models/widget-component.models'; import { deepClone, isDefinedAndNotNull, isNotEmptyStr, objToBase64 } from '@core/utils'; import { IDashboardComponent } from '@home/models/dashboard-component.models'; @@ -63,6 +63,8 @@ export class DashboardStateComponent extends PageComponent implements OnInit, On parentDashboard: IDashboardComponent; + parentAliasController: IAliasController; + stateExists = true; private stateSubscription: Subscription; @@ -92,6 +94,7 @@ export class DashboardStateComponent extends PageComponent implements OnInit, On this.parentDashboard = this.ctx.parentDashboard ? this.ctx.parentDashboard : this.ctx.dashboard; if (this.syncParentStateParams) { + this.parentAliasController = this.parentDashboard.aliasController; this.stateSubscription = this.ctx.stateController.dashboardCtrl.dashboardCtx.stateChanged.subscribe(() => { this.updateCurrentState(); this.cd.markForCheck();