Save translated title as variable
This commit is contained in:
parent
838d6982a8
commit
62e17ffd48
@ -148,7 +148,7 @@
|
||||
<mat-drawer-content fxLayout="column" fxLayoutAlign="center start">
|
||||
<section *ngIf="!widgetEditMode" class="tb-dashboard-title"
|
||||
[ngStyle]="{'color': dashboard.configuration.settings.titleColor}">
|
||||
<h3 [fxShow]="!isEdit && displayTitle()">{{ utils.customTranslation(dashboard.title, dashboard.title) }}</h3>
|
||||
<h3 [fxShow]="!isEdit && displayTitle()">{{ translatedDashboardTitle }}</h3>
|
||||
<mat-form-field [fxShow]="isEdit" class="mat-block">
|
||||
<mat-label translate [ngStyle]="{'color': dashboard.configuration.settings.titleColor}">dashboard.title</mat-label>
|
||||
<input matInput class="tb-dashboard-title"
|
||||
|
||||
@ -209,6 +209,8 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
|
||||
|
||||
thingsboardVersion: string = env.tbVersion;
|
||||
|
||||
translatedDashboardTitle: string;
|
||||
|
||||
currentDashboardId: string;
|
||||
currentCustomerId: string;
|
||||
currentDashboardScope: DashboardPageScope;
|
||||
@ -303,7 +305,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
public utils: UtilsService,
|
||||
private utils: UtilsService,
|
||||
private dashboardUtils: DashboardUtilsService,
|
||||
private authService: AuthService,
|
||||
private entityService: EntityService,
|
||||
@ -375,6 +377,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
|
||||
this.reset();
|
||||
|
||||
this.dashboard = data.dashboard;
|
||||
this.translatedDashboardTitle = this.getTranslatedDashboardTitle();
|
||||
if (!this.embedded && this.dashboard.id) {
|
||||
this.setStateDashboardId = true;
|
||||
}
|
||||
@ -424,6 +427,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
|
||||
|
||||
private reset() {
|
||||
this.dashboard = null;
|
||||
this.translatedDashboardTitle = null;
|
||||
this.dashboardConfiguration = null;
|
||||
this.dashboardLogoCache = undefined;
|
||||
this.prevDashboard = null;
|
||||
@ -520,6 +524,10 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
|
||||
}
|
||||
}
|
||||
|
||||
private getTranslatedDashboardTitle(): string {
|
||||
return this.utils.customTranslation(this.dashboard.title, this.dashboard.title);
|
||||
}
|
||||
|
||||
public displayExport(): boolean {
|
||||
if (this.dashboard.configuration.settings &&
|
||||
isDefined(this.dashboard.configuration.settings.showDashboardExport)) {
|
||||
@ -817,6 +825,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC
|
||||
}
|
||||
|
||||
public saveDashboard() {
|
||||
this.translatedDashboardTitle = this.getTranslatedDashboardTitle();
|
||||
this.setEditMode(false, false);
|
||||
this.notifyDashboardUpdated();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user