Skip to content

Commit

Permalink
feat(dbm-services): 资源池聚合视图支持过滤禁用规格 #8485
Browse files Browse the repository at this point in the history
  • Loading branch information
ymakedaq authored and iSecloud committed Dec 9, 2024
1 parent 18e8281 commit 41f471c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ type ResourDistributionParam struct {
SubZoneIds []string `json:"subzone_ids"`
GroupBy string `json:"group_by" binding:"required"`
SpecParam DbmSpecParam `json:"spec_param" `
// 筛选enable的规格
EnableSpec bool `json:"enable_spec"`
}

// DbmSpecParam 规格参数
Expand All @@ -87,7 +89,7 @@ type DbmSpecParam struct {
SpecIdList []int `json:"spec_id_list"`
}

func (m DbmSpecParam) getQueryParam() map[string]string {
func (m DbmSpecParam) getQueryParam(enableSpec bool) map[string]string {
p := make(map[string]string)
if m.DbType != nil {
if *m.DbType != model.PUBLIC_RESOURCE_DBTYEP {
Expand All @@ -107,6 +109,9 @@ func (m DbmSpecParam) getQueryParam() map[string]string {
}
p["spec_ids"] = strings.Join(specIdStrList, ",")
}
if enableSpec {
p["enable"] = "true"
}
return p
}

Expand All @@ -120,7 +125,7 @@ func (s *Handler) ResourceDistribution(c *gin.Context) {
}

dbmClient := dbmapi.NewDbmClient()
specList, err := dbmClient.GetDbmSpec(param.SpecParam.getQueryParam())
specList, err := dbmClient.GetDbmSpec(param.SpecParam.getQueryParam(param.EnableSpec))
if err != nil {
logger.Error("get dbm spec failed: %v", err)
s.SendResponse(c, err, "Failed to get DBM specifications")
Expand Down

0 comments on commit 41f471c

Please sign in to comment.