UI: Add support hint for target type notification

This commit is contained in:
Vladyslav_Prykhodko 2023-03-20 15:54:34 +02:00
parent d66d882a0c
commit 5bcbf2dc6d
4 changed files with 45 additions and 11 deletions

View File

@ -47,13 +47,14 @@
</mat-radio-group> </mat-radio-group>
<section formGroupName="usersFilter" <section formGroupName="usersFilter"
*ngIf="targetNotificationForm.get('configuration.type').value === notificationTargetType.PLATFORM_USERS"> *ngIf="targetNotificationForm.get('configuration.type').value === notificationTargetType.PLATFORM_USERS">
<mat-form-field class="mat-block"> <mat-form-field class="mat-block" subscriptSizing="dynamic">
<mat-label translate>notification.target-type.user-filters</mat-label> <mat-label translate>notification.target-type.user-filters</mat-label>
<mat-select formControlName="type"> <mat-select formControlName="type">
<mat-option *ngFor="let type of notificationTargetConfigTypes" [value]="type"> <mat-option *ngFor="let type of notificationTargetConfigTypes" [value]="type">
{{ notificationTargetConfigTypeTranslateMap.get(type) | translate }} {{ notificationTargetConfigTypeInfoMap.get(type).name | translate }}
</mat-option> </mat-option>
</mat-select> </mat-select>
<mat-hint>{{ notificationTargetConfigTypeInfoMap.get(targetNotificationForm.get('configuration.usersFilter.type').value).hint | translate }}</mat-hint>
</mat-form-field> </mat-form-field>
<ng-container [ngSwitch]="targetNotificationForm.get('configuration.usersFilter.type').value"> <ng-container [ngSwitch]="targetNotificationForm.get('configuration.usersFilter.type').value">
<ng-container *ngSwitchCase="notificationTargetConfigType.TENANT_ADMINISTRATORS"> <ng-container *ngSwitchCase="notificationTargetConfigType.TENANT_ADMINISTRATORS">

View File

@ -17,7 +17,7 @@
import { import {
NotificationTarget, NotificationTarget,
NotificationTargetConfigType, NotificationTargetConfigType,
NotificationTargetConfigTypeTranslateMap, NotificationTargetConfigTypeInfoMap,
NotificationTargetType, NotificationTargetType,
NotificationTargetTypeTranslationMap, NotificationTargetTypeTranslationMap,
SlackChanelType, SlackChanelType,
@ -62,7 +62,7 @@ export class TargetNotificationDialogComponent extends
notificationTargetTypeTranslationMap = NotificationTargetTypeTranslationMap; notificationTargetTypeTranslationMap = NotificationTargetTypeTranslationMap;
notificationTargetConfigType = NotificationTargetConfigType; notificationTargetConfigType = NotificationTargetConfigType;
notificationTargetConfigTypes: NotificationTargetConfigType[] = this.allowNotificationTargetConfigTypes(); notificationTargetConfigTypes: NotificationTargetConfigType[] = this.allowNotificationTargetConfigTypes();
notificationTargetConfigTypeTranslateMap = NotificationTargetConfigTypeTranslateMap; notificationTargetConfigTypeInfoMap = NotificationTargetConfigTypeInfoMap;
slackChanelTypes = Object.keys(SlackChanelType) as SlackChanelType[]; slackChanelTypes = Object.keys(SlackChanelType) as SlackChanelType[];
slackChanelTypesTranslateMap = SlackChanelTypesTranslateMap; slackChanelTypesTranslateMap = SlackChanelTypesTranslateMap;

View File

@ -354,13 +354,44 @@ export enum NotificationTargetConfigType {
ACTION_TARGET_USER = 'ACTION_TARGET_USER' ACTION_TARGET_USER = 'ACTION_TARGET_USER'
} }
export const NotificationTargetConfigTypeTranslateMap = new Map<NotificationTargetConfigType, string>([ interface NotificationTargetConfigTypeInfo {
[NotificationTargetConfigType.ALL_USERS, 'notification.target-type.all-users'], name: string;
[NotificationTargetConfigType.TENANT_ADMINISTRATORS, 'notification.target-type.tenant-administrators'], hint?: string;
[NotificationTargetConfigType.CUSTOMER_USERS, 'notification.target-type.customer-users'], }
[NotificationTargetConfigType.USER_LIST, 'notification.target-type.user-list'],
[NotificationTargetConfigType.ORIGINATOR_ENTITY_OWNER_USERS, 'notification.target-type.originator-entity-owner-users'], export const NotificationTargetConfigTypeInfoMap = new Map<NotificationTargetConfigType, NotificationTargetConfigTypeInfo>([
[NotificationTargetConfigType.ACTION_TARGET_USER, 'notification.target-type.action-target-user'], [NotificationTargetConfigType.ALL_USERS,
{
name: 'notification.target-type.all-users'
}
],
[NotificationTargetConfigType.TENANT_ADMINISTRATORS,
{
name: 'notification.target-type.tenant-administrators'
}
],
[NotificationTargetConfigType.CUSTOMER_USERS,
{
name: 'notification.target-type.customer-users'
}
],
[NotificationTargetConfigType.USER_LIST,
{
name: 'notification.target-type.user-list'
}
],
[NotificationTargetConfigType.ORIGINATOR_ENTITY_OWNER_USERS,
{
name: 'notification.target-type.originator-entity-owner-users',
hint: 'notification.target-type.originator-entity-owner-users-hint'
}
],
[NotificationTargetConfigType.ACTION_TARGET_USER,
{
name: 'notification.target-type.action-target-user',
hint: 'notification.target-type.action-target-user-hint'
}
]
]); ]);
export enum NotificationType { export enum NotificationType {

View File

@ -2873,9 +2873,11 @@
"target-name-required": "Name is required", "target-name-required": "Name is required",
"target-type": { "target-type": {
"action-target-user": "Action target user", "action-target-user": "Action target user",
"action-target-user-hint": "Action target user hint",
"all-users": "All users", "all-users": "All users",
"customer-users": "Customer users", "customer-users": "Customer users",
"originator-entity-owner-users": "Users of originator entity owner", "originator-entity-owner-users": "Users of originator entity owner",
"originator-entity-owner-users-hint": "Users of originator entity owner hint",
"tenant-administrators": "Tenant administrators", "tenant-administrators": "Tenant administrators",
"user-filters": "User filter", "user-filters": "User filter",
"user-list": "User list" "user-list": "User list"