From c7dbf6be89ad9709026e8828a9941d7550c057a9 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 15 Mar 2023 18:39:06 +0200 Subject: [PATCH] UI: Add new notification type alarm assignment --- .../rule-notification-dialog.component.html | 48 +++++++++++++++++++ .../rule-notification-dialog.component.ts | 10 ++++ .../app/shared/models/notification.models.ts | 18 +++++-- .../assets/locale/locale.constant-en_US.json | 5 ++ 4 files changed, 77 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.html b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.html index ddbc21e294..6afa5f3440 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.html @@ -258,6 +258,54 @@ + + {{ 'notification.alarm-assignment-trigger-settings' | translate }} +
+
+
+ notification.filter + + + + + alarm.alarm-severity-list + + + {{ alarmSeverityTranslationMap.get(alarmSeverity) | translate }} + + + + + alarm.alarm-status-list + + + {{ alarmSearchStatusTranslationMap.get(searchStatus) | translate }} + + + +
+ + {{ 'notification.notify-on-unassign' | translate }} + +
+
+
+
+ + notification.description + + +
+
+
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts index 396c296d07..7af6d846be 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts @@ -72,6 +72,7 @@ export class RuleNotificationDialogComponent extends deviceInactivityTemplateForm: FormGroup; entityActionTemplateForm: FormGroup; alarmCommentTemplateForm: FormGroup; + alarmAssignmentTemplateForm: FormGroup; triggerType = TriggerType; triggerTypes: TriggerType[] = Object.values(TriggerType); @@ -203,6 +204,15 @@ export class RuleNotificationDialogComponent extends }) }); + this.alarmAssignmentTemplateForm = this.fb.group({ + triggerConfig: this.fb.group({ + alarmTypes: [null], + alarmSeverities: [[]], + alarmStatuses: [[]], + notifyOnUnassign: [true] + }) + }); + this.triggerTypeFormsMap = new Map([ [TriggerType.ALARM, this.alarmTemplateForm], [TriggerType.ALARM_COMMENT, this.alarmCommentTemplateForm], diff --git a/ui-ngx/src/app/shared/models/notification.models.ts b/ui-ngx/src/app/shared/models/notification.models.ts index aa644ada73..cfcabdbb5e 100644 --- a/ui-ngx/src/app/shared/models/notification.models.ts +++ b/ui-ngx/src/app/shared/models/notification.models.ts @@ -288,14 +288,16 @@ export enum NotificationType { ALARM = 'ALARM', DEVICE_INACTIVITY = 'DEVICE_INACTIVITY', ENTITY_ACTION = 'ENTITY_ACTION', - ALARM_COMMENT = 'ALARM_COMMENT' + ALARM_COMMENT = 'ALARM_COMMENT', + ALARM_ASSIGNMENT = 'ALARM_ASSIGNMENT' } export const NotificationTypeIcons = new Map([ [NotificationType.ALARM, 'warning'], [NotificationType.DEVICE_INACTIVITY, 'phonelink_off'], [NotificationType.ENTITY_ACTION, 'devices'], - [NotificationType.ALARM_COMMENT, 'warning'] + [NotificationType.ALARM_COMMENT, 'comment'], + [NotificationType.ALARM_ASSIGNMENT, 'assignment_turned_in'], ]); export const AlarmSeverityNotificationColors = new Map( @@ -353,6 +355,12 @@ export const NotificationTemplateTypeTranslateMap = new Map([ [TriggerType.ALARM, 'notification.trigger.alarm'], [TriggerType.DEVICE_INACTIVITY, 'notification.trigger.device-inactivity'], [TriggerType.ENTITY_ACTION, 'notification.trigger.entity-action'], - [TriggerType.ALARM_COMMENT, 'notification.trigger.alarm-comment'] + [TriggerType.ALARM_COMMENT, 'notification.trigger.alarm-comment'], + [TriggerType.ALARM_ASSIGNMENT, 'notification.trigger.alarm-assignment'], ]); diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index c1fcd07d3d..2770a5235a 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -2723,6 +2723,7 @@ "add-target": "Add recipient", "add-template": "Add template", "after": "After", + "alarm-assignment-trigger-settings": "Alarm assignment trigger settings", "alarm-comment-trigger-settings": "Alarm comment trigger settings", "alarm-trigger-settings": "Alarm trigger settings", "all": "All", @@ -2815,6 +2816,7 @@ "notification-target": "Notification recipient", "notify": "notify", "notify-again": "Notify again", + "notify-on-unassign": "Notify on unassign", "platform-users": "Platform users", "recipient": "Recipient", "recipient-type": "Recipient type", @@ -2866,6 +2868,7 @@ "template": "Template", "template-hint": { "alarm": "Available params: ${alarmType}, ${alarmSeverity}, ${alarmStatus}, ${alarmOriginatorEntityType}, ${alarmOriginatorId}, ${alarmId}, ${alarmAction}", + "alarm-assignment": "Available params: ${assigneeFirstName}, ${assigneeLastName}, ${assigneeEmail}, ${assigneeFirstName}, ${userName}, ${alarmId}, ${alarmType}, ${alarmSeverity}, ${alarmStatus}, ${alarmOriginatorEntityType}, ${alarmOriginatorId}, ${alarmId}, ${alarmAction}", "alarm-comment": "Available params: ${comment}, ${alarmType}, ${alarmId}, ${alarmType}, ${alarmSeverity}, ${alarmStatus}, ${alarmOriginatorEntityType}, ${alarmOriginatorId}, ${alarmId}, ${alarmAction}", "device-inactivity": "Available params: ${deviceName}, ${deviceLabel}, ${deviceType}, ${deviceId}", "entity-action": "Available params: ${actionType}, ${entityType}, ${entityName}, ${entityId}, ${originatorUserName}, ${originatorUserId}", @@ -2875,6 +2878,7 @@ "template-required": "Template is required", "template-type": { "alarm": "Alarm", + "alarm-assignment": "Alarm assignment", "alarm-comment": "Alarm comment", "device-inactivity": "Device inactivity", "entity-action": "Entity action", @@ -2884,6 +2888,7 @@ "time": "Time", "trigger": { "alarm": "Alarm", + "alarm-assignment": "Alarm assignment", "alarm-comment": "Alarm comment", "device-inactivity": "Device inactivity", "entity-action": "Entity action",