Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit 12d723d

Browse files
committed
fix(table): make list size customizable
1 parent a089e21 commit 12d723d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

aqueductcore/frontend/src/components/organisms/TaskListInExperimentDetails/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { useState } from "react";
55
import TaskExtensionActionName from "components/molecules/TaskListTableCells/TaskExtensionActionName";
66
import TaskExtensionStatus from "components/molecules/TaskListTableCells/TaskExtensionStatus";
77
import { ExperimentDataType, TaskDataType, TasksListColumnsType } from "types/globalTypes";
8+
import { taskListRowsPerPageOptionsInExperimentDetailsPage } from "constants/constants";
89
import { dateFormatter, taskHistoryTableFormatter } from "helper/formatters";
910
import { useGetAllTasks } from "API/graphql/queries/tasks/getAllTasks";
1011
import ExtensionsList from "components/organisms/ExtensionsList";
11-
import { taskListRowsPerPageOptions } from "constants/constants";
1212
import TasksListTable from "components/organisms/TasksListTable";
1313
import { Loading } from "components/atoms/Loading";
1414
import { Error } from "components/atoms/Error";
@@ -54,7 +54,7 @@ export const TasksListColumns: readonly TasksListColumnsType[] = [
5454

5555
function TaskListInExperimentDetails({ experimentUuid }: { experimentUuid: ExperimentDataType['uuid'] }) {
5656
const [page, setPage] = useState(0);
57-
const [rowsPerPage, setRowsPerPage] = useState(taskListRowsPerPageOptions[0]);
57+
const [rowsPerPage, setRowsPerPage] = useState(taskListRowsPerPageOptionsInExperimentDetailsPage[0]);
5858
const { data, loading, error } = useGetAllTasks({
5959
variables: {
6060
offset: page * rowsPerPage,
@@ -98,6 +98,7 @@ function TaskListInExperimentDetails({ experimentUuid }: { experimentUuid: Exper
9898
</Grid>
9999
<Box sx={{ mt: 2 }}>
100100
<TasksListTable
101+
rowsPerPageOptions={taskListRowsPerPageOptionsInExperimentDetailsPage}
101102
TaskRecordsColumns={TasksListColumns}
102103
taskList={taskHistoryTableFormatter(tasks)}
103104
maxHeight={`calc(100vh - ${tableHeightOffset}px)`}

aqueductcore/frontend/src/components/organisms/TasksListTable/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ import TaskDetailsModal from "components/organisms/TaskDetailsModal";
1212
import { taskListRowsPerPageOptions } from "constants/constants";
1313

1414
function TasksListTable({
15+
rowsPerPageOptions = taskListRowsPerPageOptions,
1516
TaskRecordsColumns,
1617
taskList,
1718
maxHeight,
1819
pageInfo,
1920
}: {
21+
rowsPerPageOptions?: number[]
2022
TaskRecordsColumns: readonly TasksListColumnsType[];
2123
taskList: TaskDataType[];
2224
maxHeight?: string;
@@ -42,6 +44,7 @@ function TasksListTable({
4244
setRowsPerPage(+event.target.value);
4345
setPage(0);
4446
};
47+
console.log('rowsPerPageOptions', rowsPerPageOptions)
4548
return (
4649
<Paper sx={{ width: "100%", overflow: "hidden" }}>
4750
<TableContainer sx={{ maxHeight }}>
@@ -109,7 +112,7 @@ function TasksListTable({
109112
sx={{
110113
borderTop: `1px solid ${grey[300]}`,
111114
}}
112-
rowsPerPageOptions={taskListRowsPerPageOptions}
115+
rowsPerPageOptions={rowsPerPageOptions}
113116
component="div"
114117
count={count}
115118
rowsPerPage={rowsPerPage}

aqueductcore/frontend/src/constants/constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export const DEBOUNCE_DELAY = 250; //ms
88
// Pagination for Experiment Records
99
export const experimentRecordsRowsPerPageOptions = [10, 25, 100];
1010
// Pagination for Tasks List
11-
export const taskListRowsPerPageOptions = [3];
11+
export const taskListRowsPerPageOptions = [10, 25, 100];
12+
// Pagination for Tasks List in experiment details page
13+
export const taskListRowsPerPageOptionsInExperimentDetailsPage = [3];
1214

1315
export const FAVOURITE = "__favourite__";
1416
export const ARCHIVED = "__archived__";

0 commit comments

Comments
 (0)