create.config.ts
3.35 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
import { MqttFieldsEnum, MqttFieldsNameEnum } from '../../../enum/formField/external';
import { CredentialsCard } from './CredentialsCard';
import { FormSchema, useComponentRegister } from '/@/components/Form';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
useComponentRegister('CredentialsCard', CredentialsCard);
export const formSchemas: FormSchema[] = [
{
field: MqttFieldsEnum.TOPIC_PATTERN,
label: t(MqttFieldsNameEnum.TOPIC_PATTERN),
component: 'Input',
helpMessage:
'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body',
required: true,
componentProps: {
placeholder: `请输入${t(MqttFieldsNameEnum.TOPIC_PATTERN)}`,
},
},
{
field: MqttFieldsEnum.HOST,
label: t(MqttFieldsNameEnum.HOST),
component: 'Input',
required: true,
colProps: { span: 8 },
componentProps: {
placeholder: `请输入${t(MqttFieldsNameEnum.HOST)}`,
},
},
{
field: MqttFieldsEnum.PORT,
label: t(MqttFieldsNameEnum.PORT),
component: 'InputNumber',
required: true,
colProps: { span: 8 },
componentProps: {
placeholder: `请输入${t(MqttFieldsNameEnum.PORT)}`,
},
},
{
field: MqttFieldsEnum.CONNECT_TIMEOUT_SEC,
label: t(MqttFieldsNameEnum.CONNECT_TIMEOUT_SEC),
component: 'Input',
required: true,
colProps: { span: 8 },
componentProps: {
placeholder: `请输入${t(MqttFieldsNameEnum.CONNECT_TIMEOUT_SEC)}`,
},
},
{
field: MqttFieldsEnum.CLIENT_ID,
label: t(MqttFieldsNameEnum.CLIENT_ID),
component: 'Input',
helpMessage:
'Hint: Optional. Leave empty for auto-generated Client ID. Be careful when specifying the Client ID. Majority of the MQTT brokers will not allow multiple connections with the same Client ID. To connect to such brokers, your mqtt Client ID must be unique. When platform is running in a micro-services mode, the copy of rule node is launched in each micro-service. This will automatically lead to multiple mqtt clients with the same ID and may cause failures of the rule node. To avoid such failures enable "Add Service ID as suffix to Client ID" option below.',
componentProps: {
placeholder: `请输入${t(MqttFieldsNameEnum.TOPIC_PATTERN)}`,
},
},
{
field: MqttFieldsEnum.APPEND_CLIENT_ID_SUFFIX,
label: t(MqttFieldsNameEnum.APPEND_CLIENT_ID_SUFFIX),
component: 'Checkbox',
renderComponentContent: () => ({
default: () =>
'提示: 可选项。当明确指定“客户端ID”时。如果选中,则服务ID将作为后缀添加到客户端ID中。有助于避免平台在微服务模式下运行时出现故障。',
}),
componentProps: ({ formModel }) => {
const clientId = formModel[MqttFieldsEnum.CLIENT_ID];
return {
disabled: !clientId,
};
},
},
{
field: MqttFieldsEnum.CLEAN_SESSION,
label: '',
component: 'Checkbox',
renderComponentContent: () => ({
default: () => t(MqttFieldsNameEnum.CLEAN_SESSION),
}),
},
{
field: MqttFieldsEnum.SSL,
label: '',
component: 'Checkbox',
renderComponentContent: () => ({
default: () => t(MqttFieldsNameEnum.SSL),
}),
},
{
field: MqttFieldsEnum.CREDENTIALS,
label: t(MqttFieldsNameEnum.CREDENTIALS),
component: 'CredentialsCard',
slot: MqttFieldsEnum.CREDENTIALS,
},
];