diff --git a/ui-ngx/src/app/modules/home/components/profile/device-profile.component.html b/ui-ngx/src/app/modules/home/components/profile/device-profile.component.html index 780d98adfe..4fbc413d98 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device-profile.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/device-profile.component.html @@ -68,6 +68,65 @@ device-profile.description + + device-profile.transport-type + + + {{deviceTransportTypeTranslations.get(type) | translate}} + + + + {{ 'device-profile.transport-type-required' | translate }} + + +
+ + + + +
device-profile.profile-configuration
+
+
+ + +
+ + + +
device-profile.transport-configuration
+
+
+ + +
+ + + +
{{'device-profile.alarm-rules-with-count' | translate: + {count: entityForm.get('profileData.alarms').value ? + entityForm.get('profileData.alarms').value.length : 0} }}
+
+
+ + +
+ + + +
device-profile.device-provisioning
+
+
+ + +
+
+
diff --git a/ui-ngx/src/app/modules/home/components/profile/device-profile.component.ts b/ui-ngx/src/app/modules/home/components/profile/device-profile.component.ts index 38aed4d77a..09223491e1 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device-profile.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device-profile.component.ts @@ -28,10 +28,12 @@ import { DeviceProfile, DeviceProfileData, DeviceProfileType, + deviceProfileTypeConfigurationInfoMap, deviceProfileTypeTranslationMap, DeviceProvisionConfiguration, DeviceProvisionType, DeviceTransportType, + deviceTransportTypeConfigurationInfoMap, deviceTransportTypeTranslationMap } from '@shared/models/device.models'; import { EntityType } from '@shared/models/entity-type.models'; @@ -57,6 +59,10 @@ export class DeviceProfileComponent extends EntityComponent { deviceTransportTypeTranslations = deviceTransportTypeTranslationMap; + displayProfileConfiguration: boolean; + + displayTransportConfiguration: boolean; + constructor(protected store: Store, protected translate: TranslateService, @Optional() @Inject('entity') protected entityValue: DeviceProfile, @@ -74,6 +80,10 @@ export class DeviceProfileComponent extends EntityComponent { } buildForm(entity: DeviceProfile): FormGroup { + this.displayProfileConfiguration = entity && entity.type && + deviceProfileTypeConfigurationInfoMap.get(entity.type).hasProfileConfiguration; + this.displayTransportConfiguration = entity && entity.transportType && + deviceTransportTypeConfigurationInfoMap.get(entity.transportType).hasProfileConfiguration; const deviceProvisionConfiguration: DeviceProvisionConfiguration = { type: entity?.provisionType ? entity?.provisionType : DeviceProvisionType.DISABLED, provisionDeviceKey: entity?.provisionDeviceKey, @@ -116,6 +126,8 @@ export class DeviceProfileComponent extends EntityComponent { private deviceProfileTypeChanged(form: FormGroup) { const deviceProfileType: DeviceProfileType = form.get('type').value; + this.displayProfileConfiguration = deviceProfileType && + deviceProfileTypeConfigurationInfoMap.get(deviceProfileType).hasProfileConfiguration; let profileData: DeviceProfileData = form.getRawValue().profileData; if (!profileData) { profileData = { @@ -129,6 +141,8 @@ export class DeviceProfileComponent extends EntityComponent { private deviceProfileTransportTypeChanged(form: FormGroup) { const deviceTransportType: DeviceTransportType = form.get('transportType').value; + this.displayTransportConfiguration = deviceTransportType && + deviceTransportTypeConfigurationInfoMap.get(deviceTransportType).hasProfileConfiguration; let profileData: DeviceProfileData = form.getRawValue().profileData; if (!profileData) { profileData = { @@ -141,6 +155,10 @@ export class DeviceProfileComponent extends EntityComponent { } updateForm(entity: DeviceProfile) { + this.displayProfileConfiguration = entity.type && + deviceProfileTypeConfigurationInfoMap.get(entity.type).hasProfileConfiguration; + this.displayTransportConfiguration = entity.transportType && + deviceTransportTypeConfigurationInfoMap.get(entity.transportType).hasProfileConfiguration; const deviceProvisionConfiguration: DeviceProvisionConfiguration = { type: entity?.provisionType ? entity?.provisionType : DeviceProvisionType.DISABLED, provisionDeviceKey: entity?.provisionDeviceKey,