Browse Source

UI: Fix notification after change API

pull/7911/head
Vladyslav_Prykhodko 4 years ago
parent
commit
c6230a48b8
  1. 2
      ui-ngx/src/app/modules/home/pages/admin/general-settings.component.html
  2. 14
      ui-ngx/src/app/modules/home/pages/admin/notification-settings.component.html
  3. 8
      ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.html
  4. 4
      ui-ngx/src/app/modules/home/pages/notification-center/rule-table/rule-notification-dialog.component.ts
  5. 7
      ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-notification-dialog.componet.ts
  6. 2
      ui-ngx/src/app/shared/components/notification/notification.component.ts
  7. 14
      ui-ngx/src/app/shared/models/notification.models.ts
  8. 4
      ui-ngx/src/assets/locale/locale.constant-en_US.json

2
ui-ngx/src/app/modules/home/pages/admin/general-settings.component.html

@ -27,7 +27,7 @@
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async"> <mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async">
</mat-progress-bar> </mat-progress-bar>
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
<mat-card-content style="padding-top: 16px;"> <mat-card-content>
<form [formGroup]="generalSettings" (ngSubmit)="save()"> <form [formGroup]="generalSettings" (ngSubmit)="save()">
<fieldset [disabled]="isLoading$ | async"> <fieldset [disabled]="isLoading$ | async">
<mat-form-field class="mat-block"> <mat-form-field class="mat-block">

14
ui-ngx/src/app/modules/home/pages/admin/notification-settings.component.html

@ -16,12 +16,14 @@
--> -->
<div> <div>
<mat-card class="settings-card"> <mat-card appearance="outlined" class="settings-card">
<mat-card-title> <mat-card-header>
<div fxLayout="row"> <mat-card-title>
<span class="mat-headline" translate>admin.notification.notification-settings</span> <div fxLayout="row">
</div> <span class="mat-headline-5" translate>admin.notification.notification-settings</span>
</mat-card-title> </div>
</mat-card-title>
</mat-card-header>
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async"> <mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async">
</mat-progress-bar> </mat-progress-bar>
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div> <div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>

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

@ -112,8 +112,8 @@
<legend translate>notification.clear-rule</legend> <legend translate>notification.clear-rule</legend>
<mat-form-field fxFlex class="mat-block" floatLabel="always"> <mat-form-field fxFlex class="mat-block" floatLabel="always">
<mat-label translate>alarm.alarm-status-list</mat-label> <mat-label translate>alarm.alarm-status-list</mat-label>
<mat-select formControlName="alarmStatus" multiple <mat-select formControlName="alarmStatuses" multiple
placeholder="{{ !alarmTemplateForm.get('triggerConfig.clearRule.alarmStatus').value?.length ? ('alarm.any-status' | translate) : '' }}"> placeholder="{{ !alarmTemplateForm.get('triggerConfig.clearRule.alarmStatuses').value?.length ? ('alarm.any-status' | translate) : '' }}">
<mat-option *ngFor="let searchStatus of alarmSearchStatuses" [value]="searchStatus"> <mat-option *ngFor="let searchStatus of alarmSearchStatuses" [value]="searchStatus">
{{ alarmSearchStatusTranslationMap.get(searchStatus) | translate }} {{ alarmSearchStatusTranslationMap.get(searchStatus) | translate }}
</mat-option> </mat-option>
@ -232,8 +232,8 @@
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex class="mat-block" floatLabel="always"> <mat-form-field fxFlex class="mat-block" floatLabel="always">
<mat-label translate>alarm.alarm-status-list</mat-label> <mat-label translate>alarm.alarm-status-list</mat-label>
<mat-select formControlName="alarmStatus" multiple <mat-select formControlName="alarmStatuses" multiple
placeholder="{{ !alarmCommentTemplateForm.get('triggerConfig.alarmStatus').value?.length ? ('alarm.any-status' | translate) : '' }}"> placeholder="{{ !alarmCommentTemplateForm.get('triggerConfig.alarmStatuses').value?.length ? ('alarm.any-status' | translate) : '' }}">
<mat-option *ngFor="let searchStatus of alarmSearchStatuses" [value]="searchStatus"> <mat-option *ngFor="let searchStatus of alarmSearchStatuses" [value]="searchStatus">
{{ alarmSearchStatusTranslationMap.get(searchStatus) | translate }} {{ alarmSearchStatusTranslationMap.get(searchStatus) | translate }}
</mat-option> </mat-option>

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

