Commit 62e17ffd48ee3ef75d844174312f2c708dea5fbc

Authored by Ekaterina Chantsova
1 parent 838d6982

Save translated title as variable

... ... @@ -148,7 +148,7 @@
148 148 <mat-drawer-content fxLayout="column" fxLayoutAlign="center start">
149 149 <section *ngIf="!widgetEditMode" class="tb-dashboard-title"
150 150 [ngStyle]="{'color': dashboard.configuration.settings.titleColor}">
151   - <h3 [fxShow]="!isEdit && displayTitle()">{{ utils.customTranslation(dashboard.title, dashboard.title) }}</h3>
  151 + <h3 [fxShow]="!isEdit && displayTitle()">{{ translatedDashboardTitle }}</h3>
152 152 <mat-form-field [fxShow]="isEdit" class="mat-block">
153 153 <mat-label translate [ngStyle]="{'color': dashboard.configuration.settings.titleColor}">dashboard.title</mat-label>
154 154 <input matInput class="tb-dashboard-title"
... ...
... ... @@ -209,6 +209,8 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
209 209
210 210 thingsboardVersion: string = env.tbVersion;
211 211
  212 + translatedDashboardTitle: string;
  213 +
212 214 currentDashboardId: string;
213 215 currentCustomerId: string;
214 216 currentDashboardScope: DashboardPageScope;
... ... @@ -303,7 +305,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
303 305 private breakpointObserver: BreakpointObserver,
304 306 private route: ActivatedRoute,
305 307 private router: Router,
306   - public utils: UtilsService,
  308 + private utils: UtilsService,
307 309 private dashboardUtils: DashboardUtilsService,
308 310 private authService: AuthService,
309 311 private entityService: EntityService,
... ... @@ -375,6 +377,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
375 377 this.reset();
376 378
377 379 this.dashboard = data.dashboard;
  380 + this.translatedDashboardTitle = this.getTranslatedDashboardTitle();
378 381 if (!this.embedded && this.dashboard.id) {
379 382 this.setStateDashboardId = true;
380 383 }
... ... @@ -424,6 +427,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
424 427
425 428 private reset() {
426 429 this.dashboard = null;
  430 + this.translatedDashboardTitle = null;
427 431 this.dashboardConfiguration = null;
428 432 this.dashboardLogoCache = undefined;
429 433 this.prevDashboard = null;
... ... @@ -520,6 +524,10 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
520 524 }
521 525 }
522 526
  527 + private getTranslatedDashboardTitle(): string {
  528 + return this.utils.customTranslation(this.dashboard.title, this.dashboard.title);
  529 + }
  530 +
523 531 public displayExport(): boolean {
524 532 if (this.dashboard.configuration.settings &&
525 533 isDefined(this.dashboard.configuration.settings.showDashboardExport)) {
... ... @@ -817,6 +825,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
817 825 }
818 826
819 827 public saveDashboard() {
  828 + this.translatedDashboardTitle = this.getTranslatedDashboardTitle();
820 829 this.setEditMode(false, false);
821 830 this.notifyDashboardUpdated();
822 831 }
... ...