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

View File

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

View File

@ -22,19 +22,22 @@
<section [formGroup]="lwm2mDeviceProfileFormGroup"> <section [formGroup]="lwm2mDeviceProfileFormGroup">
<div class="mat-padding" style="padding-bottom: 0px"> <div class="mat-padding" style="padding-bottom: 0px">
<mat-checkbox formControlName="clientOnlyObserveAfterConnect" color="primary" <mat-checkbox formControlName="clientOnlyObserveAfterConnect" color="primary"
matTooltip="{{ translate.get('device-profile.lwm2m.client-only-observe-after-connect-tip', matTooltip="{{ 'device-profile.lwm2m.client-only-observe-after-connect-tip' | translate:
{ count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value }) | async }}" { count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value } }}"
matTooltipPosition="above"> matTooltipPosition="above">
{{ translate.get('device-profile.lwm2m.client-only-observe-after-connect', {{ 'device-profile.lwm2m.client-only-observe-after-connect' | translate:
{ count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value }) | async }} {count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value} }}
</mat-checkbox> </mat-checkbox>
<mat-checkbox *ngIf="!lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value" </div>
formControlName="clientUpdateValueAfterConnect" color="primary" <div class="mat-padding" style="padding-bottom: 0px"
matTooltip="{{ translate.get('device-profile.lwm2m.client-update-value-after-connect-tip', *ngIf="!lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value">
{ count: +lwm2mDeviceProfileFormGroup.get('clientUpdateValueAfterConnect').value }) | async }}" <mat-checkbox
matTooltipPosition="above"> formControlName="clientUpdateValueAfterConnect" color="primary"
{{ translate.get('device-profile.lwm2m.client-update-value-after-connect', matTooltip="{{ 'device-profile.lwm2m.client-update-value-after-connect-tip' | translate:
{ count: +lwm2mDeviceProfileFormGroup.get('clientUpdateValueAfterConnect').value }) | async }} { count: +lwm2mDeviceProfileFormGroup.get('clientUpdateValueAfterConnect').value } }}"
matTooltipPosition="above">
{{ 'device-profile.lwm2m.client-update-value-after-connect' | translate:
{count: +lwm2mDeviceProfileFormGroup.get('clientUpdateValueAfterConnect').value} }}
</mat-checkbox> </mat-checkbox>
</div> </div>
<div class="mat-padding" style="padding-top: 0"> <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 { WINDOW } from '@core/services/window.service';
import { JsonObject } from '@angular/compiler-cli/ngcc/src/packages/entry_point'; import { JsonObject } from '@angular/compiler-cli/ngcc/src/packages/entry_point';
import { Direction } from '@shared/models/page/sort-order'; import { Direction } from '@shared/models/page/sort-order';
import { TranslateService } from '@ngx-translate/core';
@Component({ @Component({
selector: 'tb-profile-lwm2m-device-transport-configuration', selector: 'tb-profile-lwm2m-device-transport-configuration',
@ -69,7 +68,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
} }
constructor(private store: Store<AppState>, constructor(private store: Store<AppState>,
public translate: TranslateService,
private fb: FormBuilder, private fb: FormBuilder,
private deviceProfileService: DeviceProfileService, private deviceProfileService: DeviceProfileService,
@Inject(WINDOW) private window: Window) { @Inject(WINDOW) private window: Window) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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