Skip to content

Commit 08fa19f

Browse files
fixed sorting for created at and paginagtion issue for stack and components
1 parent 72b2a24 commit 08fa19f

File tree

10 files changed

+62
-34
lines changed

10 files changed

+62
-34
lines changed

src/ui/layouts/common/CollapseTable/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const CollapseTable: React.FC<TableProps & CollapseTableProps> = ({
1010
headerCols,
1111
tableRows,
1212
activeSorting,
13+
activeSortingDirection,
1314
showHeader = true,
1415
pagination = true,
1516
loading = false,
@@ -22,6 +23,7 @@ export const CollapseTable: React.FC<TableProps & CollapseTableProps> = ({
2223
// console.log('activeSorting', activeSorting);
2324
return (
2425
<Table
26+
activeSortingDirection={activeSortingDirection}
2527
activeSorting={activeSorting}
2628
headerCols={headerCols}
2729
tableRows={tableRows}

src/ui/layouts/common/Pagination/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
131131
dispatchStackRunsData(id, page, size, filters as any, activeSorting);
132132
break;
133133
} else {
134-
dispatchStackData(1, size, filters as any, activeSorting);
134+
dispatchStackData(page, size, filters as any, activeSorting);
135135
break;
136136
}
137137
case 'components':
@@ -145,7 +145,12 @@ export const Pagination: React.FC<Props> = forwardRef((props, ref) => {
145145
);
146146
break;
147147
} else {
148-
dispatchStackComponentsData(1, size, filters as any, activeSorting);
148+
dispatchStackComponentsData(
149+
page,
150+
size,
151+
filters as any,
152+
activeSorting,
153+
);
149154
break;
150155
}
151156
case 'pipelines':

src/ui/layouts/common/Table/index.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export interface HeaderCol {
4040
export interface TableProps {
4141
headerCols: HeaderCol[];
4242
tableRows: any[];
43+
activeSortingDirection?: any;
4344
activeSorting?: any;
4445
paginated?: any;
4546
filters?: any[];
@@ -58,6 +59,7 @@ export const Table: React.FC<TableProps> = ({
5859
tableRows,
5960
paginated,
6061
activeSorting,
62+
activeSortingDirection,
6163
filters,
6264
showHeader = true,
6365
pagination = true,
@@ -183,7 +185,7 @@ export const Table: React.FC<TableProps> = ({
183185
componentName === 'components'
184186
? locationPath.pathname.split('/')[5]
185187
: locationPath.pathname.split('/')[4];
186-
// console.log(check, '333');
188+
const checkForLocationPath = locationPath.pathname.split('/')[4];
187189
useEffect(() => {
188190
// console.log(locationPath.pathname.split('/')[4], 'locationPath1');
189191
setItemPerPage(itemPerPage);
@@ -263,7 +265,12 @@ export const Table: React.FC<TableProps> = ({
263265
}
264266

265267
// eslint-disable-next-line react-hooks/exhaustive-deps
266-
}, [locationPath.pathname.split('/')[4], isValidFilter, activeSorting]);
268+
}, [
269+
checkForLocationPath,
270+
isValidFilter,
271+
activeSorting,
272+
activeSortingDirection,
273+
]);
267274
let rowsToDisplay = tableRows;
268275
// function getFetchedState(state: any) {
269276
// setFetchingMembers(state);

src/ui/layouts/pipelines/Pipelines/List/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ export const List: React.FC<Props> = ({ filter }: Props) => {
6565
nestedRow={true}
6666
/>
6767
)}
68-
activeSorting={
69-
activeSorting !== 'created' && activeSortingDirection !== 'ASC'
70-
? activeSorting
71-
: 'created'
72-
}
68+
activeSortingDirection={activeSortingDirection}
69+
activeSorting={activeSorting}
70+
// activeSorting={
71+
// activeSorting !== 'created' && activeSortingDirection !== 'ASC'
72+
// ? activeSorting
73+
// : 'created'
74+
// }
7375
paginated={pipelinesPaginated}
7476
loading={fetching}
7577
showHeader={true}

src/ui/layouts/pipelines/RunsTable/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,13 @@ export const RunsTable: React.FC<{
7777

7878
return (
7979
<Table
80-
activeSorting={
81-
activeSorting !== 'created' && activeSortingDirection !== 'ASC'
82-
? activeSorting
83-
: 'created'
84-
}
80+
activeSortingDirection={activeSortingDirection}
81+
activeSorting={activeSorting}
82+
// activeSorting={
83+
// activeSorting !== 'created' && activeSortingDirection !== 'ASC'
84+
// ? activeSorting
85+
// : 'created'
86+
// }
8587
pagination={pagination}
8688
loading={fetching}
8789
paginated={paginated}

src/ui/layouts/settings/Organization/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ export const Organization: React.FC = () => {
102102
</FlexBox.Row>
103103
{currentTable === 'members' && (
104104
<Table
105+
activeSortingDirection={activeSortingDirection}
105106
activeSorting={activeSorting}
107+
// activeSorting={activeSorting}
106108
paginated={membersPaginated}
107109
pagination={true}
108110
headerCols={memberHeaderCols}

src/ui/layouts/stackComponents/RunsTable/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ export const RunsTable: React.FC<{
6666
}, [getSorted]);
6767
return (
6868
<Table
69-
activeSorting={
70-
activeSorting !== 'created' && activeSortingDirection !== 'ASC'
71-
? activeSorting
72-
: 'created'
73-
}
69+
activeSortingDirection={activeSortingDirection}
70+
activeSorting={activeSorting}
71+
// activeSorting={
72+
// activeSorting !== 'created' && activeSortingDirection !== 'ASC'
73+
// ? activeSorting
74+
// : 'created'
75+
// }
7476
pagination={pagination}
7577
loading={fetching}
7678
showHeader={true}

src/ui/layouts/stackComponents/Stacks/List/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ Props) => {
9696
fetching={fetching}
9797
/>
9898
)}
99-
activeSorting={
100-
activeSorting !== 'created' && activeSortingDirection !== 'ASC'
101-
? activeSorting
102-
: 'created'
103-
}
99+
activeSortingDirection={activeSortingDirection}
100+
activeSorting={activeSorting}
101+
// activeSorting={
102+
// activeSorting !== 'created' && activeSortingDirection !== 'ASC'
103+
// ? activeSorting
104+
// : 'created'
105+
// }
104106
pagination={pagination}
105107
paginated={stackComponentsPaginated}
106108
loading={expendedRow.length > 0 ? false : fetching}

src/ui/layouts/stacks/RunsTable/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ export const RunsTable: React.FC<{
6666
}, [getSorted]);
6767
return (
6868
<Table
69-
activeSorting={
70-
activeSorting !== 'created' && activeSortingDirection !== 'ASC'
71-
? activeSorting
72-
: 'created'
73-
}
69+
activeSortingDirection={activeSortingDirection}
70+
activeSorting={activeSorting}
71+
// activeSorting={
72+
// activeSorting !== 'created' && activeSortingDirection !== 'ASC'
73+
// ? activeSorting
74+
// : 'created'
75+
// }
7476
pagination={pagination}
7577
loading={fetching}
7678
filters={filter}

src/ui/layouts/stacks/Stacks/List/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ export const List: React.FC<Props> = ({ filter }: Props) => {
6262
/>
6363
</>
6464
)}
65-
activeSorting={
66-
activeSorting !== 'created' && activeSortingDirection !== 'ASC'
67-
? activeSorting
68-
: 'created'
69-
}
65+
activeSortingDirection={activeSortingDirection}
66+
activeSorting={activeSorting}
67+
// activeSorting={
68+
// activeSorting !== 'created' && activeSortingDirection !== 'ASC'
69+
// ? activeSorting
70+
// : 'created'
71+
// }
7072
paginated={stacksPaginated}
7173
loading={fetching}
7274
showHeader={true}

0 commit comments

Comments
 (0)