Skip to content

Commit 8954186

Browse files
authored
chore: correct order within page result (#6847)
1 parent 610f4d4 commit 8954186

File tree

11 files changed

+392
-10
lines changed

11 files changed

+392
-10
lines changed

pkg/query-service/app/inframetrics/clusters.go

+2
Original file line numberDiff line numberDiff line change
@@ -338,5 +338,7 @@ func (p *ClustersRepo) GetClusterList(ctx context.Context, req model.ClusterList
338338
resp.Total = len(allClusterGroups)
339339
resp.Records = records
340340

341+
resp.SortBy(req.OrderBy)
342+
341343
return resp, nil
342344
}

pkg/query-service/app/inframetrics/daemonsets.go

+2
Original file line numberDiff line numberDiff line change
@@ -440,5 +440,7 @@ func (d *DaemonSetsRepo) GetDaemonSetList(ctx context.Context, req model.DaemonS
440440
resp.Total = len(allDaemonSetGroups)
441441
resp.Records = records
442442

443+
resp.SortBy(req.OrderBy)
444+
443445
return resp, nil
444446
}

pkg/query-service/app/inframetrics/deployments.go

+2
Original file line numberDiff line numberDiff line change
@@ -440,5 +440,7 @@ func (d *DeploymentsRepo) GetDeploymentList(ctx context.Context, req model.Deplo
440440
resp.Total = len(allDeploymentGroups)
441441
resp.Records = records
442442

443+
resp.SortBy(req.OrderBy)
444+
443445
return resp, nil
444446
}

pkg/query-service/app/inframetrics/jobs.go

+2
Original file line numberDiff line numberDiff line change
@@ -494,5 +494,7 @@ func (d *JobsRepo) GetJobList(ctx context.Context, req model.JobListRequest) (mo
494494
resp.Total = len(allJobGroups)
495495
resp.Records = records
496496

497+
resp.SortBy(req.OrderBy)
498+
497499
return resp, nil
498500
}

pkg/query-service/app/inframetrics/namespaces.go

+2
Original file line numberDiff line numberDiff line change
@@ -341,5 +341,7 @@ func (p *NamespacesRepo) GetNamespaceList(ctx context.Context, req model.Namespa
341341
resp.Total = len(allNamespaceGroups)
342342
resp.Records = records
343343

344+
resp.SortBy(req.OrderBy)
345+
344346
return resp, nil
345347
}

pkg/query-service/app/inframetrics/nodes.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var (
1919

2020
nodeAttrsToEnrich = []string{"k8s_node_name", "k8s_node_uid", "k8s_cluster_name"}
2121

22-
k8sNodeUIDAttrKey = "k8s_node_uid"
22+
k8sNodeGroupAttrKey = "k8s_node_name"
2323

2424
queryNamesForNodes = map[string][]string{
2525
"cpu": {"A"},
@@ -125,7 +125,7 @@ func (p *NodesRepo) getMetadataAttributes(ctx context.Context, req model.NodeLis
125125
}
126126
}
127127

128-
nodeUID := stringData[k8sNodeUIDAttrKey]
128+
nodeUID := stringData[k8sNodeGroupAttrKey]
129129
if _, ok := nodeAttrs[nodeUID]; !ok {
130130
nodeAttrs[nodeUID] = map[string]string{}
131131
}
@@ -220,7 +220,7 @@ func (p *NodesRepo) GetNodeList(ctx context.Context, req model.NodeListRequest)
220220
}
221221

222222
if req.GroupBy == nil {
223-
req.GroupBy = []v3.AttributeKey{{Key: k8sNodeUIDAttrKey}}
223+
req.GroupBy = []v3.AttributeKey{{Key: k8sNodeGroupAttrKey}}
224224
resp.Type = model.ResponseTypeList
225225
} else {
226226
resp.Type = model.ResponseTypeGroupedList
@@ -306,7 +306,7 @@ func (p *NodesRepo) GetNodeList(ctx context.Context, req model.NodeListRequest)
306306
NodeMemoryAllocatable: -1,
307307
}
308308

309-
if nodeUID, ok := row.Data[k8sNodeUIDAttrKey].(string); ok {
309+
if nodeUID, ok := row.Data[k8sNodeGroupAttrKey].(string); ok {
310310
record.NodeUID = nodeUID
311311
}
312312

@@ -354,5 +354,6 @@ func (p *NodesRepo) GetNodeList(ctx context.Context, req model.NodeListRequest)
354354
resp.Total = len(allNodeGroups)
355355
resp.Records = records
356356

357+
resp.SortBy(req.OrderBy)
357358
return resp, nil
358359
}

pkg/query-service/app/inframetrics/nodes_query.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
2020
},
2121
GroupBy: []v3.AttributeKey{
2222
{
23-
Key: k8sNodeUIDAttrKey,
23+
Key: k8sNodeGroupAttrKey,
2424
DataType: v3.AttributeKeyDataTypeString,
2525
Type: v3.AttributeKeyTypeResource,
2626
},
@@ -46,7 +46,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
4646
},
4747
GroupBy: []v3.AttributeKey{
4848
{
49-
Key: k8sNodeUIDAttrKey,
49+
Key: k8sNodeGroupAttrKey,
5050
DataType: v3.AttributeKeyDataTypeString,
5151
Type: v3.AttributeKeyTypeResource,
5252
},
@@ -72,7 +72,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
7272
},
7373
GroupBy: []v3.AttributeKey{
7474
{
75-
Key: k8sNodeUIDAttrKey,
75+
Key: k8sNodeGroupAttrKey,
7676
DataType: v3.AttributeKeyDataTypeString,
7777
Type: v3.AttributeKeyTypeResource,
7878
},
@@ -98,7 +98,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
9898
},
9999
GroupBy: []v3.AttributeKey{
100100
{
101-
Key: k8sNodeUIDAttrKey,
101+
Key: k8sNodeGroupAttrKey,
102102
DataType: v3.AttributeKeyDataTypeString,
103103
Type: v3.AttributeKeyTypeResource,
104104
},
@@ -132,7 +132,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
132132
},
133133
GroupBy: []v3.AttributeKey{
134134
{
135-
Key: k8sNodeUIDAttrKey,
135+
Key: k8sNodeGroupAttrKey,
136136
DataType: v3.AttributeKeyDataTypeString,
137137
Type: v3.AttributeKeyTypeResource,
138138
},
@@ -166,7 +166,7 @@ var NodesTableListQuery = v3.QueryRangeParamsV3{
166166
},
167167
GroupBy: []v3.AttributeKey{
168168
{
169-
Key: k8sNodeUIDAttrKey,
169+
Key: k8sNodeGroupAttrKey,
170170
DataType: v3.AttributeKeyDataTypeString,
171171
Type: v3.AttributeKeyTypeResource,
172172
},

pkg/query-service/app/inframetrics/pods.go

+2
Original file line numberDiff line numberDiff line change
@@ -404,5 +404,7 @@ func (p *PodsRepo) GetPodList(ctx context.Context, req model.PodListRequest) (mo
404404
resp.Total = len(allPodGroups)
405405
resp.Records = records
406406

407+
resp.SortBy(req.OrderBy)
408+
407409
return resp, nil
408410
}

pkg/query-service/app/inframetrics/pvcs.go

+2
Original file line numberDiff line numberDiff line change
@@ -374,5 +374,7 @@ func (p *PvcsRepo) GetPvcList(ctx context.Context, req model.VolumeListRequest)
374374
resp.Total = len(allVolumeGroups)
375375
resp.Records = records
376376

377+
resp.SortBy(req.OrderBy)
378+
377379
return resp, nil
378380
}

pkg/query-service/app/inframetrics/statefulsets.go

+2
Original file line numberDiff line numberDiff line change
@@ -440,5 +440,7 @@ func (d *StatefulSetsRepo) GetStatefulSetList(ctx context.Context, req model.Sta
440440
resp.Total = len(allStatefulSetGroups)
441441
resp.Records = records
442442

443+
resp.SortBy(req.OrderBy)
444+
443445
return resp, nil
444446
}

0 commit comments

Comments
 (0)