Refactor OpenPitrix API path

Signed-off-by: Zhengyi Lai <zheng1@yunify.com>
This commit is contained in:
Zhengyi Lai
2020-07-03 19:14:25 +08:00
parent 86a027e496
commit ebca5a0091
2 changed files with 49 additions and 59 deletions

View File

@@ -399,6 +399,10 @@ func (h *openpitrixHandler) ListApps(req *restful.Request, resp *restful.Respons
statistics := params.GetBoolValueWithDefault(req, "statistics", false)
conditions, err := params.ParseConditions(req)
if req.PathParameter("workspace") != "" {
conditions.Match["isv"] = req.PathParameter("workspace")
}
if err != nil {
klog.V(4).Infoln(err)
api.HandleBadRequest(resp, nil, err)
@@ -858,29 +862,6 @@ func (h *openpitrixHandler) ListRepos(req *restful.Request, resp *restful.Respon
resp.WriteEntity(result)
}
func (h *openpitrixHandler) ListEvents(req *restful.Request, resp *restful.Response) {
limit, offset := params.ParsePaging(req)
orderBy := params.GetStringValueWithDefault(req, params.OrderByParam, openpitrix.CreateTime)
reverse := params.GetBoolValueWithDefault(req, params.ReverseParam, false)
conditions, err := params.ParseConditions(req)
if err != nil {
klog.V(4).Infoln(err)
api.HandleBadRequest(resp, nil, err)
return
}
result, err := h.openpitrix.ListEvents(conditions, orderBy, reverse, limit, offset)
if err != nil {
klog.Errorln(err)
handleOpenpitrixError(resp, err)
return
}
resp.WriteEntity(result)
}
func (h *openpitrixHandler) ListRepoEvents(req *restful.Request, resp *restful.Response) {
repoId := req.PathParameter("repo")
limit, offset := params.ParsePaging(req)