Skip to content

Commit 0e74c97

Browse files
committed
fix: sorting in table
1 parent bf5a566 commit 0e74c97

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/components/ResourceBrowser/ResourceList/K8sResourceListTableCellComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const K8sResourceListTableCellComponent = ({
177177
<>
178178
{columnName === 'name' ? (
179179
<div
180-
className="flexbox dc__align-items-center dc__gap-4 dc__content-space dc__visible-hover dc__visible-hover--parent py-10"
180+
className="flexbox dc__align-items-center dc__gap-4 dc__content-space dc__visible-hover dc__visible-hover--parent py-10 pr-6"
181181
data-testid="created-resource-name"
182182
>
183183
<div className="flex left dc__gap-4">

src/components/ResourceBrowser/ResourceList/Sidebar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ const Sidebar = ({ apiResources, selectedResource, updateK8sResourceTab }: Sideb
113113
const params = new URLSearchParams(location.search)
114114
params.delete('pageNumber')
115115
params.delete('sortBy')
116+
params.delete('sortOrder')
116117
const _url = `${generatePath(RESOURCE_BROWSER_ROUTES.K8S_RESOURCE_LIST, {
117118
clusterId,
118119
kind: _selectedKind,

src/components/ResourceBrowser/ResourceList/utils.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export const parseK8sResourceListSearchParams = (searchParams: URLSearchParams):
124124
const numberInStringComparator = <T extends string>(a: T, b: T) =>
125125
numberComparatorBySortOrder(a ? parseInt(a.match(/^\d+/)[0], 10) : 0, b ? parseInt(b.match(/^\d+/)[0], 10) : 0)
126126

127-
const durationComparator = <T extends string>(a: T, b: T) => k8sStyledAgeToSeconds(b) - k8sStyledAgeToSeconds(a)
127+
const durationComparator = <T extends string>(a: T, b: T) => k8sStyledAgeToSeconds(a) - k8sStyledAgeToSeconds(b)
128128

129129
const propertyComparatorMap = {
130130
age: durationComparator,
@@ -143,6 +143,7 @@ const propertyComparatorMap = {
143143
'mem usage (%)': numberInStringComparator,
144144
'mem allocatable': numberInStringComparator,
145145
'cpu usage (absolute)': numberInStringComparator,
146+
restarts: numberInStringComparator,
146147
}
147148

148149
/**
@@ -242,7 +243,7 @@ export const getColumnSize = (field: string, isEventListing: boolean) => {
242243
return {
243244
range: {
244245
maxWidth: 600,
245-
minWidth: field === 'name' ? 200 : 180,
246+
minWidth: field === 'name' ? 200 : 120,
246247
startWidth: field === 'name' ? 300 : 200,
247248
},
248249
}

0 commit comments

Comments
 (0)