Lwm2m: front: fix bug PR

This commit is contained in:
nickAS21 2021-02-05 12:31:42 +02:00 committed by Andrew Shvayka
parent e5b49c70d9
commit 9552ab0589
11 changed files with 37 additions and 44 deletions

View File

@ -109,15 +109,15 @@
(serverFormGroup.get('securityMode').value === securityConfigLwM2MType.RPK ||
serverFormGroup.get('securityMode').value === securityConfigLwM2MType.X509)">
{{ 'device-profile.lwm2m.server-public-key' | translate }}
<strong>{{ translate.get('device-profile.lwm2m.pattern_hex_dec', {
count: 0}) | async }}</strong>
<strong>{{ 'device-profile.lwm2m.pattern_hex_dec' | translate: {
count: 0} }}</strong>
</mat-error>
<mat-error *ngIf="(serverFormGroup.get('serverPublicKey').hasError('maxlength') ||
serverFormGroup.get('serverPublicKey').hasError('minlength')) &&
serverFormGroup.get('securityMode').value === securityConfigLwM2MType.RPK">
{{ 'device-profile.lwm2m.server-public-key' | translate }}
<strong>{{ translate.get('device-profile.lwm2m.pattern_hex_dec', {
count: lenMaxServerPublicKey }) | async }}</strong>
<strong>{{ 'device-profile.lwm2m.pattern_hex_dec' | translate: {
count: lenMaxServerPublicKey } }}</strong>
</mat-error>
</mat-form-field>
</div>

View File

@ -34,7 +34,6 @@ import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { WINDOW } from '@core/services/window.service';
import { pairwise, startWith } from 'rxjs/operators';
import { DeviceProfileService } from '@core/http/device-profile.service';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'tb-profile-lwm2m-device-config-server',
@ -75,7 +74,6 @@ export class Lwm2mDeviceConfigServerComponent implements ControlValueAccessor {
}
constructor(protected store: Store<AppState>,
public translate: TranslateService,
public fb: FormBuilder,
private deviceProfileService: DeviceProfileService,
@Inject(WINDOW) private window: Window) {

View File

@ -22,19 +22,22 @@
<section [formGroup]="lwm2mDeviceProfileFormGroup">
<div class="mat-padding" style="padding-bottom: 0px">
<mat-checkbox formControlName="clientOnlyObserveAfterConnect" color="primary"
matTooltip="{{ translate.get('device-profile.lwm2m.client-only-observe-after-connect-tip',
{ count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value }) | async }}"
matTooltip="{{ 'device-profile.lwm2m.client-only-observe-after-connect-tip' | translate:
{ count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value } }}"
matTooltipPosition="above">
{{ translate.get('device-profile.lwm2m.client-only-observe-after-connect',
{ count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value }) | async }}
{{ 'device-profile.lwm2m.client-only-observe-after-connect' | translate:
{count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value} }}
</mat-checkbox>
<mat-checkbox *ngIf="!lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value"
formControlName="clientUpdateValueAfterConnect" color="primary"
matTooltip="{{ translate.get('device-profile.lwm2m.client-update-value-after-connect-tip',
{ count: +lwm2mDeviceProfileFormGroup.get('clientUpdateValueAfterConnect').value }) | async }}"
matTooltipPosition="above">
{{ translate.get('device-profile.lwm2m.client-update-value-after-connect',
{ count: +lwm2mDeviceProfileFormGroup.get('clientUpdateValueAfterConnect').value }) | async }}
</div>
<div class="mat-padding" style="padding-bottom: 0px"
*ngIf="!lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value">
<mat-checkbox
formControlName="clientUpdateValueAfterConnect" color="primary"
matTooltip="{{ 'device-profile.lwm2m.client-update-value-after-connect-tip' | translate:
{ count: +lwm2mDeviceProfileFormGroup.get('clientUpdateValueAfterConnect').value } }}"
matTooltipPosition="above">
{{ 'device-profile.lwm2m.client-update-value-after-connect' | translate:
{count: +lwm2mDeviceProfileFormGroup.get('clientUpdateValueAfterConnect').value} }}
</mat-checkbox>
</div>
<div class="mat-padding" style="padding-top: 0">

