Commit ab18d74102d15cf88292118de810523460c6f63f
Committed by
GitHub
Merge pull request #3579 from vvlladd28/improvement/device-credential
UI: Refactoring show error in device-credentials
Showing
2 changed files
with
5 additions
and
8 deletions
... | ... | @@ -70,8 +70,8 @@ |
70 | 70 | <mat-icon>{{hidePassword ? 'visibility_off' : 'visibility'}}</mat-icon> |
71 | 71 | </button> |
72 | 72 | </mat-form-field> |
73 | - <mat-error *ngIf="deviceCredentialsFormGroup.get('credentialsBasic').hasError('atLeastOne')"> | |
74 | - {{ 'device.client-id-or-user-name-necessary' | translate }} | |
75 | - </mat-error> | |
73 | + <tb-error style="margin-top: -12px; display: block;" | |
74 | + [error]="deviceCredentialsFormGroup.get('credentialsBasic').hasError('atLeastOne') ? | |
75 | + ('device.client-id-or-user-name-necessary' | translate) : ''"></tb-error> | |
76 | 76 | </section> |
77 | 77 | </section> | ... | ... |
... | ... | @@ -174,8 +174,8 @@ export class DeviceCredentialsComponent implements ControlValueAccessor, OnInit, |
174 | 174 | |
175 | 175 | updateValidators(): void { |
176 | 176 | this.hidePassword = true; |
177 | - const crendetialsType = this.deviceCredentialsFormGroup.get('credentialsType').value as DeviceCredentialsType; | |
178 | - switch (crendetialsType) { | |
177 | + const credentialsType = this.deviceCredentialsFormGroup.get('credentialsType').value as DeviceCredentialsType; | |
178 | + switch (credentialsType) { | |
179 | 179 | case DeviceCredentialsType.ACCESS_TOKEN: |
180 | 180 | this.deviceCredentialsFormGroup.get('credentialsId').setValidators([Validators.required, Validators.pattern(/^.{1,20}$/)]); |
181 | 181 | this.deviceCredentialsFormGroup.get('credentialsId').updateValueAndValidity({emitEvent: false}); |
... | ... | @@ -215,9 +215,6 @@ export class DeviceCredentialsComponent implements ControlValueAccessor, OnInit, |
215 | 215 | const value = this.deviceCredentialsFormGroup.get('credentialsBasic.password').value; |
216 | 216 | if (value !== '') { |
217 | 217 | this.deviceCredentialsFormGroup.get('credentialsBasic.userName').setValidators([Validators.required]); |
218 | - if (this.deviceCredentialsFormGroup.get('credentialsBasic.userName').untouched) { | |
219 | - this.deviceCredentialsFormGroup.get('credentialsBasic.userName').markAsTouched({onlySelf: true}); | |
220 | - } | |
221 | 218 | } else { |
222 | 219 | this.deviceCredentialsFormGroup.get('credentialsBasic.userName').setValidators([]); |
223 | 220 | } | ... | ... |