2019-12-27 16:35:11 +02:00
|
|
|
<!--
|
|
|
|
|
|
2023-01-31 10:43:56 +02:00
|
|
|
Copyright © 2016-2023 The Thingsboard Authors
|
2019-12-27 16:35: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.
|
|
|
|
|
|
|
|
|
|
-->
|
|
|
|
|
<section fxLayout="column" class="tb-kv-map" [formGroup]="kvListFormGroup">
|
|
|
|
|
<label translate class="tb-title no-padding">{{ titleText }}</label>
|
|
|
|
|
<div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="8px" style="max-height: 40px;"
|
|
|
|
|
formArrayName="keyVals"
|
|
|
|
|
*ngFor="let keyValControl of keyValsFormArray().controls; let $index = index">
|
2023-02-23 19:01:53 +02:00
|
|
|
<mat-form-field fxFlex class="mat-block"
|
2019-12-27 16:35:11 +02:00
|
|
|
style="max-height: 40px;">
|
|
|
|
|
<input [formControl]="keyValControl.get('key')" matInput required
|
|
|
|
|
placeholder="{{ (keyPlaceholderText ? keyPlaceholderText : 'key-val.key') | translate }}"/>
|
|
|
|
|
</mat-form-field>
|
2023-02-23 19:01:53 +02:00
|
|
|
<mat-form-field fxFlex class="mat-block"
|
2019-12-27 16:35:11 +02:00
|
|
|
style="max-height: 40px;">
|
|
|
|
|
<input [formControl]="keyValControl.get('value')" matInput required
|
|
|
|
|
placeholder="{{ (valuePlaceholderText ? valuePlaceholderText : 'key-val.value') | translate }}"/>
|
|
|
|
|
</mat-form-field>
|
2023-02-17 19:24:01 +02:00
|
|
|
<button mat-icon-button color="primary"
|
2019-12-27 16:35:11 +02:00
|
|
|
[fxShow]="!disabled"
|
|
|
|
|
type="button"
|
|
|
|
|
(click)="removeKeyVal($index)"
|
|
|
|
|
[disabled]="isLoading$ | async"
|
|
|
|
|
matTooltip="{{ 'key-val.remove-entry' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
<mat-icon>close</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<span [fxShow]="!keyValsFormArray().length"
|
|
|
|
|
fxLayoutAlign="center center" [ngClass]="{'disabled': disabled}"
|
|
|
|
|
class="no-data-found" translate>{{noDataText ? noDataText : 'key-val.no-data'}}</span>
|
|
|
|
|
<div style="margin-top: 8px;">
|
|
|
|
|
<button mat-button mat-raised-button color="primary"
|
|
|
|
|
[fxShow]="!disabled"
|
|
|
|
|
[disabled]="isLoading$ | async"
|
|
|
|
|
(click)="addKeyVal()"
|
|
|
|
|
type="button"
|
|
|
|
|
matTooltip="{{ 'key-val.add-entry' | translate }}"
|
|
|
|
|
matTooltipPosition="above">
|
|
|
|
|
{{ 'action.add' | translate }}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|