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>
<section formGroupName="usersFilter"
*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-select formControlName="type">
<mat-option *ngFor="let type of notificationTargetConfigTypes" [value]="type">
{{ notificationTargetConfigTypeTranslateMap.get(type) | translate }}
{{ notificationTargetConfigTypeInfoMap.get(type).name | translate }}
</mat-option>
</mat-select>
<mat-hint>{{ notificationTargetConfigTypeInfoMap.get(targetNotificationForm.get('configuration.usersFilter.type').value).hint | translate }}</mat-hint>
</mat-form-field>
<ng-container [ngSwitch]="targetNotificationForm.get('configuration.usersFilter.type').value">
<ng-container *ngSwitchCase="notificationTargetConfigType.TENANT_ADMINISTRATORS">

View File

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

View File

@ -354,13 +354,44 @@ export enum NotificationTargetConfigType {
ACTION_TARGET_USER = 'ACTION_TARGET_USER'
}
export const NotificationTargetConfigTypeTranslateMap = new Map<NotificationTargetConfigType, string>([
[NotificationTargetConfigType.ALL_USERS, 'notification.target-type.all-users'],
[NotificationTargetConfigType.TENANT_ADMINISTRATORS, 'notification.target-type.tenant-administrators'],
[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'],
[NotificationTargetConfigType.ACTION_TARGET_USER, 'notification.target-type.action-target-user'],
interface NotificationTargetConfigTypeInfo {
name: string;
hint?: string;
}
export const NotificationTargetConfigTypeInfoMap = new Map<NotificationTargetConfigType, NotificationTargetConfigTypeInfo>([
[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 {

View File

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