UI: Refactoring LwM2M device profile setting; Delete unused translation
This commit is contained in:
parent
25ac5f309c
commit
4d59d17141
@ -174,14 +174,9 @@
|
||||
<!-- <div fxLayout="column">-->
|
||||
<!-- <mat-form-field class="mat-block">-->
|
||||
<!-- <mat-label>{{ 'device-profile.lwm2m.client-strategy-label' | translate }}</mat-label>-->
|
||||
<!-- <mat-select formControlName="clientOnlyObserveAfterConnect"-->
|
||||
<!-- matTooltip="{{ 'device-profile.lwm2m.client-strategy-tip' | translate:-->
|
||||
<!-- { count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value } }}"-->
|
||||
<!-- matTooltipPosition="above">-->
|
||||
<!-- <mat-option value=1>{{ 'device-profile.lwm2m.client-strategy-connect' | translate:-->
|
||||
<!-- {count: 1} }}</mat-option>-->
|
||||
<!-- <mat-option value=2>{{ 'device-profile.lwm2m.client-strategy-connect' | translate:-->
|
||||
<!-- {count: 2} }}</mat-option>-->
|
||||
<!-- <mat-select formControlName="clientOnlyObserveAfterConnect">-->
|
||||
<!-- <mat-option value=1>{{ 'device-profile.lwm2m.client-strategy-only-observe' | translate }}</mat-option>-->
|
||||
<!-- <mat-option value=2>{{ 'device-profile.lwm2m.client-strategy-read-all' | translate }}</mat-option>-->
|
||||
<!-- </mat-select>-->
|
||||
<!-- </mat-form-field>-->
|
||||
<!-- </div>-->
|
||||
@ -194,13 +189,12 @@
|
||||
</mat-tab>
|
||||
<mat-tab label="{{ 'device-profile.lwm2m.config-json-tab' | translate }}">
|
||||
<ng-template matTabContent>
|
||||
<section [formGroup]="lwm2mDeviceConfigFormGroup" style="padding: 8px 0">
|
||||
<section style="padding: 8px 0">
|
||||
<tb-json-object-edit
|
||||
readonly
|
||||
[required]="required"
|
||||
[sort]="sortFunction"
|
||||
label="{{ 'device-profile.transport-type-lwm2m' | translate }}"
|
||||
formControlName="configurationJson">
|
||||
[ngModel]="configurationValue">
|
||||
</tb-json-object-edit>
|
||||
</section>
|
||||
</ng-template>
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
/// limitations under the License.
|
||||
///
|
||||
|
||||
import { DeviceProfileTransportConfiguration } from '@shared/models/device.models';
|
||||
import { Component, forwardRef, Input, OnDestroy } from '@angular/core';
|
||||
import {
|
||||
ControlValueAccessor,
|
||||
@ -76,7 +75,6 @@ import { takeUntil } from 'rxjs/operators';
|
||||
})
|
||||
export class Lwm2mDeviceProfileTransportConfigurationComponent implements ControlValueAccessor, Validator, OnDestroy {
|
||||
|
||||
private configurationValue: Lwm2mProfileConfigModels;
|
||||
private requiredValue: boolean;
|
||||
private disabled = false;
|
||||
private destroy$ = new Subject();
|
||||
@ -84,7 +82,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
bindingModeTypes = Object.values(BingingMode);
|
||||
bindingModeTypeNamesMap = BingingModeTranslationsMap;
|
||||
lwm2mDeviceProfileFormGroup: FormGroup;
|
||||
lwm2mDeviceConfigFormGroup: FormGroup;
|
||||
configurationValue: Lwm2mProfileConfigModels;
|
||||
sortFunction: (key: string, value: object) => object;
|
||||
|
||||
get required(): boolean {
|
||||
@ -128,9 +126,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
compositeOperationsSupport: [false]
|
||||
})
|
||||
});
|
||||
this.lwm2mDeviceConfigFormGroup = this.fb.group({
|
||||
configurationJson: [null, Validators.required]
|
||||
});
|
||||
this.lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.fwUpdateStrategy').valueChanges.pipe(
|
||||
takeUntil(this.destroy$)
|
||||
).subscribe((fwStrategy) => {
|
||||
@ -158,11 +153,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
).subscribe((value) => {
|
||||
this.updateDeviceProfileValue(value);
|
||||
});
|
||||
this.lwm2mDeviceConfigFormGroup.valueChanges.pipe(
|
||||
takeUntil(this.destroy$)
|
||||
).subscribe(() => {
|
||||
this.updateModel();
|
||||
});
|
||||
this.sortFunction = this.sortObjectKeyPathJson;
|
||||
}
|
||||
|
||||
@ -182,10 +172,8 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
this.disabled = isDisabled;
|
||||
if (isDisabled) {
|
||||
this.lwm2mDeviceProfileFormGroup.disable({emitEvent: false});
|
||||
this.lwm2mDeviceConfigFormGroup.disable({emitEvent: false});
|
||||
} else {
|
||||
this.lwm2mDeviceProfileFormGroup.enable({emitEvent: false});
|
||||
this.lwm2mDeviceConfigFormGroup.enable({emitEvent: false});
|
||||
this.lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.powerMode').updateValueAndValidity({onlySelf: true});
|
||||
this.lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.fwUpdateStrategy').updateValueAndValidity({onlySelf: true});
|
||||
this.lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.swUpdateStrategy').updateValueAndValidity({onlySelf: true});
|
||||
@ -196,9 +184,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
if (isDefinedAndNotNull(value) && (value?.clientLwM2mSettings || value?.observeAttr || value?.bootstrap)) {
|
||||
this.configurationValue = value;
|
||||
const defaultFormSettings = !(value.observeAttr.attribute.length && value.observeAttr.telemetry.length);
|
||||
this.lwm2mDeviceConfigFormGroup.patchValue({
|
||||
configurationJson: this.configurationValue
|
||||
}, {emitEvent: defaultFormSettings});
|
||||
if (defaultFormSettings) {
|
||||
await this.defaultProfileConfig();
|
||||
}
|
||||
@ -227,9 +212,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
|
||||
this.configurationValue.bootstrap.bootstrapServer = bootstrap;
|
||||
this.configurationValue.bootstrap.lwm2mServer = lwm2m;
|
||||
this.lwm2mDeviceConfigFormGroup.patchValue({
|
||||
configurationJson: this.configurationValue
|
||||
}, {emitEvent: false});
|
||||
this.lwm2mDeviceProfileFormGroup.patchValue({
|
||||
bootstrap: this.configurationValue.bootstrap
|
||||
}, {emitEvent: false});
|
||||
@ -265,6 +247,8 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
swUpdateResource: this.configurationValue.clientLwM2mSettings.swUpdateResource || '',
|
||||
powerMode: this.configurationValue.clientLwM2mSettings.powerMode || PowerMode.DRX,
|
||||
edrxCycle: this.configurationValue.clientLwM2mSettings.edrxCycle || 0,
|
||||
pagingTransmissionWindow: this.configurationValue.clientLwM2mSettings.pagingTransmissionWindow || 0,
|
||||
psmActivityTimer: this.configurationValue.clientLwM2mSettings.psmActivityTimer || 0,
|
||||
compositeOperationsSupport: this.configurationValue.clientLwM2mSettings.compositeOperationsSupport || false
|
||||
}
|
||||
},
|
||||
@ -277,9 +261,9 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
}
|
||||
|
||||
private updateModel = (): void => {
|
||||
let configuration: DeviceProfileTransportConfiguration = null;
|
||||
if (this.lwm2mDeviceConfigFormGroup.valid && this.lwm2mDeviceProfileFormGroup.valid) {
|
||||
configuration = this.lwm2mDeviceConfigFormGroup.value.configurationJson;
|
||||
let configuration: Lwm2mProfileConfigModels = null;
|
||||
if (this.lwm2mDeviceProfileFormGroup.valid) {
|
||||
configuration = this.configurationValue;
|
||||
}
|
||||
this.propagateChange(configuration);
|
||||
}
|
||||
@ -299,7 +283,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
this.configurationValue.bootstrap.lwm2mServer = config.bootstrap.lwm2mServer;
|
||||
this.configurationValue.bootstrap.servers = config.bootstrap.servers;
|
||||
this.configurationValue.clientLwM2mSettings = config.clientLwM2mSettings;
|
||||
this.upDateJsonAllConfig();
|
||||
this.updateModel();
|
||||
}
|
||||
|
||||
@ -327,7 +310,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
}
|
||||
if (isDefinedAndNotNull(keyNameJson)) {
|
||||
this.configurationValue.observeAttr.keyName = this.validateKeyNameObjects(keyNameJson, attributeArray, telemetryArray);
|
||||
this.upDateJsonAllConfig();
|
||||
this.updateKeyNameObjects(objectLwM2MS);
|
||||
}
|
||||
}
|
||||
@ -513,12 +495,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
return (objectsIds.size > 0) ? Array.from(objectsIds) : [];
|
||||
}
|
||||
|
||||
private upDateJsonAllConfig = (): void => {
|
||||
this.lwm2mDeviceConfigFormGroup.patchValue({
|
||||
configurationJson: this.configurationValue
|
||||
}, {emitEvent: false});
|
||||
}
|
||||
|
||||
addObjectsList = (value: ObjectLwM2M[]): void => {
|
||||
this.updateObserveAttrTelemetryObjectFormGroup(value);
|
||||
}
|
||||
@ -536,7 +512,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
|
||||
this.removeKeyNameFromJson(value.keyId);
|
||||
this.removeAttributesFromJson(value.keyId);
|
||||
this.updateObserveAttrTelemetryObjectFormGroup(objectsOld);
|
||||
this.upDateJsonAllConfig();
|
||||
}
|
||||
|
||||
private removeObserveAttrTelemetryFromJson = (observeAttrTel: string, keyId: string): void => {
|
||||
|
||||
@ -1236,14 +1236,12 @@
|
||||
"object-list": "SEznam objektů",
|
||||
"object-list-empty": "Žádné objekty nebyly vybrány.",
|
||||
"no-objects-matching": "Žádné objekty odpovídající '{{object}}' nebyly nalezeny.",
|
||||
"valid-id-instance-no-min": "Instance číslo '{{instance}}' nebyla validována. Mininimální hodnota='{{min}}'",
|
||||
"valid-id-instance-no-max": "Instance číslo '{{instance}}' nebyla validována. Maximální hodnota='{{max}}'",
|
||||
"valid-id-instance": "Instance číslo '{{instance}}' nebyla validována. { count, plural, 1 {Maximální hodnota='{{max}}'} 2 {Minimální hodnota='{{min}}'} other {Musí být pouze číslo} }",
|
||||
"model-tab": "LWM2M model",
|
||||
"add-new-instances": "Přidat nové instance",
|
||||
"instances-list": "Seznam instancí",
|
||||
"instances-input": "Vstupní hodnota Id instance",
|
||||
"instances-input-holder": "Vstupní číslo instance...",
|
||||
"instances-list-required": "Seznam instancí je povinný",
|
||||
"instance-id-pattern": "Instance číslo musí být kladné číslo.",
|
||||
"instance-id-max": "Maximální instance číslo hodnota {{max}}.",
|
||||
"instance": "Instance",
|
||||
"resource-label": "Název zdroje #ID",
|
||||
"observe-label": "Pozorování",
|
||||
@ -1266,7 +1264,6 @@
|
||||
"view-attribute": "Zobrazit atribut",
|
||||
"remove-attribute": "Odebrat atribut",
|
||||
"mode": "Režim konfigurace bezpečnosti",
|
||||
"pattern_hex_dec": "{ count, plural, 0 {musí být v hexadecimálním formátu} other {musí být # znaků} }",
|
||||
"servers": "Servery",
|
||||
"short-id": "Krátké ID",
|
||||
"short-id-required": "Krátké ID je povinné.",
|
||||
@ -1316,8 +1313,8 @@
|
||||
"others-tab": "Ostatní nastavení",
|
||||
"client-strategy": "Strategie klienta při připojování",
|
||||
"client-strategy-label": "Strategie",
|
||||
"client-strategy-connect": "{ count, plural, 1 {1: Klientovi je odeslán pouze observe požadavek po úvodním spojení} other {2: Načti všechny zdroje a observer požadavky na klienta po registraci} }",
|
||||
"client-strategy-tip": "{ count, plural, 1 {Strategie 1: Po úvodním spojení LWM2M klienta, server odešle požadavek Observe zdrojů klientovi, přičemž tyto zdroje existující na straně LWM2M klienta jsou v profilu zařízení označeny jako pozorování.} other {Strategie 2: Po registraci, je klientovi odeslán požadavek na načtení hodnotu všech zdrojů všech objektů, které LWM2M klient má,\n poté: server odešle požadavek observe zdrojů klientovi, přičemž tyto zdroje existující na straně klienta, jsou v profilu zařízení označeny jako pozorování.} }",
|
||||
"client-strategy-only-observe": "Klientovi je odeslán pouze observe požadavek po úvodním spojení",
|
||||
"client-strategy-read-all": "Načti všechny zdroje a observer požadavky na klienta po registraci",
|
||||
"fw-update": "Aktualizace firmware",
|
||||
"fw-update-strategy": "Strategie aktualizace firmware",
|
||||
"fw-update-strategy-data": "Odeslat (push) aktualizaci firmware jako binární soubor pomocí Object 19 a Resource 0 (Data)",
|
||||
|
||||
@ -1273,7 +1273,6 @@
|
||||
"view-attribute": "View attribute",
|
||||
"remove-attribute": "Remove attribute",
|
||||
"mode": "Security config mode",
|
||||
"pattern_hex_dec": "{ count, plural, 0 {must be hex decimal format} other {must be # characters} }",
|
||||
"servers": "Servers",
|
||||
"short-id": "Short ID",
|
||||
"short-id-required": "Short ID is required.",
|
||||
@ -1323,8 +1322,8 @@
|
||||
"others-tab": "Other settings",
|
||||
"client-strategy": "Client strategy when connecting",
|
||||
"client-strategy-label": "Strategy",
|
||||
"client-strategy-connect": "{ count, plural, 1 {1: Only Observe Request to the client after the initial connection} other {2: Read All Resources & Observe Request to the client after registration} }",
|
||||
"client-strategy-tip": "{ count, plural, 1 {Strategy 1: After the initial connection of the LWM2M Client, the server sends Observe resources Request to the client, those resources that are marked as observation in the Device profile and which exist on the LWM2M client.} other {Strategy 2: After the registration, request the client to read all the resource values for all objects that the LWM2M client has,\n then execute: the server sends Observe resources Request to the client, those resources that are marked as observation in the Device profile and which exist on the LWM2M client.} }",
|
||||
"client-strategy-only-observe": "Only Observe Request to the client after the initial connection",
|
||||
"client-strategy-read-all": "Read All Resources & Observe Request to the client after registration",
|
||||
"fw-update": "Firmware update",
|
||||
"fw-update-strategy": "Firmware update strategy",
|
||||
"fw-update-strategy-data": "Push firmware update as binary file using Object 19 and Resource 0 (Data)",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user