Browse Source

Added translations for severity in alarm comments

pull/14671/head
Maksym Tsymbarov 9 months ago
parent
commit
4a30d77878
  1. 21
      ui-ngx/src/app/modules/home/components/alarm/alarm-comment.component.ts

21
ui-ngx/src/app/modules/home/components/alarm/alarm-comment.component.ts

@ -32,13 +32,15 @@ import {
AlarmCommentInfo,
AlarmCommentType,
AlarmMessage,
AlarmSeverity,
alarmSeverityTranslations,
getUserDisplayName
} from '@shared/models/alarm.models';
import { UtilsService } from '@core/services/utils.service';
import { EntityType } from '@shared/models/entity-type.models';
import { DatePipe } from '@angular/common';
import { ImportExportService } from '@shared/import-export/import-export.service';
import { isNotEmptyStr } from '@core/utils';
import { deepClone, isNotEmptyStr } from '@core/utils';
interface AlarmCommentsDisplayData {
commentId?: string;
@ -152,9 +154,24 @@ export class AlarmCommentComponent implements OnInit {
private parseSystemComment(alarm: AlarmCommentInfo): string {
const subTypeKey = alarm.comment?.subtype;
const alarmComment = deepClone(alarm.comment);
if (subTypeKey && AlarmMessage[subTypeKey]) {
const translationKey = AlarmMessage[subTypeKey];
return this.translate.instant(translationKey, alarm.comment);
if (alarmComment?.newSeverity) {
const newSeverityKey =
(alarmSeverityTranslations.has(alarmComment.newSeverity)
? alarmSeverityTranslations.get(alarmComment.newSeverity)
: alarmComment.newSeverity) as AlarmSeverity;
alarmComment.newSeverity = this.translate.instant(newSeverityKey);
}
if (alarmComment?.oldSeverity) {
const oldSeverityKey =
(alarmSeverityTranslations.has(alarmComment.oldSeverity)
? alarmSeverityTranslations.get(alarmComment.oldSeverity)
: alarmComment.oldSeverity) as AlarmSeverity;
alarmComment.oldSeverity = this.translate.instant(oldSeverityKey);
}
return this.translate.instant(translationKey, alarmComment);
}
return alarm.comment.text;
}

Loading…
Cancel
Save