Skip to content

Commit

Permalink
support batch
Browse files Browse the repository at this point in the history
Signed-off-by: husharp <[email protected]>
  • Loading branch information
HuSharp committed Sep 7, 2023
1 parent 74ead5c commit 6129c57
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server/api/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"net/http"
"net/url"
"strconv"
"strings"

"github.com/gorilla/mux"
"github.com/pingcap/errors"
Expand Down Expand Up @@ -441,6 +442,17 @@ func (h *ruleHandler) GetPlacementRules(w http.ResponseWriter, r *http.Request)
h.rd.JSON(w, http.StatusPreconditionFailed, errPlacementDisabled.Error())
return
}

if groupsStr := r.URL.Query().Get("groups"); len(groupsStr) > 0 {
var bundles []placement.GroupBundle
groupIDs := strings.Split(groupsStr, ",")
for _, g := range groupIDs {
bundles = append(bundles, cluster.GetRuleManager().GetGroupBundle(g))
}
h.rd.JSON(w, http.StatusOK, bundles)
return
}

bundles := cluster.GetRuleManager().GetAllGroupBundles()
h.rd.JSON(w, http.StatusOK, bundles)
}
Expand Down

0 comments on commit 6129c57

Please sign in to comment.