MQTTConfiguration.vue
3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<script lang="ts" setup>
import { DeviceRecord } from '/@/api/device/model/deviceModel';
import { useDescription, Description } from '/@/components/Description';
import { Input } from 'ant-design-vue';
import { h } from 'vue';
import { TransportPayloadTypeEnum } from './const';
import { useI18n } from '/@/hooks/web/useI18n';
type TransportConfiguration = DeviceRecord['profileData']['transportConfiguration'];
const props = defineProps<{
record: TransportConfiguration;
}>();
const { t } = useI18n();
const [register] = useDescription({
layout: 'vertical',
column: 2,
data: props.record,
schema: [
{
field: 'type',
label: t('deviceManagement.product.accessProtocolText'),
span: 2,
},
{
field: 'deviceTelemetryTopic',
label: t('deviceManagement.product.telemetryDataSubjectFilterText'),
},
{
field: 'deviceAttributesTopic',
label: t('deviceManagement.product.attributeTopicFilterText'),
},
{
field: 'transportPayloadType',
label: t('deviceManagement.product.deviceMessagePayloadText', { deviceType: 'MQTT' }),
render(_, data: TransportConfiguration) {
return data.transportPayloadTypeConfiguration.transportPayloadType;
},
},
{
field: 'enableCompatibilityWithJsonPayloadFormat',
label: t('deviceManagement.product.enablePayloadCompatibilityText'),
render(_, data: TransportConfiguration) {
return data.transportPayloadTypeConfiguration.enableCompatibilityWithJsonPayloadFormat
? t('deviceManagement.product.enableText')
: t('deviceManagement.product.closeText');
},
},
{
field: 'deviceTelemetryProtoSchema',
label: t('deviceManagement.product.deviceTelemetryProtoSchemaText'),
span: 2,
show: (data: TransportConfiguration) =>
data.transportPayloadTypeConfiguration.transportPayloadType ===
TransportPayloadTypeEnum.PROTOBUF,
render(_, data: TransportConfiguration) {
return h(Input.TextArea, {
autoSize: true,
value: data.transportPayloadTypeConfiguration.deviceTelemetryProtoSchema,
});
},
},
{
field: 'deviceAttributesProtoSchema',
label: t('deviceManagement.product.deviceAttributesProtoSchemaText'),
span: 2,
show: (data: TransportConfiguration) =>
data.transportPayloadTypeConfiguration.transportPayloadType ===
TransportPayloadTypeEnum.PROTOBUF,
render(_, data: TransportConfiguration) {
return h(Input.TextArea, {
autoSize: true,
value: data.transportPayloadTypeConfiguration.deviceAttributesProtoSchema,
});
},
},
{
field: 'deviceRpcRequestProtoSchema',
label: t('deviceManagement.product.deviceRpcRequestProtoSchemaText'),
span: 2,
show: (data: TransportConfiguration) =>
data.transportPayloadTypeConfiguration.transportPayloadType ===
TransportPayloadTypeEnum.PROTOBUF,
render(_, data: TransportConfiguration) {
return h(Input.TextArea, {
autoSize: true,
value: data.transportPayloadTypeConfiguration.deviceRpcRequestProtoSchema,
});
},
},
{
field: 'deviceRpcResponseProtoSchema',
label: t('deviceManagement.product.deviceRpcResponseProtoSchemaText'),
span: 2,
show: (data: TransportConfiguration) =>
data.transportPayloadTypeConfiguration.transportPayloadType ===
TransportPayloadTypeEnum.PROTOBUF,
render(_, data: TransportConfiguration) {
return h(Input.TextArea, {
autoSize: true,
value: data.transportPayloadTypeConfiguration.deviceRpcResponseProtoSchema,
});
},
},
],
});
</script>
<template>
<Description @register="register" />
</template>