Skip to content

Commit

Permalink
change api default limit to result max
Browse files Browse the repository at this point in the history
  • Loading branch information
liangzai006 committed Sep 25, 2023
1 parent 1d41269 commit b3b3de9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions pkg/controllers/inspectresult_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func (r *InspectResultReconciler) CountLevelNum(resultName string) (map[kubeeyev
ComputeLevel(result.Spec.PrometheusResult, levelTotal)

ComputeLevel(result.Spec.ComponentResult, levelTotal)
ComputeLevel(result.Spec.CommandResult, levelTotal)

return levelTotal, nil
}
7 changes: 3 additions & 4 deletions pkg/inspect/nodeinfo_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,10 @@ func (o *nodeInfoInspect) GetResult(runNodeName string, resultCm *corev1.ConfigM
return nil, err
}

for _, item := range nodeInfoResult {
item.NodeName = runNodeName
resultCr.Spec.NodeInfo = append(resultCr.Spec.NodeInfo, item)
for i := range nodeInfoResult {
nodeInfoResult[i].NodeName = runNodeName
}

resultCr.Spec.NodeInfo = nodeInfoResult
return resultCr, nil

}
Expand Down
6 changes: 3 additions & 3 deletions pkg/server/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func ParseQuery(g *gin.Context) *Query {
func NewQuery() *Query {
return &Query{
Pagination: &Pagination{
Limit: 10,
Limit: 0,
Offset: 0,
},
SortBy: "",
Expand Down Expand Up @@ -123,7 +123,7 @@ func ParsePagination(values url.Values) *Pagination {
if limit != "" {
atoi, err := strconv.Atoi(limit)
if err != nil || atoi < 1 {
atoi = 10
atoi = 0
}
pagination.Limit = atoi
}
Expand Down Expand Up @@ -170,7 +170,7 @@ func (p *Pagination) computeIndex(total int) (int, int) {
startIndex = p.Offset
endIndex = startIndex + p.Limit

if endIndex > total {
if endIndex > total || endIndex == 0 {
endIndex = total
}
if startIndex > total {
Expand Down

0 comments on commit b3b3de9

Please sign in to comment.