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