Commit d16a1241784b2fb48667dff3a16af83f29174408
1 parent
327607e8
improvement custom translation for alarm type field
Showing
4 changed files
with
15 additions
and
2 deletions
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | </span> | 26 | </span> |
27 | <span *ngIf="alarmRuleFormGroup.get('alarmDetails').value" class="tb-alarm-rule-details" | 27 | <span *ngIf="alarmRuleFormGroup.get('alarmDetails').value" class="tb-alarm-rule-details" |
28 | (click)="openEditDetailsDialog($event)" | 28 | (click)="openEditDetailsDialog($event)" |
29 | - [innerHTML]="alarmRuleFormGroup.get('alarmDetails').value"></span> | 29 | + [innerHTML]="alarmDetailsText"></span> |
30 | <button mat-icon-button color="primary" | 30 | <button mat-icon-button color="primary" |
31 | type="button" | 31 | type="button" |
32 | (click)="openEditDetailsDialog($event)" | 32 | (click)="openEditDetailsDialog($event)" |
@@ -35,6 +35,7 @@ import { | @@ -35,6 +35,7 @@ import { | ||
35 | } from '@home/components/profile/alarm/edit-alarm-details-dialog.component'; | 35 | } from '@home/components/profile/alarm/edit-alarm-details-dialog.component'; |
36 | import { EntityId } from '@shared/models/id/entity-id'; | 36 | import { EntityId } from '@shared/models/id/entity-id'; |
37 | import { DashboardId } from '@shared/models/id/dashboard-id'; | 37 | import { DashboardId } from '@shared/models/id/dashboard-id'; |
38 | +import { UtilsService } from '@core/services/utils.service'; | ||
38 | 39 | ||
39 | @Component({ | 40 | @Component({ |
40 | selector: 'tb-alarm-rule', | 41 | selector: 'tb-alarm-rule', |
@@ -79,6 +80,7 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat | @@ -79,6 +80,7 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat | ||
79 | private propagateChange = (v: any) => { }; | 80 | private propagateChange = (v: any) => { }; |
80 | 81 | ||
81 | constructor(private dialog: MatDialog, | 82 | constructor(private dialog: MatDialog, |
83 | + private utils: UtilsService, | ||
82 | private fb: FormBuilder) { | 84 | private fb: FormBuilder) { |
83 | } | 85 | } |
84 | 86 | ||
@@ -146,6 +148,11 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat | @@ -146,6 +148,11 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat | ||
146 | }; | 148 | }; |
147 | } | 149 | } |
148 | 150 | ||
151 | + get alarmDetailsText(): string { | ||
152 | + const alarmType = this.alarmRuleFormGroup.get('alarmDetails').value; | ||
153 | + return this.utils.customTranslation(alarmType, alarmType); | ||
154 | + } | ||
155 | + | ||
149 | private updateModel() { | 156 | private updateModel() { |
150 | const value = this.alarmRuleFormGroup.value; | 157 | const value = this.alarmRuleFormGroup.value; |
151 | if (this.modelValue) { | 158 | if (this.modelValue) { |
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | <div fxFlex fxLayout="row" fxLayoutAlign="start center"> | 20 | <div fxFlex fxLayout="row" fxLayoutAlign="start center"> |
21 | <mat-panel-title> | 21 | <mat-panel-title> |
22 | <div fxLayout="row" fxFlex fxLayoutAlign="start center"> | 22 | <div fxLayout="row" fxFlex fxLayoutAlign="start center"> |
23 | - {{ alarmFormGroup.get('alarmType').value }} | 23 | + {{ alarmTypeTitle }} |
24 | </div> | 24 | </div> |
25 | </mat-panel-title> | 25 | </mat-panel-title> |
26 | <span fxFlex></span> | 26 | <span fxFlex></span> |
@@ -30,6 +30,7 @@ import { MatDialog } from '@angular/material/dialog'; | @@ -30,6 +30,7 @@ import { MatDialog } from '@angular/material/dialog'; | ||
30 | import { COMMA, ENTER, SEMICOLON } from '@angular/cdk/keycodes'; | 30 | import { COMMA, ENTER, SEMICOLON } from '@angular/cdk/keycodes'; |
31 | import { MatChipInputEvent } from '@angular/material/chips'; | 31 | import { MatChipInputEvent } from '@angular/material/chips'; |
32 | import { EntityId } from '@shared/models/id/entity-id'; | 32 | import { EntityId } from '@shared/models/id/entity-id'; |
33 | +import { UtilsService } from '@core/services/utils.service'; | ||
33 | 34 | ||
34 | @Component({ | 35 | @Component({ |
35 | selector: 'tb-device-profile-alarm', | 36 | selector: 'tb-device-profile-alarm', |
@@ -72,6 +73,7 @@ export class DeviceProfileAlarmComponent implements ControlValueAccessor, OnInit | @@ -72,6 +73,7 @@ export class DeviceProfileAlarmComponent implements ControlValueAccessor, OnInit | ||
72 | private propagateChangePending = false; | 73 | private propagateChangePending = false; |
73 | 74 | ||
74 | constructor(private dialog: MatDialog, | 75 | constructor(private dialog: MatDialog, |
76 | + private utils: UtilsService, | ||
75 | private fb: FormBuilder) { | 77 | private fb: FormBuilder) { |
76 | } | 78 | } |
77 | 79 | ||
@@ -185,6 +187,10 @@ export class DeviceProfileAlarmComponent implements ControlValueAccessor, OnInit | @@ -185,6 +187,10 @@ export class DeviceProfileAlarmComponent implements ControlValueAccessor, OnInit | ||
185 | } | 187 | } |
186 | } | 188 | } |
187 | 189 | ||
190 | + get alarmTypeTitle(): string { | ||
191 | + const alarmType = this.alarmFormGroup.get('alarmType').value; | ||
192 | + return this.utils.customTranslation(alarmType, alarmType); | ||
193 | + } | ||
188 | 194 | ||
189 | private updateModel() { | 195 | private updateModel() { |
190 | const value = this.alarmFormGroup.value; | 196 | const value = this.alarmFormGroup.value; |