Skip to content

Commit

Permalink
feat: 新增获取模板文件关联labels接口优化
Browse files Browse the repository at this point in the history
  • Loading branch information
LidolLxf committed Dec 4, 2024
1 parent e52c964 commit b84de6b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions bcs-services/cluster-resources/pkg/resource/form/parser/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,27 @@ func GetLablesFromManifest(manifest string, kind, associateName string) map[stri
manifests := SplitManifests(manifest)
for _, v := range manifests {
metadata := GetManifestMetadata(v)
// 筛选关联应用的labels
if associateName != "" {
if associateName == metadata.Metadata.Name && kind == metadata.Kind {
for kk, vv := range metadata.Metadata.Labels {
resp = append(resp, map[string]interface{}{
"key": kk,
"value": vv,
})
}
}
if kind != metadata.Kind {
continue
}

if kind == metadata.Kind {
// 筛选关联资源名称列表
if associateName == "" {
resp = append(resp, map[string]interface{}{
"label": metadata.Metadata.Name,
"value": metadata.Metadata.Name,
"disabled": false,
"tips": "",
})

continue
}
// 筛选关联应用的labels
if associateName == metadata.Metadata.Name {
for kk, vv := range metadata.Metadata.Labels {
resp = append(resp, map[string]interface{}{
"key": kk,
"value": vv,
})
}
}
}

Expand Down

0 comments on commit b84de6b

Please sign in to comment.