thingsboard/ui-ngx/src/app/modules/home/components/rule-node/action/create-relation-config.component.html

101 lines
4.8 KiB
HTML
Raw Normal View History

2025-01-07 19:07:33 +02:00
<!--
2025-02-25 09:39:16 +02:00
Copyright © 2016-2025 The Thingsboard Authors
2025-01-07 19:07:33 +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.
-->
<section [formGroup]="createRelationConfigForm" class="tb-form-panel no-padding no-border">
<div class="tb-form-panel stroked no-padding-bottom">
<div class="tb-form-panel-title" translate>rule-node-config.relation-parameters</div>
2025-01-07 19:07:33 +02:00
<div class="flex flex-col">
<mat-form-field class="mat-block" hideRequiredMarker>
<mat-label translate>relation.direction</mat-label>
<mat-select required matInput formControlName="direction">
<mat-option *ngFor="let type of directionTypes" [value]="type">
{{ directionTypeTranslations.get(type) | translate }}
</mat-option>
</mat-select>
</mat-form-field>
<tb-relation-type-autocomplete
required
formControlName="relationType">
</tb-relation-type-autocomplete>
</div>
</div>
<div class="tb-form-panel stroked no-padding-bottom">
<div class="tb-form-panel-title" translate>rule-node-config.target-entity</div>
2025-01-07 19:07:33 +02:00
<div class="flex flex-row gap-4">
<tb-entity-type-select
class="flex-1"
showLabel
required
[allowedEntityTypes]="allowedEntityTypes"
formControlName="entityType">
</tb-entity-type-select>
<mat-form-field *ngIf="createRelationConfigForm.get('entityType').value &&
createRelationConfigForm.get('entityType').value !== entityType.TENANT"
class="mat-block flex-1">
<mat-label>{{ entityTypeNamePatternTranslation.get(createRelationConfigForm.get('entityType').value) | translate }}</mat-label>
<input required matInput formControlName="entityNamePattern">
</mat-form-field>
<mat-form-field *ngIf="createRelationConfigForm.get('entityType').value === entityType.DEVICE ||
createRelationConfigForm.get('entityType').value === entityType.ASSET"
class="mat-block flex-1">
<mat-label translate>rule-node-config.profile-name</mat-label>
2025-01-07 19:07:33 +02:00
<input matInput formControlName="entityTypePattern">
</mat-form-field>
</div>
<tb-example-hint [hintText]="'rule-node-config.kv-map-pattern-hint'"
2025-01-07 19:07:33 +02:00
*ngIf="createRelationConfigForm.get('entityType').value === entityType.CUSTOMER ||
createRelationConfigForm.get('entityType').value === entityType.DEVICE ||
createRelationConfigForm.get('entityType').value === entityType.ASSET"></tb-example-hint>
<div tb-hint-tooltip-icon="{{ 'rule-node-config.create-entity-if-not-exists-hint' | translate }}"
2025-01-07 19:07:33 +02:00
*ngIf="createRelationConfigForm.get('entityType').value === entityType.CUSTOMER ||
createRelationConfigForm.get('entityType').value === entityType.DEVICE ||
createRelationConfigForm.get('entityType').value === entityType.ASSET"
style="margin-bottom: 18px"
class="tb-form-row no-border no-padding">
<mat-slide-toggle class="mat-slide" formControlName="createEntityIfNotExists">
{{ 'rule-node-config.create-entity-if-not-exists' | translate }}
2025-01-07 19:07:33 +02:00
</mat-slide-toggle>
</div>
</div>
<section class="tb-form-panel stroked no-padding">
<mat-expansion-panel class="tb-settings">
<mat-expansion-panel-header style="padding: 16px">
<mat-panel-title translate>rule-node-config.advanced-settings</mat-panel-title>
2025-01-07 19:07:33 +02:00
</mat-expansion-panel-header>
<div class="tb-form-panel no-border no-padding-top">
<div tb-hint-tooltip-icon="{{ 'rule-node-config.remove-current-relations-hint' | translate }}"
2025-01-07 19:07:33 +02:00
class="tb-form-row no-border no-padding">
<mat-slide-toggle class="mat-slide" formControlName="removeCurrentRelations">
{{ 'rule-node-config.remove-current-relations' | translate }}
2025-01-07 19:07:33 +02:00
</mat-slide-toggle>
</div>
<div tb-hint-tooltip-icon="{{ 'rule-node-config.change-originator-to-related-entity-hint' | translate }}"
2025-01-07 19:07:33 +02:00
class="tb-form-row no-border no-padding">
<mat-slide-toggle class="mat-slide" formControlName="changeOriginatorToRelatedEntity">
{{ 'rule-node-config.change-originator-to-related-entity' | translate }}
2025-01-07 19:07:33 +02:00
</mat-slide-toggle>
</div>
</div>
</mat-expansion-panel>
</section>
</section>