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 | 26 | </span> |
27 | 27 | <span *ngIf="alarmRuleFormGroup.get('alarmDetails').value" class="tb-alarm-rule-details" |
28 | 28 | (click)="openEditDetailsDialog($event)" |
29 | - [innerHTML]="alarmRuleFormGroup.get('alarmDetails').value"></span> | |
29 | + [innerHTML]="alarmDetailsText"></span> | |
30 | 30 | <button mat-icon-button color="primary" |
31 | 31 | type="button" |
32 | 32 | (click)="openEditDetailsDialog($event)" | ... | ... |
... | ... | @@ -35,6 +35,7 @@ import { |
35 | 35 | } from '@home/components/profile/alarm/edit-alarm-details-dialog.component'; |
36 | 36 | import { EntityId } from '@shared/models/id/entity-id'; |
37 | 37 | import { DashboardId } from '@shared/models/id/dashboard-id'; |
38 | +import { UtilsService } from '@core/services/utils.service'; | |
38 | 39 | |
39 | 40 | @Component({ |
40 | 41 | selector: 'tb-alarm-rule', |
... | ... | @@ -79,6 +80,7 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat |
79 | 80 | private propagateChange = (v: any) => { }; |
80 | 81 | |
81 | 82 | constructor(private dialog: MatDialog, |
83 | + private utils: UtilsService, | |
82 | 84 | private fb: FormBuilder) { |
83 | 85 | } |
84 | 86 | |
... | ... | @@ -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 | 156 | private updateModel() { |
150 | 157 | const value = this.alarmRuleFormGroup.value; |
151 | 158 | if (this.modelValue) { | ... | ... |
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | <div fxFlex fxLayout="row" fxLayoutAlign="start center"> |
21 | 21 | <mat-panel-title> |
22 | 22 | <div fxLayout="row" fxFlex fxLayoutAlign="start center"> |
23 | - {{ alarmFormGroup.get('alarmType').value }} | |
23 | + {{ alarmTypeTitle }} | |
24 | 24 | </div> |
25 | 25 | </mat-panel-title> |
26 | 26 | <span fxFlex></span> | ... | ... |
... | ... | @@ -30,6 +30,7 @@ import { MatDialog } from '@angular/material/dialog'; |
30 | 30 | import { COMMA, ENTER, SEMICOLON } from '@angular/cdk/keycodes'; |
31 | 31 | import { MatChipInputEvent } from '@angular/material/chips'; |
32 | 32 | import { EntityId } from '@shared/models/id/entity-id'; |
33 | +import { UtilsService } from '@core/services/utils.service'; | |
33 | 34 | |
34 | 35 | @Component({ |
35 | 36 | selector: 'tb-device-profile-alarm', |
... | ... | @@ -72,6 +73,7 @@ export class DeviceProfileAlarmComponent implements ControlValueAccessor, OnInit |
72 | 73 | private propagateChangePending = false; |
73 | 74 | |
74 | 75 | constructor(private dialog: MatDialog, |
76 | + private utils: UtilsService, | |
75 | 77 | private fb: FormBuilder) { |
76 | 78 | } |
77 | 79 | |
... | ... | @@ -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 | 195 | private updateModel() { |
190 | 196 | const value = this.alarmFormGroup.value; | ... | ... |