2023-01-23 14:54:15 +02:00
|
|
|
<!--
|
|
|
|
|
|
|
|
|
|
Copyright © 2016-2022 The Thingsboard Authors
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
-->
|
2023-02-01 15:58:00 +02:00
|
|
|
<mat-toolbar color="primary">
|
|
|
|
|
<h2>{{ dialogTitle | translate }}</h2>
|
|
|
|
|
<span fxFlex></span>
|
|
|
|
|
<button mat-icon-button
|
|
|
|
|
(click)="cancel()"
|
|
|
|
|
type="button">
|
|
|
|
|
<mat-icon class="material-icons">close</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</mat-toolbar>
|
|
|
|
|
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async">
|
|
|
|
|
</mat-progress-bar>
|
|
|
|
|
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
|
|
|
|
|
<div mat-dialog-content ngStyle.xs="padding: 0;">
|
|
|
|
|
<mat-horizontal-stepper [linear]="true" labelPosition="end" #addNotificationRule [orientation]="(stepperOrientation | async)"
|
|
|
|
|
(selectionChange)="changeStep($event)">
|
|
|
|
|
<ng-template matStepperIcon="edit">
|
|
|
|
|
<mat-icon>check</mat-icon>
|
|
|
|
|
</ng-template>
|
|
|
|
|
<mat-step [stepControl]="ruleNotificationForm">
|
|
|
|
|
<ng-template matStepLabel>{{ 'notification.basic-settings' | translate }}</ng-template>
|
|
|
|
|
<form [formGroup]="ruleNotificationForm" style="padding-bottom: 16px;">
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>notification.rule-name</mat-label>
|
|
|
|
|
<input matInput formControlName="name" required>
|
|
|
|
|
<mat-error *ngIf="ruleNotificationForm.get('name').hasError('required')">
|
|
|
|
|
{{ 'notification.rule-name-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>notification.trigger.trigger</mat-label>
|
|
|
|
|
<mat-select formControlName="triggerType" required>
|
|
|
|
|
<mat-option *ngFor="let trigger of triggerTypes" [value]="trigger">
|
|
|
|
|
{{ triggerTypeTranslationMap.get(trigger) | translate }}
|
|
|
|
|
</mat-option>
|
|
|
|
|
</mat-select>
|
|
|
|
|
<mat-error *ngIf="ruleNotificationForm.get('triggerType').hasError('required')">
|
|
|
|
|
{{ 'notification.trigger.trigger-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<tb-template-autocomplete
|
|
|
|
|
required
|
|
|
|
|
formControlName="templateId"
|
|
|
|
|
[notificationTypes]="ruleNotificationForm.get('triggerType').value"
|
|
|
|
|
labelText="notification.template-name"
|
|
|
|
|
requiredText="notification.template-required">
|
|
|
|
|
</tb-template-autocomplete>
|
|
|
|
|
</form>
|
|
|
|
|
</mat-step>
|
|
|
|
|
<mat-step [stepControl]="alarmTemplateForm"
|
|
|
|
|
*ngIf="ruleNotificationForm.get('triggerType').value === triggerType.ALARM">
|
|
|
|
|
<ng-template matStepLabel>{{ 'notification.alarm-trigger-settings' | translate }}</ng-template>
|
|
|
|
|
<form [formGroup]="alarmTemplateForm">
|
2023-02-02 15:25:04 +02:00
|
|
|
<section formGroupName="triggerConfig">
|
|
|
|
|
<fieldset class="fields-group">
|
|
|
|
|
<legend translate>notification.filter</legend>
|
|
|
|
|
<tb-alarm-type-list
|
|
|
|
|
formControlName="alarmTypes">
|
|
|
|
|
</tb-alarm-type-list>
|
2023-01-27 15:47:08 +02:00
|
|
|
|
2023-02-02 15:25:04 +02:00
|
|
|
<tb-alarm-severities-list formControlName="alarmSeverities"
|
|
|
|
|
flotLabel="always"
|
|
|
|
|
required>
|
|
|
|
|
</tb-alarm-severities-list>
|
|
|
|
|
</fieldset>
|
2023-01-31 02:03:51 +02:00
|
|
|
|
2023-02-02 15:25:04 +02:00
|
|
|
<fieldset class="fields-group" formGroupName="clearRule">
|
|
|
|
|
<legend translate>notification.clear-rule</legend>
|
|
|
|
|
<mat-form-field fxFlex class="mat-block" floatLabel="always">
|
|
|
|
|
<mat-label translate>alarm.alarm-status-list</mat-label>
|
|
|
|
|
<mat-select formControlName="alarmStatus"
|
|
|
|
|
placeholder="{{ !alarmTemplateForm.get('triggerConfig.clearRule.alarmStatus').value ? ('alarm.any-status' | translate) : '' }}">
|
|
|
|
|
<mat-option [value]="null">{{ 'alarm.any-status' | translate }}</mat-option>
|
|
|
|
|
<mat-option *ngFor="let searchStatus of alarmSearchStatuses" [value]="searchStatus">
|
|
|
|
|
{{ alarmSearchStatusTranslationMap.get(searchStatus) | translate }}
|
|
|
|
|
</mat-option>
|
|
|
|
|
</mat-select>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</fieldset>
|
|
|
|
|
</section>
|
2023-01-31 02:03:51 +02:00
|
|
|
|
2023-02-02 15:25:04 +02:00
|
|
|
<fieldset class="fields-group" formGroupName="recipientsConfig">
|
2023-02-01 15:58:00 +02:00
|
|
|
<legend translate>notification.hierarchy-of-receiving</legend>
|
|
|
|
|
<tb-escalations-component formControlName="escalationTable"></tb-escalations-component>
|
|
|
|
|
</fieldset>
|
2023-02-02 15:25:04 +02:00
|
|
|
</form>
|
|
|
|
|
<form [formGroup]="ruleNotificationForm">
|
|
|
|
|
<section formGroupName="additionalConfig">
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>notification.description</mat-label>
|
|
|
|
|
<input matInput formControlName="description">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</section>
|
2023-02-01 15:58:00 +02:00
|
|
|
</form>
|
|
|
|
|
</mat-step>
|
2023-01-27 15:47:08 +02:00
|
|
|
|
2023-02-01 15:58:00 +02:00
|
|
|
<mat-step *ngIf="ruleNotificationForm.get('triggerType').value === triggerType.DEVICE_INACTIVITY"
|
|
|
|
|
[stepControl]="deviceInactivityTemplateForm">
|
|
|
|
|
<ng-template matStepLabel>{{ 'notification.device-inactivity-trigger-settings' | translate }}</ng-template>
|
|
|
|
|
<form [formGroup]="deviceInactivityTemplateForm">
|
2023-02-02 15:25:04 +02:00
|
|
|
<section formGroupName="triggerConfig">
|
|
|
|
|
<span translate>notification.filter-by</span>
|
|
|
|
|
<div fxFlex fxLayoutAlign="center center">
|
|
|
|
|
<mat-button-toggle-group class="tb-notification-unread-toggle-group"
|
|
|
|
|
style="width: 250px;"
|
|
|
|
|
formControlName="filterByDevice">
|
|
|
|
|
<mat-button-toggle fxFlex [value]=true>{{ 'notification.device' | translate }}</mat-button-toggle>
|
|
|
|
|
<mat-button-toggle fxFlex [value]=false>{{ 'notification.device-profile' | translate }}</mat-button-toggle>
|
|
|
|
|
</mat-button-toggle-group>
|
|
|
|
|
</div>
|
|
|
|
|
<ng-container *ngIf="deviceInactivityTemplateForm.get('triggerConfig.filterByDevice').value; else deviceProfile">
|
|
|
|
|
<tb-entity-list
|
|
|
|
|
formControlName="devices"
|
|
|
|
|
labelText="{{ 'notification.devices' | translate }}"
|
|
|
|
|
placeholderText="{{ 'notification.devices' | translate }}"
|
|
|
|
|
[entityType]="entityType.DEVICE">
|
|
|
|
|
</tb-entity-list>
|
|
|
|
|
<div class="tb-hint" translate>notification.device-list-rule-hint</div>
|
|
|
|
|
</ng-container>
|
|
|
|
|
<ng-template #deviceProfile>
|
|
|
|
|
<tb-entity-list
|
|
|
|
|
formControlName="deviceProfiles"
|
|
|
|
|
labelText="{{ 'notification.device-profiles' | translate }}"
|
|
|
|
|
placeholderText="{{ 'notification.device-profiles' | translate }}"
|
|
|
|
|
[entityType]="entityType.DEVICE_PROFILE">
|
|
|
|
|
</tb-entity-list>
|
|
|
|
|
<div class="tb-hint" translate>notification.device-profiles-list-rule-hint</div>
|
|
|
|
|
</ng-template>
|
|
|
|
|
</section>
|
|
|
|
|
<section formGroupName="recipientsConfig">
|
2023-01-31 02:03:51 +02:00
|
|
|
<tb-entity-list
|
|
|
|
|
required
|
2023-02-02 15:25:04 +02:00
|
|
|
formControlName="targets"
|
|
|
|
|
[entityType]="entityType.NOTIFICATION_TARGET"
|
|
|
|
|
placeholderText="{{ 'notification.target' | translate }}">
|
2023-01-31 02:03:51 +02:00
|
|
|
</tb-entity-list>
|
2023-02-02 15:25:04 +02:00
|
|
|
</section>
|
|
|
|
|
</form>
|
|
|
|
|
<form [formGroup]="ruleNotificationForm">
|
|
|
|
|
<section formGroupName="additionalConfig">
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>notification.description</mat-label>
|
|
|
|
|
<input matInput formControlName="description">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</section>
|
2023-02-01 15:58:00 +02:00
|
|
|
</form>
|
|
|
|
|
</mat-step>
|
2023-01-27 15:47:08 +02:00
|
|
|
|
2023-02-01 15:58:00 +02:00
|
|
|
<mat-step *ngIf="ruleNotificationForm.get('triggerType').value === triggerType.ENTITY_ACTION"
|
|
|
|
|
[stepControl]="entityActionTemplateForm">
|
|
|
|
|
<ng-template matStepLabel>{{ 'notification.entity-action-trigger-settings' | translate }}</ng-template>
|
|
|
|
|
<form [formGroup]="entityActionTemplateForm">
|
2023-02-02 15:25:04 +02:00
|
|
|
<fieldset class="fields-group" formGroupName="triggerConfig">
|
2023-02-01 15:58:00 +02:00
|
|
|
<legend translate>notification.filter</legend>
|
|
|
|
|
<tb-entity-type-select required
|
|
|
|
|
showLabel
|
|
|
|
|
[allowedEntityTypes]="entityTypes"
|
|
|
|
|
formControlName="entityType">
|
|
|
|
|
</tb-entity-type-select>
|
|
|
|
|
<section fxLayout="column" fxLayoutGap="8px">
|
|
|
|
|
<span fxFlex translate>notification.status</span>
|
|
|
|
|
<mat-slide-toggle formControlName="created">{{ 'notification.created' | translate }}</mat-slide-toggle>
|
|
|
|
|
<mat-slide-toggle formControlName="updated">{{ 'notification.updated' | translate }}</mat-slide-toggle>
|
|
|
|
|
<mat-slide-toggle formControlName="deleted">{{ 'notification.deleted' | translate }}</mat-slide-toggle>
|
|
|
|
|
</section>
|
|
|
|
|
</fieldset>
|
2023-02-02 15:25:04 +02:00
|
|
|
<section formGroupName="recipientsConfig">
|
|
|
|
|
<tb-entity-list
|
|
|
|
|
required
|
|
|
|
|
formControlName="targets"
|
|
|
|
|
[entityType]="entityType.NOTIFICATION_TARGET"
|
|
|
|
|
placeholderText="notification.target">
|
|
|
|
|
</tb-entity-list>
|
|
|
|
|
</section>
|
|
|
|
|
</form>
|
|
|
|
|
<form [formGroup]="ruleNotificationForm">
|
|
|
|
|
<section formGroupName="additionalConfig">
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>notification.description</mat-label>
|
|
|
|
|
<input matInput formControlName="description">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</section>
|
2023-02-01 15:58:00 +02:00
|
|
|
</form>
|
|
|
|
|
</mat-step>
|
|
|
|
|
</mat-horizontal-stepper>
|
|
|
|
|
</div>
|
|
|
|
|
<mat-divider></mat-divider>
|
|
|
|
|
<div mat-dialog-actions fxLayout="row">
|
|
|
|
|
<button mat-stroked-button *ngIf="selectedIndex > 0"
|
|
|
|
|
(click)="backStep()">{{ 'action.back' | translate }}</button>
|
|
|
|
|
<span fxFlex></span>
|
|
|
|
|
<button mat-raised-button
|
|
|
|
|
color="primary"
|
|
|
|
|
(click)="nextStep()">{{ nextStepLabel() | translate }}</button>
|
|
|
|
|
</div>
|