fix: K8s集群编辑保存失败+凭据覆盖+去掉Kubectl死按钮

问题:
1. UpdateCluster 用 CreateK8sClusterRequest (code binding:"required"),
   编辑时不传 code → 校验失败 400 → 保存不成功
2. Token/KubeConfig json:"-" 不序列化, 编辑时拿不到原值,
   提交空字符串覆盖真实凭据
3. 操作菜单 Kubectl 是死按钮

修复:
- UpdateCluster 改用 map[string]interface{} 接收, 逐字段更新,
  空值不覆盖 (防止凭据清空)
- 新增 GET /:id/detail 返回 has_token/has_kube_config 脱敏标记
- 编辑弹框拉取详情 API 回填, Token/KubeConfig 留空显示 '已配置' 提示
- 去掉 Kubectl 死按钮, 保留 详情/配置/删除 三项
This commit is contained in:
Logan authored and attacker committed 2026-06-19 15:08:50 +08:00
1 parent 33e58ce25a
commit abf2917fad
5 files changed
+119 -33

No files matched your search

+1 -1
View File
@@ -161,7 +161,7 @@ export const k8sApi = {
return http.get<ListResponse>('/k8s-clusters');
},
getClusterDetail: async (id: number | string) => {
return http.get(`/k8s-clusters/${id}`);
return http.get(`/k8s-clusters/${id}/detail`);
},
createCluster: async (data: any) => {
return http.post('/k8s-clusters', data);