Showing
7 changed files
with
51 additions
and
27 deletions
@@ -42,7 +42,7 @@ export const modeApiForm: FormSchema[] = [ | @@ -42,7 +42,7 @@ export const modeApiForm: FormSchema[] = [ | ||
42 | required: true, | 42 | required: true, |
43 | component: 'Input', | 43 | component: 'Input', |
44 | componentProps: { | 44 | componentProps: { |
45 | - maxLength: 255, | 45 | + maxLength: 32, |
46 | placeholder: '请输入名称', | 46 | placeholder: '请输入名称', |
47 | }, | 47 | }, |
48 | }, | 48 | }, |
@@ -45,7 +45,7 @@ export const modelKafkaForm: FormSchema[] = [ | @@ -45,7 +45,7 @@ export const modelKafkaForm: FormSchema[] = [ | ||
45 | required: true, | 45 | required: true, |
46 | component: 'Input', | 46 | component: 'Input', |
47 | componentProps: { | 47 | componentProps: { |
48 | - maxLength: 255, | 48 | + maxLength: 32, |
49 | placeholder: '请输入名称', | 49 | placeholder: '请输入名称', |
50 | }, | 50 | }, |
51 | }, | 51 | }, |
@@ -152,12 +152,14 @@ export const modelKafkaForm: FormSchema[] = [ | @@ -152,12 +152,14 @@ export const modelKafkaForm: FormSchema[] = [ | ||
152 | field: 'otherProperties', | 152 | field: 'otherProperties', |
153 | label: '其他属性', | 153 | label: '其他属性', |
154 | colProps: { span: 24 }, | 154 | colProps: { span: 24 }, |
155 | + defaultValue: {}, | ||
155 | component: 'JAddInput', | 156 | component: 'JAddInput', |
156 | }, | 157 | }, |
157 | { | 158 | { |
158 | field: 'addMetadataKeyValuesAsKafkaHeaders', | 159 | field: 'addMetadataKeyValuesAsKafkaHeaders', |
159 | label: '是否启用', | 160 | label: '是否启用', |
160 | colProps: { span: 12 }, | 161 | colProps: { span: 12 }, |
162 | + defaultValue: false, | ||
161 | component: 'Checkbox', | 163 | component: 'Checkbox', |
162 | renderComponentContent: '将消息的元数据以键值对的方式添加到Kafka消息头中', | 164 | renderComponentContent: '将消息的元数据以键值对的方式添加到Kafka消息头中', |
163 | }, | 165 | }, |
@@ -32,9 +32,9 @@ | @@ -32,9 +32,9 @@ | ||
32 | import { modelFormPublicConfig } from '../../../dataflowmodal/config'; | 32 | import { modelFormPublicConfig } from '../../../dataflowmodal/config'; |
33 | 33 | ||
34 | const credentialsFile = reactive({ | 34 | const credentialsFile = reactive({ |
35 | - caCertFileName: '', | ||
36 | - certFileName: '', | ||
37 | - privateKeyFileName: '', | 35 | + caCertFileName: undefined, |
36 | + certFileName: undefined, | ||
37 | + privateKeyFileName: undefined, | ||
38 | }); | 38 | }); |
39 | 39 | ||
40 | const [register, { validateFields, setFieldsValue, resetFields }] = useForm({ | 40 | const [register, { validateFields, setFieldsValue, resetFields }] = useForm({ |
@@ -31,7 +31,7 @@ export const modeMqttForm: FormSchema[] = [ | @@ -31,7 +31,7 @@ export const modeMqttForm: FormSchema[] = [ | ||
31 | component: 'Input', | 31 | component: 'Input', |
32 | required: true, | 32 | required: true, |
33 | componentProps: { | 33 | componentProps: { |
34 | - maxLength: 255, | 34 | + maxLength: 32, |
35 | placeholder: '请输入名称', | 35 | placeholder: '请输入名称', |
36 | }, | 36 | }, |
37 | }, | 37 | }, |
@@ -12,6 +12,7 @@ class RabbitMqFormPartialConfig { | @@ -12,6 +12,7 @@ class RabbitMqFormPartialConfig { | ||
12 | static password = 'guest'; //密码 | 12 | static password = 'guest'; //密码 |
13 | static connectionTimeout = 60000; //连接超时(毫秒) | 13 | static connectionTimeout = 60000; //连接超时(毫秒) |
14 | static handshakeTimeout = 10000; //握手超时(毫秒) | 14 | static handshakeTimeout = 10000; //握手超时(毫秒) |
15 | + static automaticRecoveryEnabled = false; | ||
15 | 16 | ||
16 | //anonymous Select options配置 | 17 | //anonymous Select options配置 |
17 | static getMessageProperties() { | 18 | static getMessageProperties() { |
@@ -34,7 +35,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -34,7 +35,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
34 | required: true, | 35 | required: true, |
35 | component: 'Input', | 36 | component: 'Input', |
36 | componentProps: { | 37 | componentProps: { |
37 | - maxLength: 255, | 38 | + maxLength: 32, |
38 | placeholder: '请输入名称', | 39 | placeholder: '请输入名称', |
39 | }, | 40 | }, |
40 | }, | 41 | }, |
@@ -43,6 +44,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -43,6 +44,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
43 | label: '交换名称模式', | 44 | label: '交换名称模式', |
44 | colProps: { span: 12 }, | 45 | colProps: { span: 12 }, |
45 | component: 'Input', | 46 | component: 'Input', |
47 | + defaultValue: '', | ||
46 | componentProps: { | 48 | componentProps: { |
47 | maxLength: 255, | 49 | maxLength: 255, |
48 | placeholder: '请输入模式', | 50 | placeholder: '请输入模式', |
@@ -52,6 +54,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -52,6 +54,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
52 | field: 'routingKeyPattern', | 54 | field: 'routingKeyPattern', |
53 | label: '路由密钥模式', | 55 | label: '路由密钥模式', |
54 | colProps: { span: 12 }, | 56 | colProps: { span: 12 }, |
57 | + defaultValue: '', | ||
55 | component: 'Input', | 58 | component: 'Input', |
56 | componentProps: { | 59 | componentProps: { |
57 | maxLength: 255, | 60 | maxLength: 255, |
@@ -63,6 +66,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -63,6 +66,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
63 | component: 'Select', | 66 | component: 'Select', |
64 | label: '消息属性', | 67 | label: '消息属性', |
65 | colProps: { span: 12 }, | 68 | colProps: { span: 12 }, |
69 | + defaultValue: null, | ||
66 | componentProps: { | 70 | componentProps: { |
67 | placeholder: '请选择消息属性', | 71 | placeholder: '请选择消息属性', |
68 | options: RabbitMqFormPartialConfig.getMessageProperties(), | 72 | options: RabbitMqFormPartialConfig.getMessageProperties(), |
@@ -129,6 +133,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -129,6 +133,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
129 | field: 'automaticRecoveryEnabled', | 133 | field: 'automaticRecoveryEnabled', |
130 | label: '是否启用', | 134 | label: '是否启用', |
131 | colProps: { span: 12 }, | 135 | colProps: { span: 12 }, |
136 | + defaultValue: RabbitMqFormPartialConfig.automaticRecoveryEnabled, | ||
132 | component: 'Checkbox', | 137 | component: 'Checkbox', |
133 | renderComponentContent: '自动恢复', | 138 | renderComponentContent: '自动恢复', |
134 | }, | 139 | }, |
@@ -159,6 +164,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -159,6 +164,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
159 | label: '客户端属性', | 164 | label: '客户端属性', |
160 | colProps: { span: 24 }, | 165 | colProps: { span: 24 }, |
161 | component: 'JAddInput', | 166 | component: 'JAddInput', |
167 | + defaultValue: {}, | ||
162 | }, | 168 | }, |
163 | { | 169 | { |
164 | field: 'description', | 170 | field: 'description', |
@@ -82,6 +82,14 @@ | @@ -82,6 +82,14 @@ | ||
82 | setValue(record); | 82 | setValue(record); |
83 | }); | 83 | }); |
84 | 84 | ||
85 | + // 判断转换方式 | ||
86 | + const isRabbitmq = (type) => { | ||
87 | + return type == 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode'; | ||
88 | + }; | ||
89 | + const isKafka = (type) => { | ||
90 | + return type == 'org.thingsboard.rule.engine.kafka.TbKafkaNode'; | ||
91 | + }; | ||
92 | + | ||
85 | const handleSubmit = async (closeModalAfterSuccess = true) => { | 93 | const handleSubmit = async (closeModalAfterSuccess = true) => { |
86 | try { | 94 | try { |
87 | if (closeModalAfterSuccess) { | 95 | if (closeModalAfterSuccess) { |
@@ -98,26 +106,30 @@ | @@ -98,26 +106,30 @@ | ||
98 | getDataFlowParams?.clientProperties | 106 | getDataFlowParams?.clientProperties |
99 | ); | 107 | ); |
100 | const data = getValue(description, name, getDataFlowMethod, getDataFlowParams); | 108 | const data = getValue(description, name, getDataFlowMethod, getDataFlowParams); |
101 | - const { caCertFileName, certFileName, privateKeyFileName } = getDataFlowParams.credentials; | ||
102 | const configuration = { | 109 | const configuration = { |
103 | - topicPattern: getDataFlowParams.topicPattern, | ||
104 | - host: getDataFlowParams.host, | ||
105 | - port: getDataFlowParams.port, | ||
106 | - connectTimeoutSec: getDataFlowParams.connectTimeoutSec, | ||
107 | - clientId: getDataFlowParams.clientId ? getDataFlowParams.clientId : null, | ||
108 | - cleanSession: getDataFlowParams.cleanSession, | ||
109 | - ssl: getDataFlowParams.ssl, | ||
110 | - appendClientIdSuffix: getDataFlowParams.appendClientIdSuffix, | ||
111 | - credentials: { | ||
112 | - type: getDataFlowParams.type, | ||
113 | - caCertFileName: caCertFileName ? caCertFileName : undefined, | ||
114 | - certFileName: certFileName ? certFileName : undefined, | ||
115 | - privateKeyFileName: privateKeyFileName ? privateKeyFileName : undefined, | ||
116 | - username: getDataFlowParams.username ? getDataFlowParams.username : undefined, | ||
117 | - password: getDataFlowParams.password ? getDataFlowParams.password : undefined, | ||
118 | - }, | 110 | + ...getDataFlowParams, |
111 | + clientId: !isKafka(getDataFlowMethod?.type) | ||
112 | + ? getDataFlowParams.clientId | ||
113 | + ? getDataFlowParams.clientId | ||
114 | + : null | ||
115 | + : undefined, | ||
116 | + kafkaHeadersCharset: isKafka(getDataFlowMethod?.type) | ||
117 | + ? getDataFlowParams?.kafkaHeadersCharset | ||
118 | + ? getDataFlowParams?.kafkaHeadersCharset | ||
119 | + : 'UTF-8' | ||
120 | + : undefined, | ||
121 | + credentials: !isKafka(getDataFlowMethod?.type) | ||
122 | + ? { | ||
123 | + ...getDataFlowParams.credentials, | ||
124 | + type: getDataFlowParams.type, | ||
125 | + username: getDataFlowParams.username ? getDataFlowParams.username : undefined, | ||
126 | + password: getDataFlowParams.password ? getDataFlowParams.password : undefined, | ||
127 | + } | ||
128 | + : undefined, | ||
119 | }; | 129 | }; |
120 | - const rest = await postAddConvertApi({ ...restData.data, ...data, configuration }); | 130 | + const rest = isRabbitmq(getDataFlowMethod?.type) |
131 | + ? await postAddConvertApi({ ...restData.data, ...data }) | ||
132 | + : await postAddConvertApi({ ...restData.data, ...data, configuration }); | ||
121 | if (rest) { | 133 | if (rest) { |
122 | closeModalAfterSuccess && createMessage.success(`${businessText.value}成功`); | 134 | closeModalAfterSuccess && createMessage.success(`${businessText.value}成功`); |
123 | closeModalAfterSuccess && closeModal(); | 135 | closeModalAfterSuccess && closeModal(); |
@@ -60,13 +60,17 @@ export const searchSchedueFormSchema: FormSchema[] = [ | @@ -60,13 +60,17 @@ export const searchSchedueFormSchema: FormSchema[] = [ | ||
60 | value: EJobGroup.DEFAULT, | 60 | value: EJobGroup.DEFAULT, |
61 | }, | 61 | }, |
62 | { | 62 | { |
63 | - label: '任务中心', | ||
64 | - value: EJobGroup.TASK_CENTER, | 63 | + label: '系统', |
64 | + value: EJobGroup.SYSTEM, | ||
65 | }, | 65 | }, |
66 | { | 66 | { |
67 | label: '报表', | 67 | label: '报表', |
68 | value: EJobGroup.REPORT, | 68 | value: EJobGroup.REPORT, |
69 | }, | 69 | }, |
70 | + { | ||
71 | + label: '任务中心', | ||
72 | + value: EJobGroup.TASK_CENTER, | ||
73 | + }, | ||
70 | ], | 74 | ], |
71 | placeholder: '请选择任务组名', | 75 | placeholder: '请选择任务组名', |
72 | }, | 76 | }, |