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>
|
<ng-template matStepLabel>{{ 'notification.alarm-trigger-settings' | translate }}</ng-template>
|
||||||
<form [formGroup]="alarmTemplateForm">
|
<form [formGroup]="alarmTemplateForm">
|
||||||
<section formGroupName="triggerConfig">
|
<section formGroupName="triggerConfig">
|
||||||
<fieldset class="fields-group tb-margin">
|
<fieldset class="fields-group tb-margin-before-field">
|
||||||
<legend translate>notification.filter</legend>
|
<legend translate>notification.filter</legend>
|
||||||
<tb-string-items-list
|
<tb-string-items-list
|
||||||
editable
|
editable
|
||||||
@ -117,7 +117,7 @@
|
|||||||
formControlName="alarmTypes">
|
formControlName="alarmTypes">
|
||||||
</tb-string-items-list>
|
</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-label translate>alarm.alarm-severity-list</mat-label>
|
||||||
<mat-select formControlName="alarmSeverities" multiple
|
<mat-select formControlName="alarmSeverities" multiple
|
||||||
placeholder="{{ !alarmTemplateForm.get('triggerConfig.alarmSeverities').value?.length ? ('alarm.any-severity' | translate) : '' }}">
|
placeholder="{{ !alarmTemplateForm.get('triggerConfig.alarmSeverities').value?.length ? ('alarm.any-severity' | translate) : '' }}">
|
||||||
@ -127,6 +127,17 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</fieldset>
|
</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>
|
</section>
|
||||||
</form>
|
</form>
|
||||||
<form [formGroup]="ruleNotificationForm">
|
<form [formGroup]="ruleNotificationForm">
|
||||||
@ -247,6 +258,9 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<mat-slide-toggle formControlName="onlyUserComments" style="margin-bottom: 12px;">
|
||||||
|
{{ 'notification.notify-only-user-comments' | translate }}
|
||||||
|
</mat-slide-toggle>
|
||||||
</section>
|
</section>
|
||||||
</form>
|
</form>
|
||||||
<form [formGroup]="ruleNotificationForm">
|
<form [formGroup]="ruleNotificationForm">
|
||||||
|
|||||||
@ -38,6 +38,10 @@
|
|||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.tb-margin-before-field {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
&.tb-hierarchy {
|
&.tb-hierarchy {
|
||||||
padding: 0 0 8px 16px;
|
padding: 0 0 8px 16px;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,8 @@
|
|||||||
///
|
///
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
AlarmAction,
|
||||||
|
AlarmActionTranslationMap,
|
||||||
NotificationRule,
|
NotificationRule,
|
||||||
NotificationTarget,
|
NotificationTarget,
|
||||||
TriggerType,
|
TriggerType,
|
||||||
@ -89,6 +91,9 @@ export class RuleNotificationDialogComponent extends
|
|||||||
alarmSeverityTranslationMap = alarmSeverityTranslations;
|
alarmSeverityTranslationMap = alarmSeverityTranslations;
|
||||||
alarmSeverities = Object.keys(AlarmSeverity) as Array<AlarmSeverity>;
|
alarmSeverities = Object.keys(AlarmSeverity) as Array<AlarmSeverity>;
|
||||||
|
|
||||||
|
alarmActions: AlarmAction[] = Object.values(AlarmAction);
|
||||||
|
alarmActionTranslationMap = AlarmActionTranslationMap;
|
||||||
|
|
||||||
entityType = EntityType;
|
entityType = EntityType;
|
||||||
entityTypes: EntityType[] = Object.values(EntityType);
|
entityTypes: EntityType[] = Object.values(EntityType);
|
||||||
isAdd = true;
|
isAdd = true;
|
||||||
@ -163,7 +168,8 @@ export class RuleNotificationDialogComponent extends
|
|||||||
alarmSeverities: [[]],
|
alarmSeverities: [[]],
|
||||||
clearRule: this.fb.group({
|
clearRule: this.fb.group({
|
||||||
alarmStatuses: [[]]
|
alarmStatuses: [[]]
|
||||||
})
|
}),
|
||||||
|
notifyOn: [[AlarmAction.CREATED], Validators.required]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -200,7 +206,8 @@ export class RuleNotificationDialogComponent extends
|
|||||||
triggerConfig: this.fb.group({
|
triggerConfig: this.fb.group({
|
||||||
alarmTypes: [null],
|
alarmTypes: [null],
|
||||||
alarmSeverities: [[]],
|
alarmSeverities: [[]],
|
||||||
alarmStatuses: [[]]
|
alarmStatuses: [[]],
|
||||||
|
onlyUserComments: [false]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -217,7 +224,8 @@ export class RuleNotificationDialogComponent extends
|
|||||||
[TriggerType.ALARM, this.alarmTemplateForm],
|
[TriggerType.ALARM, this.alarmTemplateForm],
|
||||||
[TriggerType.ALARM_COMMENT, this.alarmCommentTemplateForm],
|
[TriggerType.ALARM_COMMENT, this.alarmCommentTemplateForm],
|
||||||
[TriggerType.DEVICE_INACTIVITY, this.deviceInactivityTemplateForm],
|
[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) {
|
if (data.isAdd || data.isCopy) {
|
||||||
|
|||||||
@ -109,21 +109,60 @@ export interface NotificationRule extends Omit<BaseData<NotificationRuleId>, 'la
|
|||||||
additionalConfig: {description: string};
|
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>;
|
alarmTypes?: Array<string>;
|
||||||
alarmSeverities?: Array<AlarmSeverity>;
|
alarmSeverities?: Array<AlarmSeverity>;
|
||||||
alarmStatuses?: Array<AlarmSearchStatus>;
|
alarmStatuses?: Array<AlarmSearchStatus>;
|
||||||
clearRule?: {
|
notifyOnUnassign?: boolean;
|
||||||
alarmStatuses: Array<AlarmSearchStatus>;
|
onlyUserComments?: boolean;
|
||||||
};
|
|
||||||
devices?: Array<string>;
|
|
||||||
deviceProfiles?: Array<string>;
|
|
||||||
entityType?: EntityType;
|
|
||||||
created?: boolean;
|
|
||||||
updated?: boolean;
|
|
||||||
deleted?: 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 {
|
export interface NotificationRuleRecipientConfig {
|
||||||
targets?: Array<string>;
|
targets?: Array<string>;
|
||||||
escalationTable?: {[key: number]: Array<string>};
|
escalationTable?: {[key: number]: Array<string>};
|
||||||
|
|||||||
@ -2815,7 +2815,16 @@
|
|||||||
"notification-chain": "Notification chain",
|
"notification-chain": "Notification chain",
|
||||||
"notification-target": "Notification recipient",
|
"notification-target": "Notification recipient",
|
||||||
"notify": "notify",
|
"notify": "notify",
|
||||||
|
"notify-alarm-action": {
|
||||||
|
"created": "Alarm created",
|
||||||
|
"severity-changed": "Alarm severity changed",
|
||||||
|
"acknowledged": "Alarm acknowledged",
|
||||||
|
"cleared": "Alarm cleared"
|
||||||
|
},
|
||||||
"notify-again": "Notify again",
|
"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",
|
"notify-on-unassign": "Notify on unassign",
|
||||||
"platform-users": "Platform users",
|
"platform-users": "Platform users",
|
||||||
"recipient": "Recipient",
|
"recipient": "Recipient",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user