View File

@ -32,7 +32,6 @@ import { deepClone, isDefinedAndNotNull, isUndefined } from '@core/utils';
import { WINDOW } from '@core/services/window.service';
import { JsonObject } from '@angular/compiler-cli/ngcc/src/packages/entry_point';
import { Direction } from '@shared/models/page/sort-order';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'tb-profile-lwm2m-device-transport-configuration',
@ -69,7 +68,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
}
constructor(private store: Store<AppState>,
public translate: TranslateService,
private fb: FormBuilder,
private deviceProfileService: DeviceProfileService,
@Inject(WINDOW) private window: Window) {

View File

@ -39,19 +39,19 @@
<mat-icon>add</mat-icon>
</button>
<mat-error *ngIf="instancesListFormGroup.get('instanceIdInput').hasError('min')">
{{ translate.get('device-profile.lwm2m.valid-id-instance', {
{{ 'device-profile.lwm2m.valid-id-instance' | translate: {
count: 2, instance: instanceId, min: instanceIdValueMin
}) | async }}
} }}
</mat-error>
<mat-error *ngIf="instancesListFormGroup.get('instanceIdInput').hasError('max')">
{{ translate.get('device-profile.lwm2m.valid-id-instance', {
{{ 'device-profile.lwm2m.valid-id-instance' | translate: {
count: 1, instance: instanceId, max: instanceIdValueMax
}) | async }}
} }}
</mat-error>
<mat-error *ngIf="instancesListFormGroup.get('instanceIdInput').hasError('pattern')">
{{ translate.get('device-profile.lwm2m.valid-id-instance', {
{{ 'device-profile.lwm2m.valid-id-instance' | translate: {
count: 0, instance: instanceId, max: instanceIdValueMax
}) | async }}
} }}
</mat-error>
</mat-form-field>
</section>

View File

@ -19,7 +19,6 @@ import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Valida
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { INSTANCES_ID_VALUE_MAX, INSTANCES_ID_VALUE_MIN, KEY_REGEXP_NUMBER } from './profile-config.models';
import { TranslateService } from '@ngx-translate/core';
import { DeviceProfileService } from '@core/http/device-profile.service';
@Component({
@ -44,7 +43,6 @@ export class Lwm2mObjectAddInstancesListComponent implements ControlValueAccesso
private propagateChange = (v: any) => { };
constructor(private store: Store<AppState>,
public translate: TranslateService,
private deviceProfileService: DeviceProfileService,
private fb: FormBuilder) {
this.instancesListFormGroup = this.fb.group({

View File

@ -44,7 +44,7 @@
</mat-option>
<mat-option *ngIf="!(filteredObjectsList | async)?.length" [value]="null">
<span>
{{ translate.get('device-profile.lwm2m.no-objects-matching', {object: searchText}) | async }}
{{ 'device-profile.lwm2m.no-objects-matching' | translate: {object: searchText} }}
</span>
</mat-option>
</mat-autocomplete>

View File

@ -22,7 +22,6 @@ import { AppState } from '@core/core.state';
import { Observable } from 'rxjs';
import { filter, map, mergeMap, publishReplay, refCount, tap } from 'rxjs/operators';
import { ModelValue, ObjectLwM2M } from './profile-config.models';
import { TranslateService } from '@ngx-translate/core';
import { DeviceProfileService } from '@core/http/device-profile.service';
import { Direction } from '@shared/models/page/sort-order';
import { isDefined, isDefinedAndNotNull, isEmptyStr, isString } from '@core/utils';
@ -72,7 +71,6 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V
}
constructor(private store: Store<AppState>,
public translate: TranslateService,
private deviceProfileService: DeviceProfileService,
private fb: FormBuilder) {
this.lwm2mListFormGroup = this.fb.group({

View File

@ -52,16 +52,16 @@
</mat-error>
<mat-error *ngIf="serverFormGroup.get('clientPublicKeyOrId').hasError('pattern')">
{{ 'device.lwm2m-security-config.client-key' | translate }}
<strong>{{ translate.get('device.lwm2m-security-config.pattern_hex_dec', {
<strong>{{ 'device.lwm2m-security-config.pattern_hex_dec' | translate: {
count: 0
}) | async }}</strong>
} }}</strong>
</mat-error>
<mat-error *ngIf="(serverFormGroup.get('clientPublicKeyOrId').hasError('maxlength') ||
serverFormGroup.get('clientPublicKeyOrId').hasError('minlength'))">
{{ 'device.lwm2m-security-config.client-key' | translate }}
<strong>{{ translate.get('device.lwm2m-security-config.pattern_hex_dec', {
<strong>{{ 'device.lwm2m-security-config.pattern_hex_dec' | translate: {
count: lenMaxClientPublicKeyOrId
}) | async }}</strong>
} }}</strong>
</mat-error>
</mat-form-field>
<mat-form-field class="mat-block">
@ -83,16 +83,16 @@
</mat-error>
<mat-error *ngIf="serverFormGroup.get('clientSecretKey').hasError('pattern')">
{{ 'device.lwm2m-security-config.client-key' | translate }}
<strong>{{ translate.get('device.lwm2m-security-config.pattern_hex_dec', {
<strong>{{ 'device.lwm2m-security-config.pattern_hex_dec' | translate: {
count: 0
}) | async }}</strong>
} }}</strong>
</mat-error>
<mat-error *ngIf="(serverFormGroup.get('clientSecretKey').hasError('maxlength') ||
serverFormGroup.get('clientSecretKey').hasError('minlength'))">
{{ 'device.lwm2m-security-config.client-key' | translate }}
<strong>{{ translate.get('device.lwm2m-security-config.pattern_hex_dec', {
<strong>{{ 'device.lwm2m-security-config.pattern_hex_dec' | translate: {
count: lenMaxClientSecretKey
}) | async }}</strong>
} }}</strong>
</mat-error>
</mat-form-field>
</div>

View File

@ -31,7 +31,6 @@ import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { PageComponent } from '@shared/components/page.component';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'tb-security-config-server-lwm2m',
@ -61,7 +60,6 @@ export class SecurityConfigServerComponent extends PageComponent implements OnIn
constructor(protected store: Store<AppState>,
@Inject(MAT_DIALOG_DATA) public data: DeviceCredentialsDialogLwm2mData,
public dialogRef: MatDialogRef<SecurityConfigServerComponent, object>,
public translate: TranslateService,
public fb: FormBuilder) {
super(store);
}

View File

@ -82,16 +82,16 @@
</mat-error>
<mat-error *ngIf="lwm2mConfigFormGroup.get('clientKey').hasError('pattern')">
{{ 'device.lwm2m-security-config.client-key' | translate }}
<strong>{{ translate.get('device.lwm2m-security-config.pattern_hex_dec', {
<strong>{{ 'device.lwm2m-security-config.pattern_hex_dec' | translate: {
count: 0
}) | async }}</strong>
} }}</strong>
</mat-error>
<mat-error *ngIf="(lwm2mConfigFormGroup.get('clientKey').hasError('maxlength') ||
lwm2mConfigFormGroup.get('clientKey').hasError('minlength'))">
{{ 'device.lwm2m-security-config.client-key' | translate }}
<strong>{{ translate.get('device.lwm2m-security-config.pattern_hex_dec', {
<strong>{{ 'device.lwm2m-security-config.pattern_hex_dec' | translate: {
count: lenMaxKeyClient
}) | async }}</strong>
} }}</strong>
</mat-error>
</mat-form-field>
</div>