2022-12-28 10:03:11 +02:00
|
|
|
///
|
2023-02-14 11:39:29 +02:00
|
|
|
/// Copyright © 2016-2023 The Thingsboard Authors
|
2022-12-28 10:03:11 +02:00
|
|
|
///
|
|
|
|
|
/// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
/// you may not use this file except in compliance with the License.
|
|
|
|
|
/// You may obtain a copy of the License at
|
|
|
|
|
///
|
|
|
|
|
/// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
///
|
|
|
|
|
/// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
/// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
/// See the License for the specific language governing permissions and
|
|
|
|
|
/// limitations under the License.
|
|
|
|
|
///
|
|
|
|
|
|
|
|
|
|
import { NotificationId } from '@shared/models/id/notification-id';
|
|
|
|
|
import { NotificationRequestId } from '@shared/models/id/notification-request-id';
|
|
|
|
|
import { UserId } from '@shared/models/id/user-id';
|
|
|
|
|
import { BaseData } from '@shared/models/base-data';
|
|
|
|
|
import { TenantId } from '@shared/models/id/tenant-id';
|
|
|
|
|
import { NotificationTargetId } from '@shared/models/id/notification-target-id';
|
|
|
|
|
import { NotificationTemplateId } from '@shared/models/id/notification-template-id';
|
|
|
|
|
import { EntityId } from '@shared/models/id/entity-id';
|
|
|
|
|
import { NotificationRuleId } from '@shared/models/id/notification-rule-id';
|
2023-03-10 18:23:25 +02:00
|
|
|
import { AlarmSearchStatus, AlarmSeverity, AlarmStatus } from '@shared/models/alarm.models';
|
2023-01-31 02:03:51 +02:00
|
|
|
import { EntityType } from '@shared/models/entity-type.models';
|
2022-12-28 10:03:11 +02:00
|
|
|
|
|
|
|
|
export interface Notification {
|
|
|
|
|
readonly id: NotificationId;
|
|
|
|
|
readonly requestId: NotificationRequestId;
|
|
|
|
|
readonly recipientId: UserId;
|
2023-01-17 18:26:25 +02:00
|
|
|
readonly type: NotificationType;
|
|
|
|
|
readonly subject: string;
|
2022-12-28 10:03:11 +02:00
|
|
|
readonly text: string;
|
|
|
|
|
readonly info: NotificationInfo;
|
|
|
|
|
readonly status: NotificationStatus;
|
2023-01-20 18:08:30 +02:00
|
|
|
readonly createdTime: number;
|
2023-03-15 13:28:31 +02:00
|
|
|
readonly additionalConfig?: WebDeliveryMethodAdditionalConfig;
|
2022-12-28 10:03:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface NotificationInfo {
|
|
|
|
|
description: string;
|
2023-01-31 17:46:12 +02:00
|
|
|
type: string;
|
2023-02-06 13:31:00 +02:00
|
|
|
alarmSeverity?: AlarmSeverity;
|
|
|
|
|
alarmStatus?: AlarmStatus;
|
|
|
|
|
alarmType?: string;
|
2023-03-14 16:37:05 +02:00
|
|
|
stateEntityId?: EntityId;
|
2022-12-28 10:03:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface NotificationRequest extends Omit<BaseData<NotificationRequestId>, 'label'> {
|
|
|
|
|
tenantId?: TenantId;
|
2023-01-17 18:26:25 +02:00
|
|
|
targets: Array<string>;
|
2023-02-20 11:30:26 +02:00
|
|
|
templateId?: NotificationTemplateId;
|
|
|
|
|
template?: NotificationTemplate;
|
2022-12-28 10:03:11 +02:00
|
|
|
info?: NotificationInfo;
|
|
|
|
|
deliveryMethods: Array<NotificationDeliveryMethod>;
|
|
|
|
|
originatorEntityId: EntityId;
|
|
|
|
|
status: NotificationRequestStatus;
|
|
|
|
|
stats: NotificationRequestStats;
|
|
|
|
|
additionalConfig: NotificationRequestConfig;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-18 13:03:37 +02:00
|
|
|
export interface NotificationRequestInfo extends NotificationRequest {
|
|
|
|
|
templateName: string;
|
|
|
|
|
deliveryMethods: NotificationDeliveryMethod[];
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-17 18:26:25 +02:00
|
|
|
export interface NotificationRequestPreview {
|
|
|
|
|
totalRecipientsCount: number;
|
|
|
|
|
recipientsCountByTarget: { [key in string]: number };
|
|
|
|
|
processedTemplates: { [key in NotificationDeliveryMethod]: DeliveryMethodNotificationTemplate };
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-28 10:03:11 +02:00
|
|
|
export interface NotificationRequestStats {
|
|
|
|
|
sent: Map<NotificationDeliveryMethod, any>;
|
2023-03-20 16:51:42 +02:00
|
|
|
errors: { [key in NotificationDeliveryMethod]: {[errorKey in string]: string}};
|
2022-12-28 10:03:11 +02:00
|
|
|
processedRecipients: Map<NotificationDeliveryMethod, Set<UserId>>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface NotificationRequestConfig {
|
|
|
|
|
sendingDelayInSec: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface NotificationSettings {
|
2023-01-26 13:36:55 +02:00
|
|
|
deliveryMethodsConfigs: { [key in NotificationDeliveryMethod]: NotificationDeliveryMethodConfig };
|
2022-12-28 10:03:11 +02:00
|
|
|
}
|
|
|
|
|
|
2023-01-26 13:36:55 +02:00
|
|
|
export interface NotificationDeliveryMethodConfig extends Partial<SlackNotificationDeliveryMethodConfig>{
|
2022-12-28 10:03:11 +02:00
|
|
|
enabled: boolean;
|
|
|
|
|
method: NotificationDeliveryMethod;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-26 13:36:55 +02:00
|
|
|
interface SlackNotificationDeliveryMethodConfig {
|
|
|
|
|
botToken: string;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-28 10:03:11 +02:00
|
|
|
export interface SlackConversation {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface NotificationRule extends Omit<BaseData<NotificationRuleId>, 'label'>{
|
|
|
|
|
tenantId: TenantId;
|
|
|
|
|
templateId: NotificationTemplateId;
|
2023-01-31 02:03:51 +02:00
|
|
|
triggerType: TriggerType;
|
|
|
|
|
triggerConfig: NotificationRuleTriggerConfig;
|
2023-02-01 02:02:27 +02:00
|
|
|
recipientsConfig: NotificationRuleRecipientConfig;
|
|
|
|
|
additionalConfig: {description: string};
|
2022-12-28 10:03:11 +02:00
|
|
|
}
|
|
|
|
|
|
2023-03-20 16:51:42 +02:00
|
|
|
export type NotificationRuleTriggerConfig = Partial<AlarmNotificationRuleTriggerConfig & DeviceInactivityNotificationRuleTriggerConfig &
|
|
|
|
|
EntityActionNotificationRuleTriggerConfig & AlarmCommentNotificationRuleTriggerConfig & AlarmAssignmentNotificationRuleTriggerConfig &
|
2023-03-21 15:03:30 +02:00
|
|
|
RuleEngineLifecycleEventNotificationRuleTriggerConfig & EntitiesLimitNotificationRuleTriggerConfig>;
|
2023-03-16 15:45:34 +02:00
|
|
|
|
|
|
|
|
export interface AlarmNotificationRuleTriggerConfig {
|
2023-01-31 02:03:51 +02:00
|
|
|
alarmTypes?: Array<string>;
|
|
|
|
|
alarmSeverities?: Array<AlarmSeverity>;
|
2023-03-16 15:45:34 +02:00
|
|
|
notifyOn: Array<AlarmAction>;
|
|
|
|
|
clearRule?: ClearRule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface ClearRule {
|
2023-03-20 16:51:42 +02:00
|
|
|
alarmStatuses: Array<AlarmSearchStatus>;
|
2023-03-16 15:45:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface DeviceInactivityNotificationRuleTriggerConfig {
|
2023-01-31 02:03:51 +02:00
|
|
|
devices?: Array<string>;
|
2023-02-01 15:58:00 +02:00
|
|
|
deviceProfiles?: Array<string>;
|
2022-12-28 10:03:11 +02:00
|
|
|
}
|
|
|
|
|
|
2023-03-16 15:45:34 +02:00
|
|
|
export interface EntityActionNotificationRuleTriggerConfig {
|
|
|
|
|
entityType: EntityType;
|
|
|
|
|
created: boolean;
|
|
|
|
|
updated: boolean;
|
|
|
|
|
deleted: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface AlarmCommentNotificationRuleTriggerConfig {
|
|
|
|
|
alarmTypes?: Array<string>;
|
|
|
|
|
alarmSeverities?: Array<AlarmSeverity>;
|
|
|
|
|
alarmStatuses?: Array<AlarmSearchStatus>;
|
|
|
|
|
onlyUserComments?: boolean;
|
2023-03-17 16:35:34 +02:00
|
|
|
notifyOnCommentUpdate?: boolean;
|
2023-03-16 15:45:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface AlarmAssignmentNotificationRuleTriggerConfig {
|
|
|
|
|
alarmTypes?: Array<string>;
|
|
|
|
|
alarmSeverities?: Array<AlarmSeverity>;
|
|
|
|
|
alarmStatuses?: Array<AlarmSearchStatus>;
|
2023-03-17 16:35:34 +02:00
|
|
|
notifyOn: Array<AlarmAssignmentAction>;
|
2023-03-16 15:45:34 +02:00
|
|
|
}
|
|
|
|
|
|
2023-03-17 18:53:03 +02:00
|
|
|
export interface RuleEngineLifecycleEventNotificationRuleTriggerConfig {
|
|
|
|
|
ruleChains?: Array<string>;
|
|
|
|
|
ruleChainEvents?: Array<ComponentLifecycleEvent>;
|
|
|
|
|
onlyRuleChainLifecycleFailures: boolean;
|
|
|
|
|
trackRuleNodeEvents: boolean;
|
|
|
|
|
ruleNodeEvents: Array<any>;
|
|
|
|
|
onlyRuleNodeLifecycleFailures: ComponentLifecycleEvent;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-21 15:03:30 +02:00
|
|
|
export interface EntitiesLimitNotificationRuleTriggerConfig {
|
|
|
|
|
entityTypes: EntityType[];
|
|
|
|
|
threshold: number;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-17 18:53:03 +02:00
|
|
|
export enum ComponentLifecycleEvent {
|
|
|
|
|
STARTED = 'STARTED',
|
|
|
|
|
UPDATED = 'UPDATED',
|
|
|
|
|
STOPPED = 'STOPPED'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const ComponentLifecycleEventTranslationMap = new Map<ComponentLifecycleEvent, string>([
|
|
|
|
|
[ComponentLifecycleEvent.STARTED, 'event.started'],
|
|
|
|
|
[ComponentLifecycleEvent.UPDATED, 'event.updated'],
|
|
|
|
|
[ComponentLifecycleEvent.STOPPED, 'event.stopped']
|
2023-03-20 16:51:42 +02:00
|
|
|
]);
|
2023-03-17 18:53:03 +02:00
|
|
|
|
2023-03-16 15:45:34 +02:00
|
|
|
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']
|
2023-03-20 16:51:42 +02:00
|
|
|
]);
|
2023-03-16 15:45:34 +02:00
|
|
|
|
2023-03-17 16:35:34 +02:00
|
|
|
export enum AlarmAssignmentAction {
|
|
|
|
|
ASSIGNED = 'ASSIGNED',
|
|
|
|
|
UNASSIGNED = 'UNASSIGNED'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const AlarmAssignmentActionTranslationMap = new Map<AlarmAssignmentAction, string>([
|
|
|
|
|
[AlarmAssignmentAction.ASSIGNED, 'notification.notify-alarm-action.assigned'],
|
|
|
|
|
[AlarmAssignmentAction.UNASSIGNED, 'notification.notify-alarm-action.unassigned']
|
2023-03-20 16:51:42 +02:00
|
|
|
]);
|
2023-03-17 16:35:34 +02:00
|
|
|
|
2023-01-31 02:03:51 +02:00
|
|
|
export interface NotificationRuleRecipientConfig {
|
|
|
|
|
targets?: Array<string>;
|
2023-02-02 15:25:04 +02:00
|
|
|
escalationTable?: {[key: number]: Array<string>};
|
2022-12-28 10:03:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface NonConfirmedNotificationEscalation {
|
|
|
|
|
delayInSec: number;
|
2023-02-02 15:25:04 +02:00
|
|
|
targets: Array<string>;
|
2022-12-28 10:03:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface NotificationTarget extends Omit<BaseData<NotificationTargetId>, 'label'>{
|
|
|
|
|
tenantId: TenantId;
|
|
|
|
|
configuration: NotificationTargetConfig;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-31 13:35:16 +02:00
|
|
|
export interface NotificationTargetConfig extends Partial<PlatformUsersNotificationTargetConfig & SlackNotificationTargetConfig> {
|
|
|
|
|
description?: string;
|
|
|
|
|
type: NotificationTargetType;
|
|
|
|
|
}
|
|
|
|
|
export interface PlatformUsersNotificationTargetConfig {
|
|
|
|
|
usersFilter: UsersFilter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface UsersFilter extends
|
2023-03-17 16:35:34 +02:00
|
|
|
Partial<UserListFilter & CustomerUsersFilter & TenantAdministratorsFilter>{
|
2022-12-28 10:03:11 +02:00
|
|
|
type: NotificationTargetConfigType;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-17 16:35:34 +02:00
|
|
|
interface UserListFilter {
|
2022-12-28 10:03:11 +02:00
|
|
|
usersIds: Array<string>;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-17 16:35:34 +02:00
|
|
|
interface CustomerUsersFilter {
|
2022-12-28 10:03:11 +02:00
|
|
|
customerId: string;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-17 16:35:34 +02:00
|
|
|
interface TenantAdministratorsFilter {
|
|
|
|
|
tenantsIds?: Array<string>;
|
|
|
|
|
tenantProfilesIds?: Array<string>;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-31 13:35:16 +02:00
|
|
|
export interface SlackNotificationTargetConfig {
|
2023-01-31 17:06:55 +02:00
|
|
|
conversationType: SlackChanelType;
|
|
|
|
|
conversation: SlackConversation;
|
2023-01-31 13:35:16 +02:00
|
|
|
}
|
|
|
|
|
export enum NotificationTargetType {
|
|
|
|
|
PLATFORM_USERS = 'PLATFORM_USERS',
|
|
|
|
|
SLACK = 'SLACK'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const NotificationTargetTypeTranslationMap = new Map<NotificationTargetType, string>([
|
|
|
|
|
[NotificationTargetType.PLATFORM_USERS, 'notification.platform-users'],
|
|
|
|
|
[NotificationTargetType.SLACK, 'notification.slack']
|
|
|
|
|
]);
|
|
|
|
|
|
2022-12-28 10:03:11 +02:00
|
|
|
export interface NotificationTemplate extends Omit<BaseData<NotificationTemplateId>, 'label'>{
|
|
|
|
|
tenantId: TenantId;
|
2023-01-17 18:26:25 +02:00
|
|
|
notificationType: NotificationType;
|
2022-12-28 10:03:11 +02:00
|
|
|
configuration: NotificationTemplateConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface NotificationTemplateConfig {
|
2023-01-12 18:11:37 +02:00
|
|
|
deliveryMethodsTemplates: {
|
|
|
|
|
[key in NotificationDeliveryMethod]: DeliveryMethodNotificationTemplate
|
|
|
|
|
};
|
2022-12-28 10:03:11 +02:00
|
|
|
}
|
|
|
|
|
|
2023-01-12 18:11:37 +02:00
|
|
|
export interface DeliveryMethodNotificationTemplate extends
|
2023-03-15 13:28:31 +02:00
|
|
|
Partial<WebDeliveryMethodNotificationTemplate & EmailDeliveryMethodNotificationTemplate & SlackDeliveryMethodNotificationTemplate>{
|
2023-01-12 12:38:03 +02:00
|
|
|
body?: string;
|
2023-01-12 18:11:37 +02:00
|
|
|
enabled: boolean;
|
2022-12-28 10:03:11 +02:00
|
|
|
method: NotificationDeliveryMethod;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-15 13:28:31 +02:00
|
|
|
interface WebDeliveryMethodNotificationTemplate {
|
2023-01-12 12:38:03 +02:00
|
|
|
subject?: string;
|
2023-03-15 13:28:31 +02:00
|
|
|
additionalConfig: WebDeliveryMethodAdditionalConfig;
|
2023-01-20 18:08:30 +02:00
|
|
|
}
|
|
|
|
|
|
2023-03-15 13:28:31 +02:00
|
|
|
interface WebDeliveryMethodAdditionalConfig {
|
2023-01-20 18:08:30 +02:00
|
|
|
icon: {
|
|
|
|
|
enabled: boolean;
|
|
|
|
|
icon: string;
|
|
|
|
|
color: string;
|
|
|
|
|
};
|
|
|
|
|
actionButtonConfig: {
|
|
|
|
|
enabled: boolean;
|
|
|
|
|
text: string;
|
2023-03-14 16:37:05 +02:00
|
|
|
linkType: ActionButtonLinkType;
|
2023-02-24 11:29:36 +02:00
|
|
|
link?: string;
|
|
|
|
|
dashboardId?: string;
|
|
|
|
|
dashboardState?: string;
|
2023-03-14 16:37:05 +02:00
|
|
|
setEntityIdInState?: boolean;
|
2023-01-20 18:08:30 +02:00
|
|
|
};
|
2023-01-12 12:38:03 +02:00
|
|
|
}
|
|
|
|
|
|
2022-12-28 10:03:11 +02:00
|
|
|
interface EmailDeliveryMethodNotificationTemplate {
|
|
|
|
|
subject: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface SlackDeliveryMethodNotificationTemplate {
|
|
|
|
|
conversationType: SlackChanelType;
|
|
|
|
|
conversationId: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export enum NotificationStatus {
|
|
|
|
|
SENT = 'SENT',
|
|
|
|
|
READ = 'READ'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export enum NotificationDeliveryMethod {
|
2023-03-15 13:28:31 +02:00
|
|
|
WEB = 'WEB',
|
2022-12-28 10:03:11 +02:00
|
|
|
SMS = 'SMS',
|
|
|
|
|
EMAIL = 'EMAIL',
|
|
|
|
|
SLACK = 'SLACK'
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-17 18:26:25 +02:00
|
|
|
export const NotificationDeliveryMethodTranslateMap = new Map<NotificationDeliveryMethod, string>([
|
2023-03-15 13:28:31 +02:00
|
|
|
[NotificationDeliveryMethod.WEB, 'notification.delivery-method-type.web'],
|
2023-01-17 18:26:25 +02:00
|
|
|
[NotificationDeliveryMethod.SMS, 'notification.delivery-method-type.sms'],
|
|
|
|
|
[NotificationDeliveryMethod.EMAIL, 'notification.delivery-method-type.email'],
|
2023-03-14 16:37:05 +02:00
|
|
|
[NotificationDeliveryMethod.SLACK, 'notification.delivery-method-type.slack']
|
2023-01-17 18:26:25 +02:00
|
|
|
]);
|
|
|
|
|
|
2022-12-28 10:03:11 +02:00
|
|
|
export enum NotificationRequestStatus {
|
2023-01-17 18:26:25 +02:00
|
|
|
PROCESSING = 'PROCESSING',
|
|
|
|
|
SCHEDULED = 'SCHEDULED',
|
|
|
|
|
SENT = 'SENT'
|
2022-12-28 10:03:11 +02:00
|
|
|
}
|
|
|
|
|
|
2023-01-17 18:26:25 +02:00
|
|
|
export const NotificationRequestStatusTranslateMap = new Map<NotificationRequestStatus, string>([
|
2023-01-31 17:06:55 +02:00
|
|
|
[NotificationRequestStatus.PROCESSING, 'notification.request-status.processing'],
|
|
|
|
|
[NotificationRequestStatus.SCHEDULED, 'notification.request-status.scheduled'],
|
|
|
|
|
[NotificationRequestStatus.SENT, 'notification.request-status.sent']
|
2023-01-17 18:26:25 +02:00
|
|
|
]);
|
|
|
|
|
|
2022-12-28 10:03:11 +02:00
|
|
|
export enum SlackChanelType {
|
|
|
|
|
PUBLIC_CHANNEL = 'PUBLIC_CHANNEL',
|
2023-02-14 18:16:29 +02:00
|
|
|
PRIVATE_CHANNEL = 'PRIVATE_CHANNEL',
|
|
|
|
|
DIRECT= 'DIRECT'
|
2022-12-28 10:03:11 +02:00
|
|
|
}
|
|
|
|
|
|
2023-01-26 13:36:55 +02:00
|
|
|
export const SlackChanelTypesTranslateMap = new Map<SlackChanelType, string>([
|
|
|
|
|
[SlackChanelType.DIRECT, 'notification.slack-chanel-types.direct'],
|
|
|
|
|
[SlackChanelType.PUBLIC_CHANNEL, 'notification.slack-chanel-types.public-channel'],
|
|
|
|
|
[SlackChanelType.PRIVATE_CHANNEL, 'notification.slack-chanel-types.private-channel']
|
|
|
|
|
]);
|
|
|
|
|
|
2022-12-28 10:03:11 +02:00
|
|
|
export enum NotificationTargetConfigType {
|
2023-01-31 17:46:12 +02:00
|
|
|
ALL_USERS = 'ALL_USERS',
|
2023-03-17 16:35:34 +02:00
|
|
|
TENANT_ADMINISTRATORS = 'TENANT_ADMINISTRATORS',
|
2022-12-28 10:03:11 +02:00
|
|
|
CUSTOMER_USERS = 'CUSTOMER_USERS',
|
2023-03-17 16:35:34 +02:00
|
|
|
USER_LIST = 'USER_LIST',
|
|
|
|
|
ORIGINATOR_ENTITY_OWNER_USERS = 'ORIGINATOR_ENTITY_OWNER_USERS',
|
2023-03-22 18:22:13 +02:00
|
|
|
AFFECTED_USER = 'AFFECTED_USER'
|
2022-12-28 10:03:11 +02:00
|
|
|
}
|
2023-01-06 19:28:12 +02:00
|
|
|
|
2023-03-20 15:54:34 +02:00
|
|
|
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,
|
|
|
|
|
{
|
2023-03-21 17:56:12 +02:00
|
|
|
name: 'notification.target-type.users-entity-owner',
|
|
|
|
|
hint: 'notification.target-type.users-entity-owner-hint'
|
2023-03-20 15:54:34 +02:00
|
|
|
}
|
|
|
|
|
],
|
2023-03-22 18:22:13 +02:00
|
|
|
[NotificationTargetConfigType.AFFECTED_USER,
|
2023-03-20 15:54:34 +02:00
|
|
|
{
|
2023-03-21 17:56:12 +02:00
|
|
|
name: 'notification.target-type.affected-user',
|
|
|
|
|
hint: 'notification.target-type.affected-user-hint'
|
2023-03-20 15:54:34 +02:00
|
|
|
}
|
|
|
|
|
]
|
2023-01-06 19:28:12 +02:00
|
|
|
]);
|
2023-01-12 12:38:03 +02:00
|
|
|
|
2023-01-17 18:26:25 +02:00
|
|
|
export enum NotificationType {
|
2023-01-12 18:11:37 +02:00
|
|
|
GENERAL = 'GENERAL',
|
2023-01-31 17:46:12 +02:00
|
|
|
ALARM = 'ALARM',
|
|
|
|
|
DEVICE_INACTIVITY = 'DEVICE_INACTIVITY',
|
2023-02-01 20:00:47 +02:00
|
|
|
ENTITY_ACTION = 'ENTITY_ACTION',
|
2023-03-15 18:39:06 +02:00
|
|
|
ALARM_COMMENT = 'ALARM_COMMENT',
|
2023-03-17 18:53:03 +02:00
|
|
|
ALARM_ASSIGNMENT = 'ALARM_ASSIGNMENT',
|
2023-03-21 15:03:30 +02:00
|
|
|
RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT = 'RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT',
|
|
|
|
|
ENTITIES_LIMIT = 'ENTITIES_LIMIT'
|
2023-01-12 12:38:03 +02:00
|
|
|
}
|
2023-01-12 18:11:37 +02:00
|
|
|
|
2023-02-06 13:31:00 +02:00
|
|
|
export const NotificationTypeIcons = new Map<NotificationType, string | null>([
|
|
|
|
|
[NotificationType.ALARM, 'warning'],
|
|
|
|
|
[NotificationType.DEVICE_INACTIVITY, 'phonelink_off'],
|
|
|
|
|
[NotificationType.ENTITY_ACTION, 'devices'],
|
2023-03-15 18:39:06 +02:00
|
|
|
[NotificationType.ALARM_COMMENT, 'comment'],
|
|
|
|
|
[NotificationType.ALARM_ASSIGNMENT, 'assignment_turned_in'],
|
2023-03-21 15:03:30 +02:00
|
|
|
[NotificationType.RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT, 'settings_ethernet'],
|
|
|
|
|
[NotificationType.ENTITIES_LIMIT, 'data_thresholding'],
|
2023-02-06 13:31:00 +02:00
|
|
|
]);
|
|
|
|
|
|
2023-02-09 12:31:06 +02:00
|
|
|
export const AlarmSeverityNotificationColors = new Map<AlarmSeverity, string>(
|
|
|
|
|
[
|
|
|
|
|
[AlarmSeverity.CRITICAL, '#D12730'],
|
|
|
|
|
[AlarmSeverity.MAJOR, '#FEAC0C'],
|
|
|
|
|
[AlarmSeverity.MINOR, '#F2DA05'],
|
|
|
|
|
[AlarmSeverity.WARNING, '#F66716'],
|
|
|
|
|
[AlarmSeverity.INDETERMINATE, '#00000061']
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
|
2023-02-24 11:29:36 +02:00
|
|
|
export enum ActionButtonLinkType {
|
|
|
|
|
LINK = 'LINK',
|
|
|
|
|
DASHBOARD = 'DASHBOARD'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const ActionButtonLinkTypeTranslateMap = new Map<ActionButtonLinkType, string>([
|
|
|
|
|
[ActionButtonLinkType.LINK, 'notification.link-type.link'],
|
|
|
|
|
[ActionButtonLinkType.DASHBOARD, 'notification.link-type.dashboard']
|
|
|
|
|
]);
|
|
|
|
|
|
2023-01-12 18:11:37 +02:00
|
|
|
interface NotificationTemplateTypeTranslate {
|
|
|
|
|
name: string;
|
|
|
|
|
hint?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-17 18:26:25 +02:00
|
|
|
export const NotificationTemplateTypeTranslateMap = new Map<NotificationType, NotificationTemplateTypeTranslate>([
|
|
|
|
|
[NotificationType.GENERAL,
|
2023-01-12 18:11:37 +02:00
|
|
|
{
|
|
|
|
|
name: 'notification.template-type.general',
|
2023-01-31 17:46:12 +02:00
|
|
|
hint: 'notification.template-hint.general'
|
2023-01-12 18:11:37 +02:00
|
|
|
}
|
|
|
|
|
],
|
2023-01-17 18:26:25 +02:00
|
|
|
[NotificationType.ALARM,
|
2023-01-12 18:11:37 +02:00
|
|
|
{
|
|
|
|
|
name: 'notification.template-type.alarm',
|
2023-01-31 17:46:12 +02:00
|
|
|
hint: 'notification.template-hint.alarm'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
[NotificationType.DEVICE_INACTIVITY,
|
|
|
|
|
{
|
|
|
|
|
name: 'notification.template-type.device-inactivity',
|
|
|
|
|
hint: 'notification.template-hint.device-inactivity'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
[NotificationType.ENTITY_ACTION,
|
|
|
|
|
{
|
|
|
|
|
name: 'notification.template-type.entity-action',
|
|
|
|
|
hint: 'notification.template-hint.entity-action'
|
|
|
|
|
}
|
2023-02-01 20:00:47 +02:00
|
|
|
],
|
|
|
|
|
[NotificationType.ALARM_COMMENT,
|
|
|
|
|
{
|
|
|
|
|
name: 'notification.template-type.alarm-comment',
|
|
|
|
|
hint: 'notification.template-hint.alarm-comment'
|
|
|
|
|
}
|
2023-03-15 18:39:06 +02:00
|
|
|
],
|
|
|
|
|
[NotificationType.ALARM_ASSIGNMENT,
|
|
|
|
|
{
|
|
|
|
|
name: 'notification.template-type.alarm-assignment',
|
|
|
|
|
hint: 'notification.template-hint.alarm-assignment'
|
|
|
|
|
}
|
2023-03-17 18:53:03 +02:00
|
|
|
],
|
|
|
|
|
[NotificationType.RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT,
|
|
|
|
|
{
|
|
|
|
|
name: 'notification.template-type.rule-engine-lifecycle-event',
|
|
|
|
|
hint: 'notification.template-hint.rule-engine-lifecycle-event'
|
|
|
|
|
}
|
2023-03-21 15:03:30 +02:00
|
|
|
],
|
|
|
|
|
[NotificationType.ENTITIES_LIMIT,
|
|
|
|
|
{
|
|
|
|
|
name: 'notification.template-type.entities-limit',
|
|
|
|
|
hint: 'notification.template-hint.entities-limit'
|
|
|
|
|
}]
|
2023-01-12 18:11:37 +02:00
|
|
|
]);
|
2023-01-27 15:47:08 +02:00
|
|
|
|
|
|
|
|
export enum TriggerType {
|
|
|
|
|
ALARM = 'ALARM',
|
|
|
|
|
DEVICE_INACTIVITY = 'DEVICE_INACTIVITY',
|
2023-02-01 20:00:47 +02:00
|
|
|
ENTITY_ACTION = 'ENTITY_ACTION',
|
2023-03-15 18:39:06 +02:00
|
|
|
ALARM_COMMENT = 'ALARM_COMMENT',
|
2023-03-17 18:53:03 +02:00
|
|
|
ALARM_ASSIGNMENT = 'ALARM_ASSIGNMENT',
|
2023-03-21 15:03:30 +02:00
|
|
|
RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT = 'RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT',
|
|
|
|
|
ENTITIES_LIMIT = 'ENTITIES_LIMIT'
|
2023-01-27 15:47:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const TriggerTypeTranslationMap = new Map<TriggerType, string>([
|
|
|
|
|
[TriggerType.ALARM, 'notification.trigger.alarm'],
|
|
|
|
|
[TriggerType.DEVICE_INACTIVITY, 'notification.trigger.device-inactivity'],
|
2023-02-01 20:00:47 +02:00
|
|
|
[TriggerType.ENTITY_ACTION, 'notification.trigger.entity-action'],
|
2023-03-15 18:39:06 +02:00
|
|
|
[TriggerType.ALARM_COMMENT, 'notification.trigger.alarm-comment'],
|
|
|
|
|
[TriggerType.ALARM_ASSIGNMENT, 'notification.trigger.alarm-assignment'],
|
2023-03-17 18:53:03 +02:00
|
|
|
[TriggerType.RULE_ENGINE_COMPONENT_LIFECYCLE_EVENT, 'notification.trigger.rule-engine-lifecycle-event'],
|
2023-03-21 15:03:30 +02:00
|
|
|
[TriggerType.ENTITIES_LIMIT, 'notification.trigger.entities-limit'],
|
2023-01-27 15:47:08 +02:00
|
|
|
]);
|