78 lines
3.8 KiB
HTML
78 lines
3.8 KiB
HTML
|
|
<!--
|
||
|
|
|
||
|
|
Copyright © 2016-2020 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(deviceCredentialsType[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>
|
||
|
|
<mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsBasic').hasError('atLeastOne')">
|
||
|
|
{{ 'device.client-id-or-user-name-necessary' | translate }}
|
||
|
|
</mat-error>
|
||
|
|
</section>
|
||
|
|
</section>
|