diff --git a/src/views/domain-workflows/domain-workflows-header/domain-workflows-header.tsx b/src/views/domain-workflows/domain-workflows-header/domain-workflows-header.tsx index 844ddd8d0..e3b33087f 100644 --- a/src/views/domain-workflows/domain-workflows-header/domain-workflows-header.tsx +++ b/src/views/domain-workflows/domain-workflows-header/domain-workflows-header.tsx @@ -15,6 +15,7 @@ export default function DomainWorkflowsHeader({ domain, cluster }: Props) { const { refetch, isFetching } = useListWorkflows({ domain, cluster, + listType: 'default', pageSize: DOMAIN_WORKFLOWS_PAGE_SIZE, inputType: queryParams.inputType, search: queryParams.search, diff --git a/src/views/domain-workflows/domain-workflows-table/domain-workflows-table.tsx b/src/views/domain-workflows/domain-workflows-table/domain-workflows-table.tsx index 065469976..b1559cd15 100644 --- a/src/views/domain-workflows/domain-workflows-table/domain-workflows-table.tsx +++ b/src/views/domain-workflows/domain-workflows-table/domain-workflows-table.tsx @@ -31,6 +31,7 @@ export default function DomainWorkflowsTable({ domain, cluster }: Props) { } = useListWorkflows({ domain, cluster, + listType: 'default', pageSize: DOMAIN_WORKFLOWS_PAGE_SIZE, inputType: queryParams.inputType, search: queryParams.search, diff --git a/src/views/shared/hooks/use-list-workflows.ts b/src/views/shared/hooks/use-list-workflows.ts index 0fb1e1e04..8619d27a2 100644 --- a/src/views/shared/hooks/use-list-workflows.ts +++ b/src/views/shared/hooks/use-list-workflows.ts @@ -17,15 +17,20 @@ export default function useListWorkflows({ domain, cluster, pageSize, - inputType, - search, - status, - timeRangeStart, - timeRangeEnd, - sortColumn, - sortOrder, - query, + listType, + ...filtersValues }: UseListWorkflowsParams) { + const { + inputType, + search, + status, + timeRangeStart, + timeRangeEnd, + sortColumn, + sortOrder, + query, + } = filtersValues; + const requestQueryParams = { inputType, ...(inputType === 'query' @@ -53,7 +58,8 @@ export default function useListWorkflows({ url: `/api/domains/${domain}/${cluster}/workflows`, query: { ...requestQueryParams, - listType: 'default', + listType: listType, + timeColumn: listType === 'archived' ? 'CloseTime' : 'StartTime', pageSize: pageSize.toString(), nextPage: pageParam as string, } as const satisfies ListWorkflowsRequestQueryParams, diff --git a/src/views/shared/hooks/use-list-workflows.types.ts b/src/views/shared/hooks/use-list-workflows.types.ts index 61fcd63ab..c7e89184f 100644 --- a/src/views/shared/hooks/use-list-workflows.types.ts +++ b/src/views/shared/hooks/use-list-workflows.types.ts @@ -1,17 +1,23 @@ -import { type RouteParams as ListWorkflowsRouteParams } from '@/route-handlers/list-workflows/list-workflows.types'; +import { + type ListWorkflowsRequestQueryParams, + type RouteParams as ListWorkflowsRouteParams, +} from '@/route-handlers/list-workflows/list-workflows.types'; import { type SortOrder } from '@/utils/sort-by'; import { type WorkflowStatus } from '../workflow-status-tag/workflow-status-tag.types'; import { type WorkflowsHeaderInputType } from '../workflows-header/workflows-header.types'; +export type ListType = ListWorkflowsRequestQueryParams['listType']; + export type UseListWorkflowsParams = ListWorkflowsRouteParams & { pageSize: number; inputType: WorkflowsHeaderInputType; + listType: ListType; search?: string; status?: WorkflowStatus; timeRangeStart?: Date; timeRangeEnd?: Date; - sortColumn: string; - sortOrder: SortOrder; - query: string; + sortColumn?: string; + sortOrder?: SortOrder; + query?: string; };