diff --git a/frontend/src/concepts/pipelines/content/tables/pipeline/PipelinesTable.tsx b/frontend/src/concepts/pipelines/content/tables/pipeline/PipelinesTable.tsx index c9628b96cb..7134dda33b 100644 --- a/frontend/src/concepts/pipelines/content/tables/pipeline/PipelinesTable.tsx +++ b/frontend/src/concepts/pipelines/content/tables/pipeline/PipelinesTable.tsx @@ -6,7 +6,8 @@ import PipelinesTableRow from '~/concepts/pipelines/content/tables/pipeline/Pipe import { FetchStateRefreshPromise } from '~/utilities/useFetchState'; import { pipelineColumns } from '~/concepts/pipelines/content/tables/columns'; import DeletePipelineCoreResourceModal from '~/concepts/pipelines/content/DeletePipelineCoreResourceModal'; -import { sortByCreatedAt } from '~/utilities/sortByCreatedAt'; +import { sortRunsByCreated } from '../utils'; + type PipelinesTableProps = { pipelines: PipelineKF[]; pipelineDetailsPath: (namespace: string, id: string) => string; @@ -29,7 +30,7 @@ const PipelinesTable: React.FC = ({ return ( <> = ({ runs }) => { <>
- [...runs].sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()); +export const sortRunsByCreated = (pipelines: T[]): T[] => + [...pipelines].sort( + (a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime(), + ); export const getLastRun = (runs: PipelineRunKF[]) => sortRunsByCreated(runs)[0]; diff --git a/frontend/src/utilities/sortByCreatedAt.ts b/frontend/src/utilities/sortByCreatedAt.ts deleted file mode 100644 index b54396dbb2..0000000000 --- a/frontend/src/utilities/sortByCreatedAt.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const sortByCreatedAt = (pipeline) => - pipeline.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());