diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html index cfbd1f304e..5e444f8ee2 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html @@ -23,11 +23,9 @@ diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts index a6e57abe4f..7dfa93da5a 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts @@ -50,7 +50,7 @@ import { TELEMETRY } from './lwm2m-profile-config.models'; import { DeviceProfileService } from '@core/http/device-profile.service'; -import { deepClone, isDefinedAndNotNull, isEmpty } from '@core/utils'; +import { deepClone, isDefinedAndNotNull, isEmpty, isUndefined } from '@core/utils'; import { JsonArray, JsonObject } from '@angular/compiler-cli/ngcc/src/packages/entry_point'; import { Direction } from '@shared/models/page/sort-order'; import _ from 'lodash'; @@ -100,8 +100,8 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro constructor(private fb: FormBuilder, private deviceProfileService: DeviceProfileService) { this.lwm2mDeviceProfileFormGroup = this.fb.group({ - objectIds: [null, Validators.required], - observeAttrTelemetry: [null, Validators.required], + objectIds: [null], + observeAttrTelemetry: [null], bootstrap: this.fb.group({ servers: this.fb.group({ binding: [DEFAULT_BINDING], @@ -183,7 +183,8 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro async writeValue(value: Lwm2mProfileConfigModels | null) { if (isDefinedAndNotNull(value) && (value?.clientLwM2mSettings || value?.observeAttr || value?.bootstrap)) { this.configurationValue = value; - const defaultFormSettings = !(value.observeAttr.attribute.length && value.observeAttr.telemetry.length); + const defaultFormSettings = value.clientLwM2mSettings.fwUpdateStrategy === 1 && + isUndefined(value.clientLwM2mSettings.fwUpdateResource); if (defaultFormSettings) { await this.defaultProfileConfig(); } diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.html b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.html index 6ca38b5fb5..46004504b4 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.html @@ -44,9 +44,14 @@ - - {{ 'device-profile.lwm2m.no-objects-matching' | translate: {object: searchText} }} - +
+ device-profile.lwm2m.no-objects-found +
+ + + {{ 'device-profile.lwm2m.no-objects-matching' | translate:{object: truncate.transform(searchText, true, 6, '...')} }} + +
diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts index c3f84b74dc..56c881be38 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-object-list.component.ts @@ -33,6 +33,7 @@ import { DeviceProfileService } from '@core/http/device-profile.service'; import { Direction } from '@shared/models/page/sort-order'; import { isDefined, isDefinedAndNotNull, isString } from '@core/utils'; import { PageLink } from '@shared/models/page/page-link'; +import { TruncatePipe } from '@shared/pipe/truncate.pipe'; @Component({ selector: 'tb-profile-lwm2m-object-list', @@ -82,7 +83,8 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V private propagateChange = (v: any) => { } - constructor(private deviceProfileService: DeviceProfileService, + constructor(public truncate: TruncatePipe, + private deviceProfileService: DeviceProfileService, private fb: FormBuilder) { this.lwm2mListFormGroup = this.fb.group({ objectsList: [this.objectsList], @@ -196,6 +198,10 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V } } + textIsNotEmpty(text: string): boolean { + return (text && text.length > 0); + } + private clear(value = '', emitEvent = true) { this.objectInput.nativeElement.value = value; this.lwm2mListFormGroup.get('objectLwm2m').patchValue(value, {emitEvent}); diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-profile-config.models.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-profile-config.models.ts index ab4fea8b40..2eb83a49c0 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-profile-config.models.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-profile-config.models.ts @@ -164,8 +164,8 @@ export interface ClientLwM2mSettings { clientOnlyObserveAfterConnect: number; fwUpdateStrategy: number; swUpdateStrategy: number; - fwUpdateResource: string; - swUpdateResource: string; + fwUpdateResource?: string; + swUpdateResource?: string; powerMode: PowerMode; edrxCycle?: number; pagingTransmissionWindow?: number; @@ -178,7 +178,7 @@ export interface ObservableAttributes { attribute: string[]; telemetry: string[]; keyName: {}; - attributeLwm2m?: AttributesNameValueMap[]; + attributeLwm2m: AttributesNameValueMap; } export function getDefaultBootstrapServersSecurityConfig(): BootstrapServersSecurityConfig { @@ -193,13 +193,13 @@ export function getDefaultBootstrapServersSecurityConfig(): BootstrapServersSecu export function getDefaultBootstrapServerSecurityConfig(): ServerSecurityConfig { return { + bootstrapServerAccountTimeout: DEFAULT_BOOTSTRAP_SERVER_ACCOUNT_TIME_OUT, + clientHoldOffTime: DEFAULT_CLIENT_HOLD_OFF_TIME, host: DEFAULT_LOCAL_HOST_NAME, port: DEFAULT_PORT_BOOTSTRAP_NO_SEC, securityMode: securityConfigMode.NO_SEC, - serverPublicKey: '', - clientHoldOffTime: DEFAULT_CLIENT_HOLD_OFF_TIME, serverId: DEFAULT_ID_BOOTSTRAP, - bootstrapServerAccountTimeout: DEFAULT_BOOTSTRAP_SERVER_ACCOUNT_TIME_OUT + serverPublicKey: '' }; } @@ -216,7 +216,7 @@ export function getDefaultProfileObserveAttrConfig(): ObservableAttributes { attribute: [], telemetry: [], keyName: {}, - attributeLwm2m: [] + attributeLwm2m: {} }; } @@ -225,8 +225,6 @@ export function getDefaultProfileClientLwM2mSettingsConfig(): ClientLwM2mSetting clientOnlyObserveAfterConnect: 1, fwUpdateStrategy: 1, swUpdateStrategy: 1, - fwUpdateResource: DEFAULT_FW_UPDATE_RESOURCE, - swUpdateResource: DEFAULT_SW_UPDATE_RESOURCE, powerMode: PowerMode.DRX, compositeOperationsSupport: false }; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index c954e03274..04fcecb694 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1244,6 +1244,7 @@ "lwm2m": { "object-list": "Object list", "object-list-empty": "No objects selected.", + "no-objects-found": "No objects found.", "no-objects-matching": "No objects matching '{{object}}' were found.", "model-tab": "LWM2M Model", "add-new-instances": "Add new instances",