2020-09-03 14:14:46 +03:00
|
|
|
<!--
|
|
|
|
|
|
2021-01-11 13:42:16 +02:00
|
|
|
Copyright © 2016-2021 The Thingsboard Authors
|
2020-09-03 14:14:46 +03: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.
|
|
|
|
|
|
|
|
|
|
-->
|
|
|
|
|
<mat-form-field [formGroup]="selectDeviceProfileFormGroup" class="mat-block">
|
|
|
|
|
<input matInput type="text" placeholder="{{ 'device-profile.device-profile' | translate }}"
|
|
|
|
|
#deviceProfileInput
|
|
|
|
|
formControlName="deviceProfile"
|
2020-09-03 17:43:53 +03:00
|
|
|
(focusin)="onFocus()"
|
2020-09-03 14:14:46 +03:00
|
|
|
[required]="required"
|
|
|
|
|
(keydown)="deviceProfileEnter($event)"
|
|
|
|
|
(keypress)="deviceProfileEnter($event)"
|
|
|
|
|
[matAutocomplete]="deviceProfileAutocomplete">
|
|
|
|
|
<button *ngIf="selectDeviceProfileFormGroup.get('deviceProfile').value && !disabled"
|
|
|
|
|
type="button"
|
|
|
|
|
matSuffix mat-button mat-icon-button aria-label="Clear"
|
|
|
|
|
(click)="clear()">
|
|
|
|
|
<mat-icon class="material-icons">close</mat-icon>
|
|
|
|
|
</button>
|
2020-09-07 14:45:41 +03:00
|
|
|
<button *ngIf="selectDeviceProfileFormGroup.get('deviceProfile').value && !disabled && editProfileEnabled"
|
2020-09-03 14:14:46 +03:00
|
|
|
type="button"
|
|
|
|
|
matSuffix mat-button mat-icon-button aria-label="Edit"
|
|
|
|
|
matTooltip="{{ 'device-profile.edit' | translate }}"
|
|
|
|
|
matTooltipPosition="above"
|
|
|
|
|
(click)="editDeviceProfile($event)">
|
|
|
|
|
<mat-icon class="material-icons">edit</mat-icon>
|
|
|
|
|
</button>
|
|
|
|
|
<mat-autocomplete
|
|
|
|
|
class="tb-autocomplete"
|
2020-09-07 14:45:41 +03:00
|
|
|
(closed)="onPanelClosed()"
|
2020-09-03 14:14:46 +03:00
|
|
|
#deviceProfileAutocomplete="matAutocomplete"
|
|
|
|
|
[displayWith]="displayDeviceProfileFn">
|
|
|
|
|
<mat-option *ngFor="let deviceProfile of filteredDeviceProfiles | async" [value]="deviceProfile">
|
|
|
|
|
<span [innerHTML]="deviceProfile.name | highlight:searchText"></span>
|
|
|
|
|
</mat-option>
|
|
|
|
|
<mat-option *ngIf="!(filteredDeviceProfiles | async)?.length" [value]="null" class="tb-not-found">
|
|
|
|
|
<div class="tb-not-found-content" (click)="$event.stopPropagation()">
|
2020-09-29 15:47:17 +03:00
|
|
|
<div *ngIf="!textIsNotEmpty(searchText) || !addNewProfile; else searchNotEmpty">
|
2020-09-03 14:14:46 +03:00
|
|
|
<span translate>device-profile.no-device-profiles-found</span>
|
|
|
|
|
</div>
|
|
|
|
|
<ng-template #searchNotEmpty>
|
|
|
|
|
<span>
|
|
|
|
|
{{ translate.get('device-profile.no-device-profiles-matching',
|
|
|
|
|
{entity: truncate.transform(searchText, true, 6, '...')}) | async }}
|
|
|
|
|
</span>
|
2020-09-29 15:47:17 +03:00
|
|
|
<span>
|
|
|
|
|
<a translate (click)="createDeviceProfile($event, searchText)">device-profile.create-new-device-profile</a>
|
|
|
|
|
</span>
|
2020-09-03 14:14:46 +03:00
|
|
|
</ng-template>
|
|
|
|
|
</div>
|
|
|
|
|
</mat-option>
|
|
|
|
|
</mat-autocomplete>
|
|
|
|
|
<mat-error *ngIf="selectDeviceProfileFormGroup.get('deviceProfile').hasError('required')">
|
|
|
|
|
{{ 'device-profile.device-profile-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|