UI: Add new notification rule settings
This commit is contained in:
parent
1e7c1a8a5a
commit
ca2fac4b9d
@ -107,7 +107,7 @@
|
||||
<ng-template matStepLabel>{{ 'notification.alarm-trigger-settings' | translate }}</ng-template>
|
||||
<form [formGroup]="alarmTemplateForm">
|
||||
<section formGroupName="triggerConfig">
|
||||
<fieldset class="fields-group tb-margin">
|
||||
<fieldset class="fields-group tb-margin-before-field">
|
||||
<legend translate>notification.filter</legend>
|
||||
<tb-string-items-list
|
||||
editable
|
||||
@ -117,7 +117,7 @@
|
||||
formControlName="alarmTypes">
|
||||
</tb-string-items-list>
|
||||
|
||||
<mat-form-field fxFlex class="mat-block clear-button-space" floatLabel="always">
|
||||
<mat-form-field fxFlex class="mat-block" floatLabel="always">
|
||||
<mat-label translate>alarm.alarm-severity-list</mat-label>
|
||||
<mat-select formControlName="alarmSeverities" multiple
|
||||
placeholder="{{ !alarmTemplateForm.get('triggerConfig.alarmSeverities').value?.length ? ('alarm.any-severity' | translate) : '' }}">
|
||||
@ -127,6 +127,17 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</fieldset>
|
||||
<mat-form-field fxFlex class="mat-block">
|
||||
<mat-label translate>notification.notify-on</mat-label>
|
||||
<mat-select formControlName="notifyOn" multiple>
|
||||
<mat-option *ngFor="let alarmAction of alarmActions" [value]="alarmAction">
|
||||
{{ alarmActionTranslationMap.get(alarmAction) | translate }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="alarmTemplateForm.get('triggerConfig.notifyOn').hasError('required')">
|
||||
{{ 'notification.notify-on-required' | translate }}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</section>
|
||||
</form>
|
||||
<form [formGroup]="ruleNotificationForm">
|
||||
@ -247,6 +258,9 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</fieldset>
|
||||
<mat-slide-toggle formControlName="onlyUserComments" style="margin-bottom: 12px;">
|
||||
{{ 'notification.notify-only-user-comments' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</section>
|
||||
</form>
|
||||
<form [formGroup]="ruleNotificationForm">
|
||||
|
||||
@ -38,6 +38,10 @@
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
&.tb-margin-before-field {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
&.tb-hierarchy {
|
||||
padding: 0 0 8px 16px;
|
||||
}
|
||||
|
||||
@ -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<AlarmSeverity>;
|
||||
|
||||
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) {
|
||||
|
||||
@ -109,21 +109,60 @@ export interface NotificationRule extends Omit<BaseData<NotificationRuleId>, 'la
|
||||
additionalConfig: {description: string};
|
||||
}
|
||||
|
||||
export interface NotificationRuleTriggerConfig {
|
||||
export type NotificationRuleTriggerConfig = Partial<AlarmNotificationRuleTriggerConfig & DeviceInactivityNotificationRuleTriggerConfig & EntityActionNotificationRuleTriggerConfig & AlarmCommentNotificationRuleTriggerConfig & AlarmAssignmentNotificationRuleTriggerConfig>
|
||||
|
||||
export interface AlarmNotificationRuleTriggerConfig {
|
||||
alarmTypes?: Array<string>;
|
||||
alarmSeverities?: Array<AlarmSeverity>;
|
||||
notifyOn: Array<AlarmAction>;
|
||||
clearRule?: ClearRule;
|
||||
}
|
||||
|
||||
interface ClearRule {
|
||||
alarmStatuses: Array<AlarmSearchStatus>
|
||||
}
|
||||
|
||||
export interface DeviceInactivityNotificationRuleTriggerConfig {
|
||||
devices?: Array<string>;
|
||||
deviceProfiles?: Array<string>;
|
||||
}
|
||||
|
||||
export interface EntityActionNotificationRuleTriggerConfig {
|
||||
entityType: EntityType;
|
||||
created: boolean;
|
||||
updated: boolean;
|
||||
deleted: boolean;
|
||||
}
|
||||
|
||||
export interface AlarmCommentNotificationRuleTriggerConfig {
|
||||
alarmTypes?: Array<string>;
|
||||
alarmSeverities?: Array<AlarmSeverity>;
|
||||
alarmStatuses?: Array<AlarmSearchStatus>;
|
||||
clearRule?: {
|
||||
alarmStatuses: Array<AlarmSearchStatus>;
|
||||
};
|
||||
devices?: Array<string>;
|
||||
deviceProfiles?: Array<string>;
|
||||
entityType?: EntityType;
|
||||
created?: boolean;
|
||||
updated?: boolean;
|
||||
deleted?: boolean;
|
||||
notifyOnUnassign?: boolean;
|
||||
onlyUserComments?: boolean;
|
||||
}
|
||||
|
||||
export interface AlarmAssignmentNotificationRuleTriggerConfig {
|
||||
alarmTypes?: Array<string>;
|
||||
alarmSeverities?: Array<AlarmSeverity>;
|
||||
alarmStatuses?: Array<AlarmSearchStatus>;
|
||||
notifyOnUnassign?: boolean;
|
||||
}
|
||||
|
||||
export enum AlarmAction {
|
||||
CREATED = 'CREATED',
|
||||
SEVERITY_CHANGED = 'SEVERITY_CHANGED',
|
||||
ACKNOWLEDGED = 'ACKNOWLEDGED',
|
||||
CLEARED = 'CLEARED'
|
||||
}
|
||||
|
||||
export const AlarmActionTranslationMap = new Map<AlarmAction, string>([
|
||||
[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<string>;
|
||||
escalationTable?: {[key: number]: Array<string>};
|
||||
|
||||
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user