From 9fd578cb911a724f35c520798f2ab02f90f0df76 Mon Sep 17 00:00:00 2001 From: Andrii Shvaika Date: Thu, 23 Mar 2023 17:36:40 +0200 Subject: [PATCH] Notification Templates help --- .../assets/help/en_US/notification/alarm.md | 64 ++++++++++++++++- .../en_US/notification/alarm_assignment.md | 68 ++++++++++++++++++- .../help/en_US/notification/alarm_comment.md | 67 +++++++++++++++++- .../en_US/notification/device_inactivity.md | 65 +++++++++++++++++- .../help/en_US/notification/entities_limit.md | 46 ++++++++++++- .../help/en_US/notification/entity_action.md | 64 ++++++++++++++++- .../assets/help/en_US/notification/general.md | 42 +++++++++++- .../rule_engine_lifecycle_event.md | 50 +++++++++++++- 8 files changed, 458 insertions(+), 8 deletions(-) diff --git a/ui-ngx/src/assets/help/en_US/notification/alarm.md b/ui-ngx/src/assets/help/en_US/notification/alarm.md index 3699ed4f77..73a9cfdbe9 100644 --- a/ui-ngx/src/assets/help/en_US/notification/alarm.md +++ b/ui-ngx/src/assets/help/en_US/notification/alarm.md @@ -1 +1,63 @@ -Available params: ${alarmType}, ${alarmSeverity}, ${alarmStatus}, ${alarmOriginatorEntityType}, ${alarmOriginatorId}, ${alarmId}, ${alarmAction} +#### Alarm notification templatization + +
+
+ +Notification subject and message fields support templatization. The list of available templatization parameters depends on the template type. +See the available types and parameters below: + +Available template parameters: + + * *recipientEmail* - email of the recipient; + * *recipientFirstName* - first name of the recipient; + * *recipientLastName* - last name of the recipient; + * *alarmType* - alarm type; + * *action* - one of: 'created', 'severity changed', 'acknowledged', 'cleared', 'deleted'; + * *alarmId* - the alarm id as uuid string; + * *alarmSeverity* - alarm severity (lower case); + * *alarmStatus* - the alarm status; + * *alarmOriginatorEntityType* - the entity type of the alarm originator, e.g. 'Device'; + * *alarmOriginatorName* - the name of the alarm originator, e.g. 'Sensor T1'; + * *alarmOriginatorId* - the alarm originator entity id as uuid string; + +Parameter names must be wrapped using `${...}`. For example: `${action}`. +You may also modify the value of the parameter with one of the sufixes: + + * `upperCase`, for example - `${recipientFirstName:upperCase}` + * `lowerCase`, for example - `${recipientFirstName:lowerCase}` + * `capitalize`, for example - `${recipientFirstName:capitalize}` + +
+ +##### Examples + + * Let's assume the notification about new alarm with type 'High Temperature' for device 'Sensor A'. The following template: + +```text +Alarm '${alarmType}' - ${action:upperCase} +{:copy-code} +``` + +will be transformed to: + +```text +Alarm 'High Temperature' - CREATED +{:copy-code} +``` + +The following template: + +```text +${alarmOriginatorEntityType:capitalize} '${alarmOriginatorName}' +{:copy-code} +``` + +will be transformed to: + +```text +DEVICE - Sensor A +{:copy-code} +``` + +
+
diff --git a/ui-ngx/src/assets/help/en_US/notification/alarm_assignment.md b/ui-ngx/src/assets/help/en_US/notification/alarm_assignment.md index e012ab5cfb..f8ca57fe08 100644 --- a/ui-ngx/src/assets/help/en_US/notification/alarm_assignment.md +++ b/ui-ngx/src/assets/help/en_US/notification/alarm_assignment.md @@ -1 +1,67 @@ -Available params: ${assigneeFirstName}, ${assigneeLastName}, ${assigneeEmail}, ${assigneeFirstName}, ${userName}, ${alarmId}, ${alarmType}, ${alarmSeverity}, ${alarmStatus}, ${alarmOriginatorEntityType}, ${alarmOriginatorId}, ${alarmId}, ${alarmAction} +#### Alarm assignment notification templatization + +
+
+ +Notification subject and message fields support templatization. The list of available templatization parameters depends on the template type. +See the available types and parameters below: + +Available template parameters: + + * *recipientEmail* - email of the recipient; + * *recipientFirstName* - first name of the recipient; + * *recipientLastName* - last name of the recipient; + * *alarmType* - alarm type; + * *alarmId* - the alarm id as uuid string; + * *alarmSeverity* - alarm severity (lower case); + * *alarmStatus* - the alarm status; + * *alarmOriginatorEntityType* - the entity type of the alarm originator, e.g. 'Device'; + * *alarmOriginatorName* - the name of the alarm originator, e.g. 'Sensor T1'; + * *alarmOriginatorId* - the alarm originator entity id as uuid string; + * *assigneeEmail* - email of the assignee; + * *assigneeFirstName* - first name of the assignee; + * *assigneeLastName* - last name of the assignee; + * *assigneeId* - the id of the assignee as uuid string; + * *action* - one of: 'assigned', 'unassigned'; + +Parameter names must be wrapped using `${...}`. For example: `${action}`. +You may also modify the value of the parameter with one of the sufixes: + + * `upperCase`, for example - `${recipientFirstName:upperCase}` + * `lowerCase`, for example - `${recipientFirstName:lowerCase}` + * `capitalize`, for example - `${recipientFirstName:capitalize}` + +
+ +##### Examples + + * Let's assume the notification about alarm with type 'High Temperature' for device 'Sensor A' was assigned to user 'John Doe'. The following template: + +```text +Alarm '${alarmType}' - ${action:upperCase} +{:copy-code} +``` + +will be transformed to: + +```text +Alarm 'High Temperature' - ASSIGNED +{:copy-code} +``` + +The following template: + +```text +Alarm '${alarmType}' (${alarmSeverity:capitalize}) was assigned to user +{:copy-code} +``` + +will be transformed to: + +```text +Alarm 'High Temperature' (Critical) was assigned to user +{:copy-code} +``` + +
+
diff --git a/ui-ngx/src/assets/help/en_US/notification/alarm_comment.md b/ui-ngx/src/assets/help/en_US/notification/alarm_comment.md index 0140f407f6..2f9783478d 100644 --- a/ui-ngx/src/assets/help/en_US/notification/alarm_comment.md +++ b/ui-ngx/src/assets/help/en_US/notification/alarm_comment.md @@ -1 +1,66 @@ -Available params: ${comment}, ${alarmType}, ${alarmId}, ${alarmType}, ${alarmSeverity}, ${alarmStatus}, ${alarmOriginatorEntityType}, ${alarmOriginatorId}, ${alarmId}, ${alarmAction} +#### Alarm comment notification templatization + +
+
+ +Notification subject and message fields support templatization. The list of available templatization parameters depends on the template type. +See the available types and parameters below: + +Available template parameters: + + * *recipientEmail* - email of the recipient; + * *recipientFirstName* - first name of the recipient; + * *recipientLastName* - last name of the recipient; + * *alarmType* - alarm type; + * *alarmId* - the alarm id as uuid string; + * *alarmSeverity* - alarm severity (lower case); + * *alarmStatus* - the alarm status; + * *alarmOriginatorEntityType* - the entity type of the alarm originator, e.g. 'Device'; + * *alarmOriginatorName* - the name of the alarm originator, e.g. 'Sensor T1'; + * *alarmOriginatorId* - the alarm originator entity id as uuid string; + * *comment* - text of the comment; + * *userName* - name of the user who made the comment; + * *action* - one of: 'added', 'updated'; + +Parameter names must be wrapped using `${...}`. For example: `${action}`. +You may also modify the value of the parameter with one of the sufixes: + + * `upperCase`, for example - `${recipientFirstName:upperCase}` + * `lowerCase`, for example - `${recipientFirstName:lowerCase}` + * `capitalize`, for example - `${recipientFirstName:capitalize}` + +
+ +##### Examples + + * Let's assume the notification about alarm with type 'High Temperature' for device 'Sensor A' was assigned to user 'John Doe'. + The following template: + +```text +Alarm '${alarmType}' - comment ${action} +{:copy-code} +``` + +will be transformed to: + +```text +Alarm 'High Temperature' - comment added +{:copy-code} +``` + +The following template: + +```text +Alarm '${alarmType}' (${alarmSeverity:capitalize}) was commented +{:copy-code} +``` + +will be transformed to: + +```text +Alarm 'High Temperature' (Critical) was commented +{:copy-code} +``` + +
+
diff --git a/ui-ngx/src/assets/help/en_US/notification/device_inactivity.md b/ui-ngx/src/assets/help/en_US/notification/device_inactivity.md index 6b7ea7a077..5a616e7223 100644 --- a/ui-ngx/src/assets/help/en_US/notification/device_inactivity.md +++ b/ui-ngx/src/assets/help/en_US/notification/device_inactivity.md @@ -1 +1,64 @@ -Available params: ${deviceName}, ${deviceLabel}, ${deviceType}, ${deviceId} +#### Device activity notification templatization + +
+
+ +Notification subject and message fields support templatization. The list of available templatization parameters depends on the template type. +See the available types and parameters below: + +Available template parameters: + + * *recipientEmail* - email of the recipient; + * *recipientFirstName* - first name of the recipient; + * *recipientLastName* - last name of the recipient; + * *deviceId* - the device id as uuid string; + * *deviceName* - the device name; + * *deviceLabel* - the device label; + * *deviceType* - the device type; + * *actionType* - one of: 'inactive', 'active'; + +Parameter names must be wrapped using `${...}`. For example: `${recipientFirstName}`. +You may also modify the value of the parameter with one of the sufixes: + + * `upperCase`, for example - `${recipientFirstName:upperCase}` + * `lowerCase`, for example - `${recipientFirstName:lowerCase}` + * `capitalize`, for example - `${recipientFirstName:capitalize}` + +
+ +##### Examples + +Let's assume the notification about inactive thermometer device 'Sensor T1'. +The following template: + +Template message: `` + +```text +Device '${deviceName}' inactive +{:copy-code} +``` + +will be transformed to: + +```text +Device 'Sensor T1' inactive +{:copy-code} +``` + + +
+The following template: + +```text +${deviceType:capitalize} '${deviceName}' became inactive +{:copy-code} +``` + +will be transformed to: + +```text +Thermometer 'Sensor T1' became inactive +{:copy-code} +``` +
+
diff --git a/ui-ngx/src/assets/help/en_US/notification/entities_limit.md b/ui-ngx/src/assets/help/en_US/notification/entities_limit.md index 7614ef8cc7..f7e6ba2b41 100644 --- a/ui-ngx/src/assets/help/en_US/notification/entities_limit.md +++ b/ui-ngx/src/assets/help/en_US/notification/entities_limit.md @@ -1 +1,45 @@ -Available params: ${entityType}, ${currentCount}, ${limit} +#### Entity count limit notification templatization + +
+
+ +Notification subject and message fields support templatization. The list of available templatization parameters depends on the template type. +See the available types and parameters below: + +Available template parameters: + + * *recipientEmail* - email of the recipient; + * *recipientFirstName* - first name of the recipient; + * *recipientLastName* - last name of the recipient; + * *entityType* - one of: 'Device', 'Asset', 'User', etc.; + * *currentCount* - the current count of entities; + * *limit* - the limit on number of entities; + * *percents* - the percent from the notification rule configuration; + +Parameter names must be wrapped using `${...}`. For example: `${recipientFirstName}`. +You may also modify the value of the parameter with one of the sufixes: + + * `upperCase`, for example - `${recipientFirstName:upperCase}` + * `lowerCase`, for example - `${recipientFirstName:lowerCase}` + * `capitalize`, for example - `${recipientFirstName:capitalize}` + +
+ +##### Examples + +Let's assume the tenant created 400 devices with the max allowed number is 500 and rule threshold 0.8 (80%). The following template: + +```text +${entityType:capitalize}s usage: ${currentCount}/${limit} (${percents}%) +{:copy-code} +``` + +will be transformed to: + +```text +Devices usage: 400/500 (80%) +{:copy-code} +``` + +
+
diff --git a/ui-ngx/src/assets/help/en_US/notification/entity_action.md b/ui-ngx/src/assets/help/en_US/notification/entity_action.md index c3a9f390e4..ca1ed43e20 100644 --- a/ui-ngx/src/assets/help/en_US/notification/entity_action.md +++ b/ui-ngx/src/assets/help/en_US/notification/entity_action.md @@ -1 +1,63 @@ -Available params: ${actionType}, ${entityType}, ${entityName}, ${entityId}, ${originatorUserName}, ${originatorUserId} +#### Entity action notification templatization + +
+
+ +Notification subject and message fields support templatization. The list of available templatization parameters depends on the template type. +See the available types and parameters below: + +Available template parameters: + + * *recipientEmail* - email of the recipient; + * *recipientFirstName* - first name of the recipient; + * *recipientLastName* - last name of the recipient; + * *entityType* - the entity type, e.g. 'Device'; + * *entityId* - the entity id as uuid string; + * *entityName* - the name of the entity; + * *actionType* - one of: 'added', 'updated', 'deleted'; + * *originatorUserId* - the user who made the action; + * *originatorUserName* - the user who made the action; // WHY no EMAIL, first, last, entityLabel (if applicable) + +Parameter names must be wrapped using `${...}`. For example: `${recipientFirstName}`. +You may also modify the value of the parameter with one of the sufixes: + + * `upperCase`, for example - `${recipientFirstName:upperCase}` + * `lowerCase`, for example - `${recipientFirstName:lowerCase}` + * `capitalize`, for example - `${recipientFirstName:capitalize}` + +
+ +##### Examples + +Let's assume the notification about device 'T1' was added by user 'john.doe@gmail.com'. +The following template: + +```text +${entityType:capitalize} was ${actionType}! +{:copy-code} +``` + +will be transformed to: + +```text +Device was added! +{:copy-code} +``` + +
+The following template: + +```text +${entityType} '${entityName}' was ${actionType} by user '${originatorUserName}'! +{:copy-code} +``` + +will be transformed to: + +```text +Device 'T1' was added by user 'john.doe@gmail.com'! +{:copy-code} +``` + +
+
diff --git a/ui-ngx/src/assets/help/en_US/notification/general.md b/ui-ngx/src/assets/help/en_US/notification/general.md index 4de4b1597f..edb7b9cf70 100644 --- a/ui-ngx/src/assets/help/en_US/notification/general.md +++ b/ui-ngx/src/assets/help/en_US/notification/general.md @@ -1 +1,41 @@ -Available params: ${recipientEmail}, ${recipientFirstName}, ${recipientLastName} +#### General notification templatization + +
+
+ +Notification subject and message fields support templatization. The list of available templatization parameters depends on the template type. +See the available types and parameters below: + +Available template parameters: + + * *recipientEmail* - email of the recipient; + * *recipientFirstName* - first name of the recipient; + * *recipientLastName* - last name of the recipient; + +Parameter names must be wrapped using `${...}`. For example: `${recipientFirstName}`. +You may also modify the value of the parameter with one of the sufixes: + + * `upperCase`, for example - `${recipientFirstName:upperCase}` + * `lowerCase`, for example - `${recipientFirstName:lowerCase}` + * `capitalize`, for example - `${recipientFirstName:capitalize}` + +
+ +##### Examples + +Let's assume the notification recipient user `John Doe`. The following template: + +```text +Hi, ${recipientFirstName}! +{:copy-code} +``` + +will be transformed to: + +```text +Hi, John! +{:copy-code} +``` + +
+
diff --git a/ui-ngx/src/assets/help/en_US/notification/rule_engine_lifecycle_event.md b/ui-ngx/src/assets/help/en_US/notification/rule_engine_lifecycle_event.md index 9c18926e41..9d8dcbf72c 100644 --- a/ui-ngx/src/assets/help/en_US/notification/rule_engine_lifecycle_event.md +++ b/ui-ngx/src/assets/help/en_US/notification/rule_engine_lifecycle_event.md @@ -1 +1,49 @@ -Available params: ${ruleChainName}, ${componentName}, ${eventType}, ${error}, ${ruleChainId}, ${componentId} +#### Rule engine lifecycle notification templatization + +
+
+ +Notification subject and message fields support templatization. The list of available templatization parameters depends on the template type. +See the available types and parameters below: + +Available template parameters: + + * *recipientEmail* - email of the recipient; + * *recipientFirstName* - first name of the recipient; + * *recipientLastName* - last name of the recipient; + * *componentType* - one of: 'rule chain', 'rule node'; + * *componentId* - the component id as uuid string; + * *componentName* - the rule chain or rule node name; + * *ruleChainId* - the rule chain id as uuid string; + * *ruleChainName* - the rule chain name; + * *eventType* - one of: 'started', 'updated', 'stopped'; + * *action* - one of: 'start', 'update', 'stop'; + * *error* - the error text; + +Parameter names must be wrapped using `${...}`. For example: `${recipientFirstName}`. +You may also modify the value of the parameter with one of the sufixes: + + * `upperCase`, for example - `${recipientFirstName:upperCase}` + * `lowerCase`, for example - `${recipientFirstName:lowerCase}` + * `capitalize`, for example - `${recipientFirstName:capitalize}` + +
+ +##### Examples + +Let's assume the notification about misconfigured Kafka rule node. The following template: + +```text +Rule node '${componentName}' - ${action} failure:
${error} +{:copy-code} +``` + +will be transformed to: + +```text +Rule node 'Export to Kafka' - start failure:
Connection refused! +{:copy-code} +``` + +
+