Browse Source

clean up ui code

pull/3740/head
ShvaykaD 6 years ago
parent
commit
bec3790164
  1. 6
      ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.ts

6
ui-ngx/src/app/modules/home/components/profile/device/mqtt-device-profile-transport-configuration.component.ts

@ -92,7 +92,7 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control
}); });
let configurationFormGroup = this.mqttDeviceProfileTransportConfigurationFormGroup.controls.configuration as FormGroup; let configurationFormGroup = this.mqttDeviceProfileTransportConfigurationFormGroup.controls.configuration as FormGroup;
configurationFormGroup.get('transportPayloadType').valueChanges.subscribe(payloadType => { configurationFormGroup.get('transportPayloadType').valueChanges.subscribe(payloadType => {
this.onTransportPayloadTypeChanged(payloadType, configurationFormGroup); this.updateTransportPayloadBasedControls(type, configurationFormGroup)
this.mqttDeviceProfileTransportConfigurationFormGroup.updateValueAndValidity(); this.mqttDeviceProfileTransportConfigurationFormGroup.updateValueAndValidity();
}); });
this.mqttDeviceProfileTransportConfigurationFormGroup.valueChanges.subscribe(() => { this.mqttDeviceProfileTransportConfigurationFormGroup.valueChanges.subscribe(() => {
@ -132,10 +132,6 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control
this.propagateChange(configuration); this.propagateChange(configuration);
} }
private onTransportPayloadTypeChanged(type: MqttTransportPayloadType, configurationFormGroup: FormGroup) {
this.updateTransportPayloadBasedControls(type, configurationFormGroup)
}
private updateTransportPayloadBasedControls(type: MqttTransportPayloadType, configurationFormGroup: FormGroup) { private updateTransportPayloadBasedControls(type: MqttTransportPayloadType, configurationFormGroup: FormGroup) {
if (type === MqttTransportPayloadType.PROTOBUF) { if (type === MqttTransportPayloadType.PROTOBUF) {
configurationFormGroup.registerControl('deviceTelemetryProtoSchema', this.fb.control(null, Validators.required)); configurationFormGroup.registerControl('deviceTelemetryProtoSchema', this.fb.control(null, Validators.required));

Loading…
Cancel
Save