feat: 支持HTTP回调 --story=132632590#681
feat: 支持HTTP回调 --story=132632590#681Mianhuatang8 wants to merge 3 commits intoTencentBlueKing:developfrom
Conversation
# Reviewed, transaction id: 78200
There was a problem hiding this comment.
Code Review Summary
本 PR 实现了 HTTP 回调功能,整体结构清晰,前端组件拆分合理。以下是审查发现的几个问题:
🚨 Critical
formData.labels属性已重命名为template_labels,但editLabelConfirm中仍引用旧名,会导致运行时错误
⚠️ Important
beforeClose()的脏数据检测未包含webhook_configs/enable_webhook,会导致误弹"未保存"提示debugMock()缺少 try/catch,网络异常时会产生 unhandled promise rejection- Headers 表格中 "操作" 和 "删除" 为硬编码中文,未使用
$t()国际化
✨ Minor
enable_webhook|| false缺少空格(代码风格)
总体来说,核心功能实现完整,修复上述问题后即可合入。
| if (resp.result) { | ||
| this.$emit('updateTemplateLabelList'); | ||
| this.labelDialogShow = false; | ||
| this.formData.labels.push(resp.data.id); |
There was a problem hiding this comment.
🚨 formData.labels 在 data() 中已重命名为 template_labels,但此处仍引用旧名 labels。会导致运行时 TypeError: Cannot read properties of undefined (reading 'push'),需改为 this.formData.template_labels.push(resp.data.id)。
There was a problem hiding this comment.
✅ 此问题仍存在于最新提交中(第 646 行)。formData.labels 仍引用旧属性名,应为 this.formData.template_labels。此外,saveTemplateData 现在期望 template_labels 是对象数组(通过 .map(label => label.id) 提取 ID),但这里 push 的是 resp.data.id(纯 ID),应改为 push 整个 resp.data 对象。
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #681 +/- ##
==========================================
Coverage ? 81.29%
==========================================
Files ? 280
Lines ? 16632
Branches ? 0
==========================================
Hits ? 13521
Misses ? 3111
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
# Reviewed, transaction id: 78206
There was a problem hiding this comment.
Incremental Code Review Summary
最新提交 552232d 修复了缩进问题,并处理了部分之前审查中的反馈。
✅ 已解决的问题
beforeClose()脏数据检测现已包含webhook_configs和enable_webhook- Headers 表格中
操作/删除已使用$t()国际化 enable_webhook || false空格已补齐
🚨 仍需修复
formData.labels引用错误(TabTemplateConfig.vue:646):editLabelConfirm中仍引用this.formData.labels,但data()中该属性已重命名为template_labels。此外saveTemplateData现在期望template_labels为对象数组,应 pushresp.data而非resp.data.id
⚠️ 仍需修复
debugMock()缺少错误处理(HttpCallbackConfig.vue:582):async debugMock()未包裹 try/catch,网络异常时会产生 unhandled promise rejection
# Reviewed, transaction id: 78411
There was a problem hiding this comment.
Incremental Code Review Summary
最新提交 4030f35 为调试按钮添加了 loading 状态,并用 try/finally 包裹了 debugMock 逻辑,是合理的改进。
✅ 已解决的问题
beforeClose()脏数据检测已包含webhook_configs和enable_webhook- Headers 表格中
操作/删除已使用$t()国际化 enable_webhook || false空格已修复debugMock()已添加try/finally确保 loading 状态复位
🚨 仍未解决
editLabelConfirm中this.formData.labels.push(...)仍引用不存在的属性(已在之前审查中报告两次,第 646 行)
⚠️ 新发现
getTemplateConfig()直接对formData.webhookConfigs执行parseInt和.filter(),会原地修改表单数据,多次调用可能导致非预期副作用debugMock()有try/finally但无catch,请求失败时用户看不到错误提示
| triggers, | ||
| webhook_configs: webhookConfigs, | ||
| enable_webhook: this.enableWebhook, | ||
| }; |
There was a problem hiding this comment.
getTemplateConfig() 直接对 this.formData.webhookConfigs.extra_info 执行 parseInt() 和 .filter(),会原地修改 formData 的数据。如果此方法被多次调用(如 beforeClose 和 onSaveConfig 中),headers 会被重复过滤,数值字段也会被反复 parseInt。建议先 tools.deepClone(webhookConfigs) 再做转换,或在提交时一次性转换。
| theme: 'success', | ||
| }); | ||
| } | ||
| } finally { |
There was a problem hiding this comment.
try/finally 确保了 isDebugging 复位,但缺少 catch 块——当 debugWebhook 请求失败(网络异常、后端 500)时,用户不会看到任何错误提示。建议增加 catch(e) 并通过 $bkNotify 或 $bkMessage 展示失败信息。
Reviewed, transaction id: 78200