rockfang commented on issue #16084:
URL: 
https://github.com/apache/dolphinscheduler/issues/16084#issuecomment-2136667764

   I found this problem too.
   Here is the reason:
   1. frontend submit `serverPort` field value type is **number**.when creating 
an alert-instance by `alert-plugin-instances` api
   
![image](https://github.com/apache/dolphinscheduler/assets/16065427/603c4095-91df-4574-8645-cafc31b34bbc)
   2. frontend query alert plugin instances by 
`alert-plugin-instances?pageNo=1&pageSize=10` api. `serverPort` field value 
type becomes to **string**
   
![image](https://github.com/apache/dolphinscheduler/assets/16065427/e84aa9e0-5d1d-49f3-b8f2-8b7872e723f2)
   3. the data in the database is string
   
![image](https://github.com/apache/dolphinscheduler/assets/16065427/8b240bc6-fd2b-4b43-b0f4-082e326b20a6)
   conclusion:the number type data changed to string when backend processing it.
   
   My solution:
   
![image](https://github.com/apache/dolphinscheduler/assets/16065427/50c27595-909c-45c2-91ed-680f85d72d6a)
   
   
   **原因分析:**
   1. 前端创建实例时提交的serverPort字段值是数字
   
![image](https://github.com/apache/dolphinscheduler/assets/16065427/603c4095-91df-4574-8645-cafc31b34bbc)
   2. 查询实例列表时,解析出的serverPort字段值编程了字符串
   
![image](https://github.com/apache/dolphinscheduler/assets/16065427/e84aa9e0-5d1d-49f3-b8f2-8b7872e723f2)
   3. 实际库中存的是字符串
   
![image](https://github.com/apache/dolphinscheduler/assets/16065427/8b240bc6-fd2b-4b43-b0f4-082e326b20a6)
   结论:后端在处理告警实例参数时,把数字类型的序列化成了字符串存储
   **我的解决方案:**
   A: 后端针对这些number类型字段保存为json时要确保类型依然是number
   B: 前端拿到数据自行处理
   
   **针对方式B, 后端代码不变,前端如何处理**?
   统一把字段信息中type为`number`的条目,把value手动转成number
   
![image](https://github.com/apache/dolphinscheduler/assets/16065427/6f732555-6fe2-4b98-b9de-d931aa1b63ce)
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to