Browse Source

UI: Add new notification type alarm assignment

pull/7911/head
Vladyslav_Prykhodko 4 years ago
parent
commit
c7dbf6be89
  1. 48
      ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.html
  2. 10
      ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts
  3. 18
      ui-ngx/src/app/shared/models/notification.models.ts
  4. 5
      ui-ngx/src/assets/locale/locale.constant-en_US.json

48
ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.html

@ -258,6 +258,54 @@
</section>
</form>
</mat-step>
<mat-step *ngIf="ruleNotificationForm.get('triggerType').value === triggerType.ALARM_ASSIGNMENT"
[stepControl]="alarmAssignmentTemplateForm">
<ng-template matStepLabel>{{ 'notification.alarm-assignment-trigger-settings' | translate }}</ng-template>
<form [formGroup]="alarmAssignmentTemplateForm">
<section formGroupName="triggerConfig">
<fieldset class="fields-group tb-margin">
<legend translate>notification.filter</legend>
<tb-string-items-list
editable
label="{{ 'alarm.alarm-type-list' | translate }}"
placeholder="{{ !alarmAssignmentTemplateForm.get('triggerConfig.alarmTypes').value?.length ? ('alarm.any-type' | translate) : '' }}"
floatLabel="always"
formControlName="alarmTypes">
</tb-string-items-list>
<mat-form-field fxFlex class="mat-block" floatLabel="always">
<mat-label translate>alarm.alarm-severity-list</mat-label>
<mat-select formControlName="alarmSeverities" multiple
placeholder="{{ !alarmAssignmentTemplateForm.get('triggerConfig.alarmSeverities').value?.length ? ('alarm.any-severity' | translate) : '' }}">
<mat-option *ngFor="let alarmSeverity of alarmSeverities" [value]="alarmSeverity">
{{ alarmSeverityTranslationMap.get(alarmSeverity) | translate }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field fxFlex class="mat-block" floatLabel="always">
<mat-label translate>alarm.alarm-status-list</mat-label>
<mat-select formControlName="alarmStatuses" multiple
placeholder="{{ !alarmAssignmentTemplateForm.get('triggerConfig.alarmStatuses').value?.length ? ('alarm.any-status' | translate) : '' }}">
<mat-option *ngFor="let searchStatus of alarmSearchStatuses" [value]="searchStatus">
{{ alarmSearchStatusTranslationMap.get(searchStatus) | translate }}
</mat-option>
</mat-select>
</mat-form-field>
</fieldset>
<mat-slide-toggle formControlName="notifyOnUnassign" style="margin-bottom: 12px;">
{{ 'notification.notify-on-unassign' | translate }}
</mat-slide-toggle>
</section>
</form>
<form [formGroup]="ruleNotificationForm">
<section formGroupName="additionalConfig">
<mat-form-field class="mat-block">
<mat-label translate>notification.description</mat-label>
<input matInput formControlName="description">
</mat-form-field>
</section>
</form>
</mat-step>
</mat-horizontal-stepper>
</div>
<mat-divider></mat-divider>

10
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, FormGroup>([
[TriggerType.ALARM, this.alarmTemplateForm],
[TriggerType.ALARM_COMMENT, this.alarmCommentTemplateForm],

18
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, string | null>([
[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<AlarmSeverity, string>(
@ -353,6 +355,12 @@ export const NotificationTemplateTypeTranslateMap = new Map<NotificationType, No
name: 'notification.template-type.alarm-comment',
hint: 'notification.template-hint.alarm-comment'
}
],
[NotificationType.ALARM_ASSIGNMENT,
{
name: 'notification.template-type.alarm-assignment',
hint: 'notification.template-hint.alarm-assignment'
}
]
]);
@ -360,12 +368,14 @@ export enum TriggerType {
ALARM = 'ALARM',
DEVICE_INACTIVITY = 'DEVICE_INACTIVITY',
ENTITY_ACTION = 'ENTITY_ACTION',
ALARM_COMMENT = 'ALARM_COMMENT'
ALARM_COMMENT = 'ALARM_COMMENT',
ALARM_ASSIGNMENT = 'ALARM_ASSIGNMENT'
}
export const TriggerTypeTranslationMap = new Map<TriggerType, string>([
[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'],
]);

5
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",

Loading…
Cancel
Save