* UI: Refactoring LWM2M; fixed build ui rule node * UI: Refactoring LWM2M security config
107 lines
5.3 KiB
HTML
107 lines
5.3 KiB
HTML
<!--
|
|
|
|
Copyright © 2016-2021 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.
|
|
|
|
-->
|
|
<section [formGroup]="deviceCredentialsFormGroup">
|
|
<mat-form-field class="mat-block">
|
|
<mat-label translate>device.credentials-type</mat-label>
|
|
<mat-select formControlName="credentialsType">
|
|
<mat-option *ngFor="let credentialsType of credentialsTypes" [value]="credentialsType">
|
|
{{ credentialTypeNamesMap.get(credentialsType) }}
|
|
</mat-option>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
<mat-form-field *ngIf="deviceCredentialsFormGroup.get('credentialsType').value === deviceCredentialsType.ACCESS_TOKEN"
|
|
class="mat-block">
|
|
<mat-label translate>device.access-token</mat-label>
|
|
<input matInput formControlName="credentialsId" required>
|
|
<mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsId').hasError('required')">
|
|
{{ 'device.access-token-required' | translate }}
|
|
</mat-error>
|
|
<mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsId').hasError('pattern')">
|
|
{{ 'device.access-token-invalid' | translate }}
|
|
</mat-error>
|
|
</mat-form-field>
|
|
<mat-form-field *ngIf="deviceCredentialsFormGroup.get('credentialsType').value === deviceCredentialsType.X509_CERTIFICATE"
|
|
class="mat-block">
|
|
<mat-label translate>device.rsa-key</mat-label>
|
|
<textarea matInput formControlName="credentialsValue" cols="15" rows="5" required></textarea>
|
|
<mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsValue').hasError('required')">
|
|
{{ 'device.rsa-key-required' | translate }}
|
|
</mat-error>
|
|
</mat-form-field>
|
|
<section *ngIf="deviceCredentialsFormGroup.get('credentialsType').value === deviceCredentialsType.MQTT_BASIC" formGroupName="credentialsBasic">
|
|
<mat-form-field class="mat-block">
|
|
<mat-label translate>device.client-id</mat-label>
|
|
<input matInput formControlName="clientId">
|
|
<mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsBasic.clientId').hasError('pattern')">
|
|
{{ 'device.client-id-pattern' | translate }}
|
|
</mat-error>
|
|
</mat-form-field>
|
|
<mat-form-field class="mat-block">
|
|
<mat-label translate>device.user-name</mat-label>
|
|
<input matInput formControlName="userName" [required]="!!deviceCredentialsFormGroup.get('credentialsBasic.password').value">
|
|
<mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsBasic.userName').hasError('required')">
|
|
{{ 'device.user-name-required' | translate }}
|
|
</mat-error>
|
|
</mat-form-field>
|
|
<mat-form-field class="mat-block">
|
|
<mat-label translate>device.password</mat-label>
|
|
<input matInput formControlName="password"
|
|
autocomplete="new-password"
|
|
(ngModelChange)="passwordChanged()"
|
|
[type]="hidePassword ? 'password' : 'text'">
|
|
<button mat-icon-button matSuffix type="button"
|
|
(click)="hidePassword = !hidePassword"
|
|
[attr.aria-pressed]="hidePassword">
|
|
<mat-icon>{{hidePassword ? 'visibility_off' : 'visibility'}}</mat-icon>
|
|
</button>
|
|
</mat-form-field>
|
|
<tb-error style="margin-top: -12px; display: block;"
|
|
[error]="deviceCredentialsFormGroup.get('credentialsBasic').hasError('atLeastOne') ?
|
|
('device.client-id-or-user-name-necessary' | translate) : ''"></tb-error>
|
|
</section>
|
|
<div *ngIf="deviceCredentialsFormGroup.get('credentialsType').value === deviceCredentialsType.LWM2M_CREDENTIALS">
|
|
<mat-form-field class="mat-block">
|
|
<mat-label translate>device.lwm2m-key</mat-label>
|
|
<input matInput type="text" formControlName="credentialsId" required>
|
|
<mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsId').hasError('required')">
|
|
{{ 'device.lwm2m-key-required' | translate }}
|
|
</mat-error>
|
|
</mat-form-field>
|
|
<mat-form-field class="mat-block">
|
|
<mat-label translate>device.lwm2m-value</mat-label>
|
|
<textarea matInput formControlName="credentialsValue" rows="10" required
|
|
[matTooltip]="lwm2mCredentialsValueTooltip(deviceCredentialsFormGroup.get('credentialsValue').hasError('jsonError'))"
|
|
matTooltipPosition="above"
|
|
></textarea>
|
|
<mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsValue').hasError('required')">
|
|
{{ 'device.lwm2m-value-required' | translate }}
|
|
</mat-error>
|
|
<mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsValue').hasError('jsonError')">
|
|
{{ 'device.lwm2m-value-format-error' | translate }}
|
|
</mat-error>
|
|
<div mat-dialog-actions fxLayoutAlign="center center">
|
|
<button mat-raised-button color="primary"
|
|
(click)="openSecurityInfoLwM2mDialog($event)"
|
|
>
|
|
{{'device.lwm2m-value-edit' | translate }}
|
|
</button>
|
|
</div>
|
|
</mat-form-field>
|
|
</div>
|
|
</section>
|