@ -151,7 +151,7 @@ export class RuleNotificationDialogComponent extends
alarmTypes: [null], alarmTypes: [null],
alarmSeverities: [[]], alarmSeverities: [[]],
clearRule: this.fb.group({ clearRule: this.fb.group({
alarmStatus: [[]] alarmStatuses: [[]]
}) })
}) })
}); });
@ -189,7 +189,7 @@ export class RuleNotificationDialogComponent extends
triggerConfig: this.fb.group({ triggerConfig: this.fb.group({
alarmTypes: [null], alarmTypes: [null],
alarmSeverities: [[]], alarmSeverities: [[]],
alarmStatus: [[]] alarmStatuses: [[]]
}) })
}); });

7
ui-ngx/src/app/modules/home/pages/notification-center/targets-table/target-notification-dialog.componet.ts

@ -150,10 +150,15 @@ export class TargetNotificationDialogComponent extends
} }
save() { save() {
let formValue = deepTrim(this.targetNotificationForm.value); let formValue: NotificationTarget = deepTrim(this.targetNotificationForm.value);
if (isDefined(this.data.target)) { if (isDefined(this.data.target)) {
formValue = Object.assign({}, this.data.target, formValue); formValue = Object.assign({}, this.data.target, formValue);
} }
if (formValue.configuration.type === NotificationTargetType.PLATFORM_USERS && !formValue.configuration.usersFilter) {
formValue.configuration.usersFilter = {
type: NotificationTargetConfigType.ALL_USERS
}
}
this.notificationService.saveNotificationTarget(formValue).subscribe( this.notificationService.saveNotificationTarget(formValue).subscribe(
(target) => this.dialogRef.close(target) (target) => this.dialogRef.close(target)
); );

2
ui-ngx/src/app/shared/components/notification/notification.component.ts

@ -101,7 +101,7 @@ export class NotificationComponent implements OnInit {
const stateObject: StateObject = {}; const stateObject: StateObject = {};
if (this.notification.additionalConfig.actionButtonConfig.setEntityIdInState) { if (this.notification.additionalConfig.actionButtonConfig.setEntityIdInState) {
stateObject.params = { stateObject.params = {
entityId: this.notification.info.originatorId ?? null entityId: this.notification.info.stateEntityId ?? null
}; };
} else { } else {
stateObject.params = {}; stateObject.params = {};

14
ui-ngx/src/app/shared/models/notification.models.ts

@ -45,7 +45,7 @@ export interface NotificationInfo {
alarmSeverity?: AlarmSeverity; alarmSeverity?: AlarmSeverity;
alarmStatus?: AlarmStatus; alarmStatus?: AlarmStatus;
alarmType?: string; alarmType?: string;
originatorId?: EntityId; stateEntityId?: EntityId;
} }
export interface NotificationRequest extends Omit<BaseData<NotificationRequestId>, 'label'> { export interface NotificationRequest extends Omit<BaseData<NotificationRequestId>, 'label'> {
@ -112,9 +112,9 @@ export interface NotificationRule extends Omit<BaseData<NotificationRuleId>, 'la
export interface NotificationRuleTriggerConfig { export interface NotificationRuleTriggerConfig {
alarmTypes?: Array<string>; alarmTypes?: Array<string>;
alarmSeverities?: Array<AlarmSeverity>; alarmSeverities?: Array<AlarmSeverity>;
alarmStatus?: Array<AlarmSearchStatus>; alarmStatuses?: Array<AlarmSearchStatus>;
clearRule?: { clearRule?: {
alarmStatus: Array<AlarmSearchStatus>; alarmStatuses: Array<AlarmSearchStatus>;
}; };
devices?: Array<string>; devices?: Array<string>;
deviceProfiles?: Array<string>; deviceProfiles?: Array<string>;
@ -209,11 +209,11 @@ interface PushDeliveryMethodAdditionalConfig {
actionButtonConfig: { actionButtonConfig: {
enabled: boolean; enabled: boolean;
text: string; text: string;
linkType: ActionButtonLinkType, linkType: ActionButtonLinkType;
link?: string; link?: string;
dashboardId?: string; dashboardId?: string;
dashboardState?: string; dashboardState?: string;
setEntityIdInState?: boolean setEntityIdInState?: boolean;
}; };
} }
@ -242,7 +242,7 @@ export const NotificationDeliveryMethodTranslateMap = new Map<NotificationDelive
[NotificationDeliveryMethod.PUSH, 'notification.delivery-method-type.push'], [NotificationDeliveryMethod.PUSH, 'notification.delivery-method-type.push'],
[NotificationDeliveryMethod.SMS, 'notification.delivery-method-type.sms'], [NotificationDeliveryMethod.SMS, 'notification.delivery-method-type.sms'],
[NotificationDeliveryMethod.EMAIL, 'notification.delivery-method-type.email'], [NotificationDeliveryMethod.EMAIL, 'notification.delivery-method-type.email'],
[NotificationDeliveryMethod.SLACK, 'notification.delivery-method-type.slack'], [NotificationDeliveryMethod.SLACK, 'notification.delivery-method-type.slack']
]); ]);
export enum NotificationRequestStatus { export enum NotificationRequestStatus {
@ -353,7 +353,7 @@ export const NotificationTemplateTypeTranslateMap = new Map<NotificationType, No
name: 'notification.template-type.alarm-comment', name: 'notification.template-type.alarm-comment',
hint: 'notification.template-hint.alarm-comment' hint: 'notification.template-hint.alarm-comment'
} }
], ]
]); ]);
export enum TriggerType { export enum TriggerType {

4
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -2861,8 +2861,8 @@
"targets-required": "Recipients is required", "targets-required": "Recipients is required",
"template": "Template", "template": "Template",
"template-hint": { "template-hint": {
"alarm": "Available params: ${alarmType}, ${alarmSeverity}, ${alarmStatus}, ${alarmOriginatorEntityType}, ${alarmOriginatorId}, ${alarmId}", "alarm": "Available params: ${alarmType}, ${alarmSeverity}, ${alarmStatus}, ${alarmOriginatorEntityType}, ${alarmOriginatorId}, ${alarmId}, ${alarmAction}",
"alarm-comment": "Available params: ${comment}, ${alarmType}, ${alarmId}", "alarm-comment": "Available params: ${comment}, ${alarmType}, ${alarmId}, ${alarmType}, ${alarmSeverity}, ${alarmStatus}, ${alarmOriginatorEntityType}, ${alarmOriginatorId}, ${alarmId}, ${alarmAction}",
"device-inactivity": "Available params: ${deviceName}, ${deviceType}, ${deviceId}", "device-inactivity": "Available params: ${deviceName}, ${deviceType}, ${deviceId}",
"entity-action": "Available params: ${actionType}, ${entityType}, ${entityName}, ${entityId}, ${originatorUserName}, ${originatorUserId}", "entity-action": "Available params: ${actionType}, ${entityType}, ${entityName}, ${entityId}, ${originatorUserName}, ${originatorUserId}",
"general": "Available params: ${recipientEmail}, ${recipientFirstName}, ${recipientLastName}" "general": "Available params: ${recipientEmail}, ${recipientFirstName}, ${recipientLastName}"

Loading…
Cancel
Save