ui updates
This commit is contained in:
parent
e334def935
commit
37c381996e
@ -36,7 +36,6 @@ public class MqttTransportConfigurationDeserializer extends StdDeserializer<Mqtt
|
||||
public MqttDeviceProfileTransportConfiguration deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
|
||||
try {
|
||||
JsonNode jsonNode = jsonParser.readValueAsTree();
|
||||
|
||||
if (jsonNode.hasNonNull("transportPayloadType") && jsonNode.get("transportPayloadType").asText().equals(TransportPayloadType.PROTOBUF.name())) {
|
||||
return jsonParser.getCodec().treeToValue(jsonNode, MqttProtoDeviceProfileTransportConfiguration.class);
|
||||
} else {
|
||||
|
||||
@ -111,6 +111,12 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control
|
||||
|
||||
writeValue(value: MqttDeviceProfileTransportConfiguration | null): void {
|
||||
if (isDefinedAndNotNull(value)) {
|
||||
let configurationFormGroup = this.mqttDeviceProfileTransportConfigurationFormGroup.controls.configuration as FormGroup;
|
||||
let payloadType = value.transportPayloadType;
|
||||
if (payloadType === MqttTransportPayloadType.PROTOBUF) {
|
||||
configurationFormGroup.registerControl('deviceTelemetryProtoSchema', this.fb.control(null, Validators.required));
|
||||
configurationFormGroup.registerControl('deviceAttributesProtoSchema', this.fb.control(null, Validators.required));
|
||||
}
|
||||
this.mqttDeviceProfileTransportConfigurationFormGroup.patchValue({configuration: value}, {emitEvent: false});
|
||||
}
|
||||
}
|
||||
@ -121,9 +127,10 @@ export class MqttDeviceProfileTransportConfigurationComponent implements Control
|
||||
configuration = this.mqttDeviceProfileTransportConfigurationFormGroup.getRawValue().configuration;
|
||||
configuration.type = DeviceTransportType.MQTT;
|
||||
let configurationFormGroup = this.mqttDeviceProfileTransportConfigurationFormGroup.controls.configuration as FormGroup;
|
||||
if (configuration.transportPayloadType === MqttTransportPayloadType.PROTOBUF) {
|
||||
configurationFormGroup.addControl('deviceTelemetryProtoSchema', this.fb.control(null, Validators.required));
|
||||
configurationFormGroup.addControl('deviceAttributesProtoSchema', this.fb.control(null, Validators.required));
|
||||
let transportPayloadType = configuration.transportPayloadType;
|
||||
if (transportPayloadType === MqttTransportPayloadType.PROTOBUF) {
|
||||
configurationFormGroup.registerControl('deviceTelemetryProtoSchema', this.fb.control(null, Validators.required));
|
||||
configurationFormGroup.registerControl('deviceAttributesProtoSchema', this.fb.control(null, Validators.required));
|
||||
} else {
|
||||
configurationFormGroup.removeControl('deviceTelemetryProtoSchema');
|
||||
configurationFormGroup.removeControl('deviceAttributesProtoSchema');
|
||||
|
||||
@ -148,6 +148,7 @@ export interface DefaultDeviceProfileTransportConfiguration {
|
||||
export interface MqttDeviceProfileTransportConfiguration {
|
||||
deviceTelemetryTopic?: string;
|
||||
deviceAttributesTopic?: string;
|
||||
transportPayloadType?: MqttTransportPayloadType;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user