Browse Source
Merge pull request #9218 from rusikv/bug/add-telemetry-validation-hint
Fixed add telemetry dialog validation hints
pull/9240/head
Igor Kulikov
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
6 deletions
-
ui-ngx/src/app/modules/home/components/attribute/add-attribute-dialog.component.html
-
ui-ngx/src/app/modules/home/components/attribute/add-attribute-dialog.component.ts
-
ui-ngx/src/assets/locale/locale.constant-en_US.json
|
|
|
@ -17,7 +17,7 @@ |
|
|
|
--> |
|
|
|
<form [formGroup]="attributeFormGroup" (ngSubmit)="add()" style="min-width: 400px;"> |
|
|
|
<mat-toolbar color="primary"> |
|
|
|
<h2>{{ title | translate }}</h2> |
|
|
|
<h2>{{ (isTelemetry ? 'attribute.add-telemetry' : 'attribute.add') | translate }}</h2> |
|
|
|
<span fxFlex></span> |
|
|
|
<button mat-icon-button |
|
|
|
(click)="cancel()" |
|
|
|
@ -34,7 +34,7 @@ |
|
|
|
<mat-label translate>attribute.key</mat-label> |
|
|
|
<input matInput formControlName="key" required> |
|
|
|
<mat-error *ngIf="attributeFormGroup.get('key').hasError('required')"> |
|
|
|
{{ 'attribute.key-required' | translate }} |
|
|
|
{{ (isTelemetry ? 'attribute.telemetry-key-required' : 'attribute.key-required') | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="attributeFormGroup.get('key').hasError('maxlength')"> |
|
|
|
{{ 'attribute.key-max-length' | translate }} |
|
|
|
@ -42,7 +42,7 @@ |
|
|
|
</mat-form-field> |
|
|
|
<tb-value-input |
|
|
|
formControlName="value" |
|
|
|
requiredText="attribute.value-required"> |
|
|
|
[requiredText]="isTelemetry ? 'attribute.telemetry-value-required' : 'attribute.value-required'"> |
|
|
|
</tb-value-input> |
|
|
|
</fieldset> |
|
|
|
</div> |
|
|
|
|
|
|
|
@ -45,7 +45,7 @@ export class AddAttributeDialogComponent extends DialogComponent<AddAttributeDia |
|
|
|
|
|
|
|
submitted = false; |
|
|
|
|
|
|
|
title = ''; |
|
|
|
isTelemetry = false; |
|
|
|
|
|
|
|
constructor(protected store: Store<AppState>, |
|
|
|
protected router: Router, |
|
|
|
@ -62,8 +62,7 @@ export class AddAttributeDialogComponent extends DialogComponent<AddAttributeDia |
|
|
|
key: ['', [Validators.required, Validators.maxLength(255)]], |
|
|
|
value: [null, [Validators.required]] |
|
|
|
}); |
|
|
|
this.title = this.data.attributeScope === LatestTelemetry.LATEST_TELEMETRY ? |
|
|
|
'attribute.add-telemetry' : 'attribute.add' |
|
|
|
this.isTelemetry = this.data.attributeScope === LatestTelemetry.LATEST_TELEMETRY; |
|
|
|
} |
|
|
|
|
|
|
|
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean { |
|
|
|
|
|
|
|
@ -722,6 +722,8 @@ |
|
|
|
"key-required": "Attribute key is required.", |
|
|
|
"value": "Value", |
|
|
|
"value-required": "Attribute value is required.", |
|
|
|
"telemetry-key-required": "Telemetry key is required", |
|
|
|
"telemetry-value-required": "Telemetry value is required", |
|
|
|
"delete-attributes-title": "Are you sure you want to delete { count, plural, =1 {1 attribute} other {# attributes} }?", |
|
|
|
"delete-attributes-text": "Be careful, after the confirmation all selected attributes will be removed.", |
|
|
|
"delete-attributes": "Delete attributes", |
|
|
|
|