2019-08-13 19:58:35 +03:00
|
|
|
<!--
|
|
|
|
|
|
2021-01-11 13:42:16 +02:00
|
|
|
Copyright © 2016-2021 The Thingsboard Authors
|
2019-08-13 19:58:35 +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.
|
|
|
|
|
|
|
|
|
|
-->
|
2020-04-06 11:04:03 +03:00
|
|
|
<div class="tb-details-buttons" fxLayout.xs="column">
|
2019-08-13 19:58:35 +03:00
|
|
|
<button mat-raised-button color="primary"
|
|
|
|
|
[disabled]="(isLoading$ | async)"
|
|
|
|
|
(click)="onEntityAction($event, 'makePublic')"
|
|
|
|
|
[fxShow]="!isEdit && deviceScope === 'tenant' && !isAssignedToCustomer(entity) && !entity?.customerIsPublic">
|
|
|
|
|
{{'device.make-public' | translate }}
|
|
|
|
|
</button>
|
|
|
|
|
<button mat-raised-button color="primary"
|
|
|
|
|
[disabled]="(isLoading$ | async)"
|
|
|
|
|
(click)="onEntityAction($event, 'assignToCustomer')"
|
|
|
|
|
[fxShow]="!isEdit && deviceScope === 'tenant' && !isAssignedToCustomer(entity)">
|
|
|
|
|
{{'device.assign-to-customer' | translate }}
|
|
|
|
|
</button>
|
|
|
|
|
<button mat-raised-button color="primary"
|
|
|
|
|
[disabled]="(isLoading$ | async)"
|
|
|
|
|
(click)="onEntityAction($event, 'unassignFromCustomer')"
|
|
|
|
|
[fxShow]="!isEdit && (deviceScope === 'customer' || deviceScope === 'tenant') && isAssignedToCustomer(entity)">
|
|
|
|
|
{{ (entity?.customerIsPublic ? 'device.make-private' : 'device.unassign-from-customer') | translate }}
|
|
|
|
|
</button>
|
|
|
|
|
<button mat-raised-button color="primary"
|
|
|
|
|
[disabled]="(isLoading$ | async)"
|
|
|
|
|
(click)="onEntityAction($event, 'manageCredentials')"
|
|
|
|
|
[fxShow]="!isEdit">
|
2021-06-23 11:58:04 +03:00
|
|
|
{{ ((deviceScope === 'customer_user' || deviceScope === 'edge_customer_user') ? 'device.view-credentials' : 'device.manage-credentials') | translate }}
|
2019-08-13 19:58:35 +03:00
|
|
|
</button>
|
2020-12-10 16:59:15 +02:00
|
|
|
<button mat-raised-button color="primary"
|
|
|
|
|
[disabled]="(isLoading$ | async)"
|
|
|
|
|
(click)="onEntityAction($event, 'unassignFromEdge')"
|
|
|
|
|
[fxShow]="!isEdit && deviceScope === 'edge'">
|
|
|
|
|
{{ 'edge.unassign-from-edge' | translate }}
|
|
|
|
|
</button>
|
2020-04-06 11:04:03 +03:00
|
|
|
<button mat-raised-button color="primary" fxFlex.xs
|
2019-08-13 19:58:35 +03:00
|
|
|
[disabled]="(isLoading$ | async)"
|
|
|
|
|
(click)="onEntityAction($event, 'delete')"
|
|
|
|
|
[fxShow]="!hideDelete() && !isEdit">
|
|
|
|
|
{{'device.delete' | translate }}
|
|
|
|
|
</button>
|
2020-04-06 11:04:03 +03:00
|
|
|
<div fxLayout="row" fxLayout.xs="column">
|
2019-08-13 19:58:35 +03:00
|
|
|
<button mat-raised-button
|
|
|
|
|
ngxClipboard
|
|
|
|
|
(cbOnSuccess)="onDeviceIdCopied($event)"
|
|
|
|
|
[cbContent]="entity?.id?.id"
|
2020-11-23 12:13:05 +02:00
|
|
|
[disabled]="(isLoading$ | async)"
|
2019-08-13 19:58:35 +03:00
|
|
|
[fxShow]="!isEdit">
|
|
|
|
|
<mat-icon svgIcon="mdi:clipboard-arrow-left"></mat-icon>
|
|
|
|
|
<span translate>device.copyId</span>
|
|
|
|
|
</button>
|
2020-11-23 12:13:05 +02:00
|
|
|
<tb-copy-device-credentials
|
|
|
|
|
[fxShow]="!isEdit"
|
|
|
|
|
[disabled]="(isLoading$ | async)"
|
2020-11-24 17:11:19 +02:00
|
|
|
[credentials$]="deviceCredentials$"
|
2020-11-23 12:13:05 +02:00
|
|
|
[deviceId]="entity?.id">
|
|
|
|
|
</tb-copy-device-credentials>
|
2019-08-13 19:58:35 +03:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mat-padding" fxLayout="column">
|
|
|
|
|
<mat-form-field class="mat-block"
|
|
|
|
|
[fxShow]="!isEdit && isAssignedToCustomer(entity)
|
|
|
|
|
&& !entity?.customerIsPublic && deviceScope === 'tenant'">
|
|
|
|
|
<mat-label translate>device.assignedToCustomer</mat-label>
|
|
|
|
|
<input matInput disabled [ngModel]="entity?.customerTitle">
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<div class="tb-small" style="padding-bottom: 10px; padding-left: 2px;"
|
|
|
|
|
[fxShow]="!isEdit && entity?.customerIsPublic && (deviceScope === 'customer' || deviceScope === 'tenant')">
|
|
|
|
|
{{ 'device.device-public' | translate }}
|
|
|
|
|
</div>
|
2020-04-27 10:39:18 +03:00
|
|
|
<form [formGroup]="entityForm">
|
2019-08-13 19:58:35 +03:00
|
|
|
<fieldset [disabled]="(isLoading$ | async) || !isEdit">
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>device.name</mat-label>
|
|
|
|
|
<input matInput formControlName="name" required>
|
|
|
|
|
<mat-error *ngIf="entityForm.get('name').hasError('required')">
|
|
|
|
|
{{ 'device.name-required' | translate }}
|
|
|
|
|
</mat-error>
|
2021-07-01 16:21:44 +03:00
|
|
|
<mat-error *ngIf="entityForm.get('name').hasError('maxlength')">
|
|
|
|
|
{{ 'device.name-max-length' | translate }}
|
|
|
|
|
</mat-error>
|
2019-08-13 19:58:35 +03:00
|
|
|
</mat-form-field>
|
2020-09-03 14:14:46 +03:00
|
|
|
<tb-device-profile-autocomplete
|
|
|
|
|
[selectDefaultProfile]="isAdd"
|
|
|
|
|
required
|
|
|
|
|
formControlName="deviceProfileId"
|
|
|
|
|
(deviceProfileUpdated)="onDeviceProfileUpdated()"
|
|
|
|
|
(deviceProfileChanged)="onDeviceProfileChanged($event)">
|
|
|
|
|
</tb-device-profile-autocomplete>
|
2019-08-13 19:58:35 +03:00
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>device.label</mat-label>
|
|
|
|
|
<input matInput formControlName="label">
|
2021-07-01 16:21:44 +03:00
|
|
|
<mat-error *ngIf="entityForm.get('label').hasError('maxlength')">
|
|
|
|
|
{{ 'device.label-max-length' | translate }}
|
|
|
|
|
</mat-error>
|
2019-08-13 19:58:35 +03:00
|
|
|
</mat-form-field>
|
2021-05-31 18:15:31 +03:00
|
|
|
<tb-ota-package-autocomplete
|
2021-04-13 15:10:13 +03:00
|
|
|
[useFullEntityId]="true"
|
2021-05-31 18:15:31 +03:00
|
|
|
[type]="otaUpdateType.FIRMWARE"
|
2021-04-29 16:01:47 +03:00
|
|
|
[deviceProfileId]="entityForm.get('deviceProfileId').value?.id"
|
2021-04-13 15:10:13 +03:00
|
|
|
formControlName="firmwareId">
|
2021-05-31 18:15:31 +03:00
|
|
|
</tb-ota-package-autocomplete>
|
|
|
|
|
<tb-ota-package-autocomplete
|
2021-04-29 16:01:47 +03:00
|
|
|
[useFullEntityId]="true"
|
2021-05-31 18:15:31 +03:00
|
|
|
[type]="otaUpdateType.SOFTWARE"
|
2021-04-29 16:01:47 +03:00
|
|
|
[deviceProfileId]="entityForm.get('deviceProfileId').value?.id"
|
|
|
|
|
formControlName="softwareId">
|
2021-05-31 18:15:31 +03:00
|
|
|
</tb-ota-package-autocomplete>
|
2020-09-03 14:14:46 +03:00
|
|
|
<tb-device-data
|
|
|
|
|
formControlName="deviceData"
|
|
|
|
|
required>
|
|
|
|
|
</tb-device-data>
|
2019-08-13 19:58:35 +03:00
|
|
|
<div formGroupName="additionalInfo" fxLayout="column">
|
2021-01-15 18:55:35 +02:00
|
|
|
<div fxLayout="row" fxLayout.xs="column" style="padding-bottom: 16px;">
|
|
|
|
|
<mat-checkbox fxFlex.gt-sm="30" fxFlex formControlName="gateway">
|
|
|
|
|
{{ 'device.is-gateway' | translate }}
|
|
|
|
|
</mat-checkbox>
|
|
|
|
|
<mat-checkbox fxFlex *ngIf="entityForm.get('additionalInfo.gateway').value"
|
2021-01-22 16:06:48 +02:00
|
|
|
formControlName="overwriteActivityTime">
|
|
|
|
|
{{ 'device.overwrite-activity-time' | translate }}
|
2021-01-15 18:55:35 +02:00
|
|
|
</mat-checkbox>
|
|
|
|
|
</div>
|
2019-08-13 19:58:35 +03:00
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>device.description</mat-label>
|
|
|
|
|
<textarea matInput formControlName="description" rows="2"></textarea>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|