fix openpitrix resource sort param
Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
@@ -42,6 +42,11 @@ func ListApplications(req *restful.Request, resp *restful.Response) {
|
|||||||
orderBy := req.QueryParameter(params.OrderByParam)
|
orderBy := req.QueryParameter(params.OrderByParam)
|
||||||
reverse := params.ParseReverse(req)
|
reverse := params.ParseReverse(req)
|
||||||
|
|
||||||
|
if orderBy == "" {
|
||||||
|
orderBy = "create_time"
|
||||||
|
reverse = true
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.WriteHeaderAndEntity(http.StatusBadRequest, errors.Wrap(err))
|
resp.WriteHeaderAndEntity(http.StatusBadRequest, errors.Wrap(err))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ func ListApplications(conditions *params.Conditions, limit, offset int, orderBy
|
|||||||
if orderBy != "" {
|
if orderBy != "" {
|
||||||
describeClustersRequest.SortKey = &wrappers.StringValue{Value: orderBy}
|
describeClustersRequest.SortKey = &wrappers.StringValue{Value: orderBy}
|
||||||
}
|
}
|
||||||
describeClustersRequest.Reverse = &wrappers.BoolValue{Value: reverse}
|
describeClustersRequest.Reverse = &wrappers.BoolValue{Value: !reverse}
|
||||||
resp, err := client.Cluster().DescribeClusters(openpitrix.SystemContext(), describeClustersRequest)
|
resp, err := client.Cluster().DescribeClusters(openpitrix.SystemContext(), describeClustersRequest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorln(err)
|
klog.Errorln(err)
|
||||||
|
|||||||
@@ -587,7 +587,7 @@ func ListAppVersionAudits(conditions *params.Conditions, orderBy string, reverse
|
|||||||
if orderBy != "" {
|
if orderBy != "" {
|
||||||
describeAppVersionAudits.SortKey = &wrappers.StringValue{Value: orderBy}
|
describeAppVersionAudits.SortKey = &wrappers.StringValue{Value: orderBy}
|
||||||
}
|
}
|
||||||
describeAppVersionAudits.Reverse = &wrappers.BoolValue{Value: reverse}
|
describeAppVersionAudits.Reverse = &wrappers.BoolValue{Value: !reverse}
|
||||||
describeAppVersionAudits.Limit = uint32(limit)
|
describeAppVersionAudits.Limit = uint32(limit)
|
||||||
describeAppVersionAudits.Offset = uint32(offset)
|
describeAppVersionAudits.Offset = uint32(offset)
|
||||||
resp, err := client.App().DescribeAppVersionAudits(openpitrix.SystemContext(), describeAppVersionAudits)
|
resp, err := client.App().DescribeAppVersionAudits(openpitrix.SystemContext(), describeAppVersionAudits)
|
||||||
@@ -626,7 +626,7 @@ func ListAppVersionReviews(conditions *params.Conditions, orderBy string, revers
|
|||||||
if orderBy != "" {
|
if orderBy != "" {
|
||||||
describeAppVersionReviews.SortKey = &wrappers.StringValue{Value: orderBy}
|
describeAppVersionReviews.SortKey = &wrappers.StringValue{Value: orderBy}
|
||||||
}
|
}
|
||||||
describeAppVersionReviews.Reverse = &wrappers.BoolValue{Value: reverse}
|
describeAppVersionReviews.Reverse = &wrappers.BoolValue{Value: !reverse}
|
||||||
describeAppVersionReviews.Limit = uint32(limit)
|
describeAppVersionReviews.Limit = uint32(limit)
|
||||||
describeAppVersionReviews.Offset = uint32(offset)
|
describeAppVersionReviews.Offset = uint32(offset)
|
||||||
// TODO icon is needed
|
// TODO icon is needed
|
||||||
@@ -669,7 +669,7 @@ func ListAppVersions(conditions *params.Conditions, orderBy string, reverse bool
|
|||||||
if orderBy != "" {
|
if orderBy != "" {
|
||||||
describeAppVersionsRequest.SortKey = &wrappers.StringValue{Value: orderBy}
|
describeAppVersionsRequest.SortKey = &wrappers.StringValue{Value: orderBy}
|
||||||
}
|
}
|
||||||
describeAppVersionsRequest.Reverse = &wrappers.BoolValue{Value: reverse}
|
describeAppVersionsRequest.Reverse = &wrappers.BoolValue{Value: !reverse}
|
||||||
describeAppVersionsRequest.Limit = uint32(limit)
|
describeAppVersionsRequest.Limit = uint32(limit)
|
||||||
describeAppVersionsRequest.Offset = uint32(offset)
|
describeAppVersionsRequest.Offset = uint32(offset)
|
||||||
resp, err := client.App().DescribeAppVersions(openpitrix.SystemContext(), describeAppVersionsRequest)
|
resp, err := client.App().DescribeAppVersions(openpitrix.SystemContext(), describeAppVersionsRequest)
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ func ListCategories(conditions *params.Conditions, orderBy string, reverse bool,
|
|||||||
if orderBy != "" {
|
if orderBy != "" {
|
||||||
req.SortKey = &wrappers.StringValue{Value: orderBy}
|
req.SortKey = &wrappers.StringValue{Value: orderBy}
|
||||||
}
|
}
|
||||||
req.Reverse = &wrappers.BoolValue{Value: reverse}
|
req.Reverse = &wrappers.BoolValue{Value: !reverse}
|
||||||
req.Limit = uint32(limit)
|
req.Limit = uint32(limit)
|
||||||
req.Offset = uint32(offset)
|
req.Offset = uint32(offset)
|
||||||
resp, err := client.Category().DescribeCategories(openpitrix.SystemContext(), req)
|
resp, err := client.Category().DescribeCategories(openpitrix.SystemContext(), req)
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ func ListRepos(conditions *params.Conditions, orderBy string, reverse bool, limi
|
|||||||
if orderBy != "" {
|
if orderBy != "" {
|
||||||
req.SortKey = &wrappers.StringValue{Value: orderBy}
|
req.SortKey = &wrappers.StringValue{Value: orderBy}
|
||||||
}
|
}
|
||||||
req.Reverse = &wrappers.BoolValue{Value: reverse}
|
req.Reverse = &wrappers.BoolValue{Value: !reverse}
|
||||||
req.Limit = uint32(limit)
|
req.Limit = uint32(limit)
|
||||||
req.Offset = uint32(offset)
|
req.Offset = uint32(offset)
|
||||||
resp, err := client.Repo().DescribeRepos(openpitrix.SystemContext(), req)
|
resp, err := client.Repo().DescribeRepos(openpitrix.SystemContext(), req)
|
||||||
|
|||||||
Reference in New Issue
Block a user