diff --git a/pkg/kapis/openpitrix/v1/handler.go b/pkg/kapis/openpitrix/v1/handler.go index 54be36327..c6f6024dc 100644 --- a/pkg/kapis/openpitrix/v1/handler.go +++ b/pkg/kapis/openpitrix/v1/handler.go @@ -707,24 +707,19 @@ func (h *openpitrixHandler) ListApplications(req *restful.Request, resp *restful clusterName := req.PathParameter("cluster") namespace := req.PathParameter("namespace") workspace := req.PathParameter("workspace") - orderBy := params.GetStringValueWithDefault(req, params.OrderByParam, openpitrix.CreateTime) - reverse := params.GetBoolValueWithDefault(req, params.ReverseParam, false) + orderBy := params.GetStringValueWithDefault(req, params.OrderByParam, openpitrix.StatusTime) conditions, err := params.ParseConditions(req) - - if offset < 0 { - offset = 0 - } - - if limit <= 0 { - limit = 10 - } - if err != nil { klog.V(4).Infoln(err) api.HandleBadRequest(resp, nil, err) return } + reverse := false + if conditions.Match[openpitrix.Ascending] == "true" { + reverse = true + } + result, err := h.openpitrix.ListApplications(workspace, clusterName, namespace, conditions, limit, offset, orderBy, reverse) if err != nil { diff --git a/pkg/models/openpitrix/types.go b/pkg/models/openpitrix/types.go index 3e4c7cd4a..fb9a6bec9 100644 --- a/pkg/models/openpitrix/types.go +++ b/pkg/models/openpitrix/types.go @@ -909,5 +909,6 @@ const ( ActionReject = "reject" ActionSubmit = "submit" ActionRelease = "release" + Ascending = "ascending" ActionIndex = "index" )