|
|
|
@ -92,6 +92,7 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control |
|
|
|
this.mqttDeviceProfileTransportConfigurationFormGroup = this.fb.group({ |
|
|
|
deviceAttributesTopic: [null, [Validators.required, this.validationMQTTTopic()]], |
|
|
|
deviceTelemetryTopic: [null, [Validators.required, this.validationMQTTTopic()]], |
|
|
|
sparkPlug: [false], |
|
|
|
sendAckOnValidationException: [false, Validators.required], |
|
|
|
transportPayloadTypeConfiguration: this.fb.group({ |
|
|
|
transportPayloadType: [TransportPayloadType.JSON, Validators.required], |
|
|
|
@ -102,7 +103,7 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control |
|
|
|
enableCompatibilityWithJsonPayloadFormat: [false, Validators.required], |
|
|
|
useJsonPayloadFormatForDefaultDownlinkTopics: [false, Validators.required] |
|
|
|
}) |
|
|
|
}, {validator: this.uniqueDeviceTopicValidator} |
|
|
|
}, {validators: this.uniqueDeviceTopicValidator} |
|
|
|
); |
|
|
|
this.mqttDeviceProfileTransportConfigurationFormGroup.get('transportPayloadTypeConfiguration.transportPayloadType').valueChanges.pipe( |
|
|
|
takeUntil(this.destroy$) |
|
|
|
@ -117,6 +118,16 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control |
|
|
|
.patchValue(false, {emitEvent: false}); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.mqttDeviceProfileTransportConfigurationFormGroup.get('sparkPlug').valueChanges.pipe( |
|
|
|
takeUntil(this.destroy$) |
|
|
|
).subscribe((value) => { |
|
|
|
if (value) { |
|
|
|
this.mqttDeviceProfileTransportConfigurationFormGroup.disable({emitEvent: false}); |
|
|
|
this.mqttDeviceProfileTransportConfigurationFormGroup.get('sparkPlug').enable({emitEvent: false}); |
|
|
|
} else { |
|
|
|
this.mqttDeviceProfileTransportConfigurationFormGroup.enable({emitEvent: false}); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.mqttDeviceProfileTransportConfigurationFormGroup.valueChanges.pipe( |
|
|
|
takeUntil(this.destroy$) |
|
|
|
).subscribe(() => { |
|
|
|
@ -135,6 +146,7 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control |
|
|
|
this.mqttDeviceProfileTransportConfigurationFormGroup.disable({emitEvent: false}); |
|
|
|
} else { |
|
|
|
this.mqttDeviceProfileTransportConfigurationFormGroup.enable({emitEvent: false}); |
|
|
|
this.mqttDeviceProfileTransportConfigurationFormGroup.get('sparkPlug').updateValueAndValidity({onlySelf: true}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -157,7 +169,7 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control |
|
|
|
private updateModel() { |
|
|
|
let configuration: DeviceProfileTransportConfiguration = null; |
|
|
|
if (this.mqttDeviceProfileTransportConfigurationFormGroup.valid) { |
|
|
|
configuration = this.mqttDeviceProfileTransportConfigurationFormGroup.value; |
|
|
|
configuration = this.mqttDeviceProfileTransportConfigurationFormGroup.getRawValue(); |
|
|
|
configuration.type = DeviceTransportType.MQTT; |
|
|
|
} |
|
|
|
this.propagateChange(configuration); |
|
|
|
|