Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions aqueductcore/frontend/src/__mocks__/queries/tasks/getAllTasks.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { selected_experiment } from "__mocks__/queries/experiment/getExperimentByIdMock";
import { GET_ALL_TASKS } from "API/graphql/queries/tasks/getAllTasks";
import { taskListRowsPerPageOptions } from "constants/constants";
import { taskListRowsPerPageOptions, taskListRowsPerPageOptionsInExperimentDetailsPage } from "constants/constants";
import { TasksDataMock } from "__mocks__/TasksDataMock";
import { createdNewExperiment } from "__mocks__/ExperimentsDataMock";

const request = {
query: GET_ALL_TASKS,
Expand Down Expand Up @@ -33,7 +34,7 @@ export const getAllTasks_mock = {
...request,
variables: {
offset: 0,
limit: taskListRowsPerPageOptions[0],
limit: taskListRowsPerPageOptionsInExperimentDetailsPage[0],
filters: {
experiment: {
type: 'UUID',
Expand All @@ -45,8 +46,33 @@ export const getAllTasks_mock = {
result: {
data: {
tasks: {
tasksData: TasksDataMock.slice(0, taskListRowsPerPageOptions[0]),
totalTasksCount: TasksDataMock.slice(0, taskListRowsPerPageOptions[0]).length
tasksData: TasksDataMock.slice(0, taskListRowsPerPageOptionsInExperimentDetailsPage[0]),
totalTasksCount: TasksDataMock.slice(0, taskListRowsPerPageOptionsInExperimentDetailsPage[0]).length
}
},
},
maxUsageCount: Number.POSITIVE_INFINITY,
},
// New experiment mock data (it's being used in ExperimentRecordsPage.test.tsx) with no task
{
request: {
...request,
variables: {
offset: 0,
limit: taskListRowsPerPageOptionsInExperimentDetailsPage[0],
filters: {
experiment: {
type: 'UUID',
value: createdNewExperiment.uuid
}
}
}
},
result: {
data: {
tasks: {
tasksData: [],
totalTasksCount: 0
}
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { useState } from "react";
import TaskExtensionActionName from "components/molecules/TaskListTableCells/TaskExtensionActionName";
import TaskExtensionStatus from "components/molecules/TaskListTableCells/TaskExtensionStatus";
import { ExperimentDataType, TaskDataType, TasksListColumnsType } from "types/globalTypes";
import { taskListRowsPerPageOptionsInExperimentDetailsPage } from "constants/constants";
import { dateFormatter, taskHistoryTableFormatter } from "helper/formatters";
import { useGetAllTasks } from "API/graphql/queries/tasks/getAllTasks";
import ExtensionsList from "components/organisms/ExtensionsList";
import { taskListRowsPerPageOptions } from "constants/constants";
import TasksListTable from "components/organisms/TasksListTable";
import { Loading } from "components/atoms/Loading";
import { Error } from "components/atoms/Error";
Expand Down Expand Up @@ -54,7 +54,7 @@ export const TasksListColumns: readonly TasksListColumnsType[] = [

function TaskListInExperimentDetails({ experimentUuid }: { experimentUuid: ExperimentDataType['uuid'] }) {
const [page, setPage] = useState(0);
const [rowsPerPage, setRowsPerPage] = useState(taskListRowsPerPageOptions[0]);
const [rowsPerPage, setRowsPerPage] = useState(taskListRowsPerPageOptionsInExperimentDetailsPage[0]);
const { data, loading, error } = useGetAllTasks({
variables: {
offset: page * rowsPerPage,
Expand Down Expand Up @@ -98,6 +98,7 @@ function TaskListInExperimentDetails({ experimentUuid }: { experimentUuid: Exper
</Grid>
<Box sx={{ mt: 2 }}>
<TasksListTable
rowsPerPageOptions={taskListRowsPerPageOptionsInExperimentDetailsPage}
TaskRecordsColumns={TasksListColumns}
taskList={taskHistoryTableFormatter(tasks)}
maxHeight={`calc(100vh - ${tableHeightOffset}px)`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import TaskDetailsModal from "components/organisms/TaskDetailsModal";
import { taskListRowsPerPageOptions } from "constants/constants";

function TasksListTable({
rowsPerPageOptions = taskListRowsPerPageOptions,
TaskRecordsColumns,
taskList,
maxHeight,
pageInfo,
}: {
rowsPerPageOptions?: number[]
TaskRecordsColumns: readonly TasksListColumnsType[];
taskList: TaskDataType[];
maxHeight?: string;
Expand Down Expand Up @@ -109,7 +111,7 @@ function TasksListTable({
sx={{
borderTop: `1px solid ${grey[300]}`,
}}
rowsPerPageOptions={taskListRowsPerPageOptions}
rowsPerPageOptions={rowsPerPageOptions}
component="div"
count={count}
rowsPerPage={rowsPerPage}
Expand Down
4 changes: 3 additions & 1 deletion aqueductcore/frontend/src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export const DEBOUNCE_DELAY = 250; //ms
// Pagination for Experiment Records
export const experimentRecordsRowsPerPageOptions = [10, 25, 100];
// Pagination for Tasks List
export const taskListRowsPerPageOptions = [3];
export const taskListRowsPerPageOptions = [10, 25, 100];
// Pagination for Tasks List in experiment details page
export const taskListRowsPerPageOptionsInExperimentDetailsPage = [3];

export const FAVOURITE = "__favourite__";
export const ARCHIVED = "__archived__";
Expand Down
Loading