Showing
1 changed file
with
23 additions
and
6 deletions
@@ -265,12 +265,29 @@ | @@ -265,12 +265,29 @@ | ||
265 | delete allPostForm.id; | 265 | delete allPostForm.id; |
266 | } | 266 | } |
267 | }; | 267 | }; |
268 | - const setClientProperties = (record: Recordable) => { | 268 | + const setConfiguration = (record: Recordable) => { |
269 | const type = Reflect.get(record, 'type'); | 269 | const type = Reflect.get(record, 'type'); |
270 | - if (type === 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode') return; | ||
271 | const configuration = Reflect.get(record, 'configuration'); | 270 | const configuration = Reflect.get(record, 'configuration'); |
272 | const clientProperties = Reflect.get(configuration, 'clientProperties'); | 271 | const clientProperties = Reflect.get(configuration, 'clientProperties'); |
273 | - !clientProperties && record.configuration && (record.configuration.clientProperties = {}); | 272 | + console.log(clientProperties); |
273 | + !clientProperties && (record.configuration.clientProperties = {}); | ||
274 | + | ||
275 | + if ( | ||
276 | + type === 'org.thingsboard.rule.engine.mqtt.TbMqttNode' || | ||
277 | + type === 'org.thingsboard.rule.engine.kafka.TbKafkaNode' || | ||
278 | + type === 'org.thingsboard.rule.engine.rest.TbRestApiCallNode' | ||
279 | + ) { | ||
280 | + Reflect.deleteProperty(configuration, 'clientProperties'); | ||
281 | + } | ||
282 | + | ||
283 | + if (type === 'org.thingsboard.rule.engine.kafka.TbKafkaNode') { | ||
284 | + configuration.kafkaHeadersCharset = 'UTF-8'; | ||
285 | + } | ||
286 | + | ||
287 | + if (type === 'org.thingsboard.rule.engine.rabbitmq.TbRabbitMqNode') { | ||
288 | + configuration.exchangeNamePattern = configuration.exchangeNamePattern || ''; | ||
289 | + configuration.routingKeyPattern = configuration.routingKeyPattern || ''; | ||
290 | + } | ||
274 | }; | 291 | }; |
275 | 292 | ||
276 | const handleSubmit = async (closeModalAfterSuccess = true) => { | 293 | const handleSubmit = async (closeModalAfterSuccess = true) => { |
@@ -292,7 +309,7 @@ | @@ -292,7 +309,7 @@ | ||
292 | if (isApiHeaders && Object.values(isApiHeaders).includes('')) { | 309 | if (isApiHeaders && Object.values(isApiHeaders).includes('')) { |
293 | return createMessage.error('请填写属性'); | 310 | return createMessage.error('请填写属性'); |
294 | } | 311 | } |
295 | - setClientProperties(allPostForm); | 312 | + setConfiguration(allPostForm); |
296 | const res = await postAddConvertApi(allPostForm); | 313 | const res = await postAddConvertApi(allPostForm); |
297 | if (res) { | 314 | if (res) { |
298 | closeModalAfterSuccess && closeModal(); | 315 | closeModalAfterSuccess && closeModal(); |
@@ -321,8 +338,8 @@ | @@ -321,8 +338,8 @@ | ||
321 | datasourceType: allPostForm.datasourceType, | 338 | datasourceType: allPostForm.datasourceType, |
322 | datasourceContent: allPostForm.datasourceContent, | 339 | datasourceContent: allPostForm.datasourceContent, |
323 | }); | 340 | }); |
324 | - setClientProperties(allPostForm); | ||
325 | - setClientProperties(noEditObj); | 341 | + setConfiguration(allPostForm); |
342 | + setConfiguration(noEditObj); | ||
326 | const res = await postAddConvertApi(isEdit.value ? noEditObj : allPostForm); | 343 | const res = await postAddConvertApi(isEdit.value ? noEditObj : allPostForm); |
327 | if (res) { | 344 | if (res) { |
328 | closeModalAfterSuccess && closeModal(); | 345 | closeModalAfterSuccess && closeModal(); |