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 6afa5f3440..4e72dcbfa4 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 @@ -107,7 +107,7 @@ {{ 'notification.alarm-trigger-settings' | translate }}
-
+
notification.filter - + alarm.alarm-severity-list @@ -127,6 +127,17 @@
+ + notification.notify-on + + + {{ alarmActionTranslationMap.get(alarmAction) | translate }} + + + + {{ 'notification.notify-on-required' | translate }} + +
@@ -247,6 +258,9 @@ + + {{ 'notification.notify-only-user-comments' | translate }} +
diff --git a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.scss b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.scss index f9d0d4b63d..a3db5bf58b 100644 --- a/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.scss @@ -38,6 +38,10 @@ margin-bottom: 12px; } + &.tb-margin-before-field { + margin-bottom: 12px; + } + &.tb-hierarchy { padding: 0 0 8px 16px; } 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 7af6d846be..e4335cc130 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 @@ -15,6 +15,8 @@ /// import { + AlarmAction, + AlarmActionTranslationMap, NotificationRule, NotificationTarget, TriggerType, @@ -89,6 +91,9 @@ export class RuleNotificationDialogComponent extends alarmSeverityTranslationMap = alarmSeverityTranslations; alarmSeverities = Object.keys(AlarmSeverity) as Array; + alarmActions: AlarmAction[] = Object.values(AlarmAction); + alarmActionTranslationMap = AlarmActionTranslationMap; + entityType = EntityType; entityTypes: EntityType[] = Object.values(EntityType); isAdd = true; @@ -163,7 +168,8 @@ export class RuleNotificationDialogComponent extends alarmSeverities: [[]], clearRule: this.fb.group({ alarmStatuses: [[]] - }) + }), + notifyOn: [[AlarmAction.CREATED], Validators.required] }) }); @@ -200,7 +206,8 @@ export class RuleNotificationDialogComponent extends triggerConfig: this.fb.group({ alarmTypes: [null], alarmSeverities: [[]], - alarmStatuses: [[]] + alarmStatuses: [[]], + onlyUserComments: [false] }) }); @@ -217,7 +224,8 @@ export class RuleNotificationDialogComponent extends [TriggerType.ALARM, this.alarmTemplateForm], [TriggerType.ALARM_COMMENT, this.alarmCommentTemplateForm], [TriggerType.DEVICE_INACTIVITY, this.deviceInactivityTemplateForm], - [TriggerType.ENTITY_ACTION, this.entityActionTemplateForm] + [TriggerType.ENTITY_ACTION, this.entityActionTemplateForm], + [TriggerType.ALARM_ASSIGNMENT, this.alarmAssignmentTemplateForm], ]); if (data.isAdd || data.isCopy) { diff --git a/ui-ngx/src/app/shared/models/notification.models.ts b/ui-ngx/src/app/shared/models/notification.models.ts index cfcabdbb5e..a728496e82 100644 --- a/ui-ngx/src/app/shared/models/notification.models.ts +++ b/ui-ngx/src/app/shared/models/notification.models.ts @@ -109,21 +109,60 @@ export interface NotificationRule extends Omit, 'la additionalConfig: {description: string}; } -export interface NotificationRuleTriggerConfig { +export type NotificationRuleTriggerConfig = Partial + +export interface AlarmNotificationRuleTriggerConfig { alarmTypes?: Array; alarmSeverities?: Array; - alarmStatuses?: Array; - clearRule?: { - alarmStatuses: Array; - }; + notifyOn: Array; + clearRule?: ClearRule; +} + +interface ClearRule { + alarmStatuses: Array +} + +export interface DeviceInactivityNotificationRuleTriggerConfig { devices?: Array; deviceProfiles?: Array; - entityType?: EntityType; - created?: boolean; - updated?: boolean; - deleted?: boolean; } +export interface EntityActionNotificationRuleTriggerConfig { + entityType: EntityType; + created: boolean; + updated: boolean; + deleted: boolean; +} + +export interface AlarmCommentNotificationRuleTriggerConfig { + alarmTypes?: Array; + alarmSeverities?: Array; + alarmStatuses?: Array; + notifyOnUnassign?: boolean; + onlyUserComments?: boolean; +} + +export interface AlarmAssignmentNotificationRuleTriggerConfig { + alarmTypes?: Array; + alarmSeverities?: Array; + alarmStatuses?: Array; + notifyOnUnassign?: boolean; +} + +export enum AlarmAction { + CREATED = 'CREATED', + SEVERITY_CHANGED = 'SEVERITY_CHANGED', + ACKNOWLEDGED = 'ACKNOWLEDGED', + CLEARED = 'CLEARED' +} + +export const AlarmActionTranslationMap = new Map([ + [AlarmAction.CREATED, 'notification.notify-alarm-action.created'], + [AlarmAction.SEVERITY_CHANGED, 'notification.notify-alarm-action.severity-changed'], + [AlarmAction.ACKNOWLEDGED, 'notification.notify-alarm-action.acknowledged'], + [AlarmAction.CLEARED, 'notification.notify-alarm-action.cleared'] +]) + export interface NotificationRuleRecipientConfig { targets?: Array; escalationTable?: {[key: number]: Array}; 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 2770a5235a..9b378be529 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -2815,7 +2815,16 @@ "notification-chain": "Notification chain", "notification-target": "Notification recipient", "notify": "notify", + "notify-alarm-action": { + "created": "Alarm created", + "severity-changed": "Alarm severity changed", + "acknowledged": "Alarm acknowledged", + "cleared": "Alarm cleared" + }, "notify-again": "Notify again", + "notify-on": "Notify on", + "notify-on-required": "Notify on is required", + "notify-only-user-comments": "Notify only user comments", "notify-on-unassign": "Notify on unassign", "platform-users": "Platform users", "recipient": "Recipient",