133 lines
5.9 KiB
HTML
133 lines
5.9 KiB
HTML
|
|
<!--
|
||
|
|
|
||
|
|
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.
|
||
|
|
|
||
|
|
-->
|
||
|
|
<form [formGroup]="ruleNotificationForm" style="min-width: 560px">
|
||
|
|
<mat-toolbar color="primary">
|
||
|
|
<h2>{{ (isAdd ? 'notification.add-notification-target' : 'notification.edit-notification-target') | 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>
|
||
|
|
<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>
|
||
|
|
<tb-template-autocomplete
|
||
|
|
required
|
||
|
|
formControlName="templateId"
|
||
|
|
labelText="notification.template-name"
|
||
|
|
placeholderText="notification.template-name"
|
||
|
|
requiredText="notification.template-required">
|
||
|
|
</tb-template-autocomplete>
|
||
|
|
<section formGroupName="configuration">
|
||
|
|
|
||
|
|
<fieldset class="fields-group">
|
||
|
|
<span class="fields-group-title" translate>notification.hierarchy-of-receiving</span>
|
||
|
|
<div class="rule-header">
|
||
|
|
<div fxLayoutAlign="row">
|
||
|
|
<span fxFlex="30" style="padding-left: 12px" translate>notification.rule</span>
|
||
|
|
<span fxFlex translate>notification.recipient</span>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="rules" style="padding: 16px 0">
|
||
|
|
<div class="rule" fxFlex fxLayout="row" fxLayoutAlign="start center">
|
||
|
|
<div fxLayoutAlign="row" fxLayoutAlign="start center" style="display: inline-block; width: 100%; min-height: 64px; height: 100%; background: rgba(0,0,0, 0.04); border-radius: 8px;">
|
||
|
|
<div fxFlex="30" *ngIf="false">
|
||
|
|
<span style="padding-left: 12px" >First recipient</span>
|
||
|
|
<span style="padding-left: 12px" *ngIf="true">After</span>
|
||
|
|
</div>
|
||
|
|
<div fxFlex="30" *ngIf="true">
|
||
|
|
<span style="padding-left: 12px" *ngIf="true">After</span>
|
||
|
|
<tb-timeinterval
|
||
|
|
formControlName="interval"
|
||
|
|
[hideFlag]="true"
|
||
|
|
predefinedName="aggregation.group-interval">
|
||
|
|
</tb-timeinterval>
|
||
|
|
</div>
|
||
|
|
<tb-entity-list
|
||
|
|
style="padding: 0 12px"
|
||
|
|
fxFlex
|
||
|
|
formControlName="ids"
|
||
|
|
[required]="true"
|
||
|
|
[entityType]="entityType.NOTIFICATION_TEMPLATE">
|
||
|
|
</tb-entity-list>
|
||
|
|
</div>
|
||
|
|
<button mat-icon-button>
|
||
|
|
<mat-icon>close</mat-icon>
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<button mat-stroked-button color="primary">
|
||
|
|
<div fxLayout="row" fxLayoutAlign="start center">
|
||
|
|
<mat-icon>add</mat-icon>{{ 'notification.add-rule' | translate }}
|
||
|
|
</div>
|
||
|
|
</button>
|
||
|
|
</fieldset>
|
||
|
|
<!-- <mat-form-field class="mat-block">-->
|
||
|
|
<!-- <mat-label translate>notification.target-type.type</mat-label>-->
|
||
|
|
<!-- <mat-select formControlName="type">-->
|
||
|
|
<!-- <mat-option *ngFor="let type of notificationTargetConfigTypes" [value]="type">-->
|
||
|
|
<!-- {{ notificationTargetConfigTypeTranslateMap.get(type) | translate }}-->
|
||
|
|
<!-- </mat-option>-->
|
||
|
|
<!-- </mat-select>-->
|
||
|
|
<!-- </mat-form-field>-->
|
||
|
|
<!-- <tb-entity-list-->
|
||
|
|
<!-- required-->
|
||
|
|
<!-- formControlName="usersIds"-->
|
||
|
|
<!-- [entityType]="entityType.USER"-->
|
||
|
|
<!-- *ngIf="targetNotificationForm.get('configuration.type').value === notificationTargetConfigType.USER_LIST">-->
|
||
|
|
<!-- </tb-entity-list>-->
|
||
|
|
<!-- <section-->
|
||
|
|
<!-- *ngIf="targetNotificationForm.get('configuration.type').value === notificationTargetConfigType.CUSTOMER_USERS">-->
|
||
|
|
<!-- <mat-slide-toggle formControlName="getCustomerIdFromOriginatorEntity">-->
|
||
|
|
<!-- {{ 'notification.get-customer-id-from-originator' | translate }}-->
|
||
|
|
<!-- </mat-slide-toggle>-->
|
||
|
|
<!-- <tb-entity-autocomplete-->
|
||
|
|
<!-- required-->
|
||
|
|
<!-- formControlName="customerId"-->
|
||
|
|
<!-- [entityType]="entityType.CUSTOMER"-->
|
||
|
|
<!-- *ngIf="!targetNotificationForm.get('configuration.getCustomerIdFromOriginatorEntity').value">-->
|
||
|
|
<!-- </tb-entity-autocomplete>-->
|
||
|
|
<!-- </section>-->
|
||
|
|
<mat-form-field class="mat-block">
|
||
|
|
<mat-label translate>notification.description</mat-label>
|
||
|
|
<input matInput formControlName="description">
|
||
|
|
</mat-form-field>
|
||
|
|
</section>
|
||
|
|
</div>
|
||
|
|
<mat-divider></mat-divider>
|
||
|
|
<div mat-dialog-actions fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="end">
|
||
|
|
<button mat-button
|
||
|
|
[disabled]="(isLoading$ | async)"
|
||
|
|
(click)="cancel()">{{ 'action.cancel' | translate }}</button>
|
||
|
|
<button mat-raised-button
|
||
|
|
[disabled]="(isLoading$ | async) || ruleNotificationForm.invalid || !ruleNotificationForm.dirty"
|
||
|
|
color="primary"
|
||
|
|
(click)="save()">{{ (isAdd ? 'action.add' : 'action.save') | translate }}</button>
|
||
|
|
</div>
|
||
|
|
</form>
|