Make sure the result of /clusters is returned to the user.

This commit is contained in:
Oleksii Kliukin 2018-02-22 10:21:09 +01:00
parent 85f7c944c2
commit 8801e62b12
1 changed files with 3 additions and 3 deletions

View File

@ -169,13 +169,13 @@ func (s *Server) clusters(w http.ResponseWriter, req *http.Request) {
} else if matches := util.FindNamedStringSubmatch(clusterHistoryURL, req.URL.Path); matches != nil {
resp, err = s.controller.ClusterHistory(matches["team"], matches["cluster"])
} else if req.URL.Path == clustersURL {
res := make(map[string][]string)
clusterNamesPerTeam := make(map[string][]string)
for team, clusters := range s.controller.TeamClusterList() {
for _, cluster := range clusters {
res[team] = append(res[team], cluster.Name[len(team)+1:])
clusterNamesPerTeam[team] = append(clusterNamesPerTeam[team], cluster.Name[len(team)+1:])
}
}
err = nil
resp, err = clusterNamesPerTeam, nil
} else {
resp, err = nil, fmt.Errorf("page not found")
}