From cd6a80c12654ab0864425ec923020453735f92ca Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:41:42 +1200 Subject: [PATCH] fix: not set page and pageSize for pipelines (#7830) (#7837) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 青湛 <0x1304570@gmail.com> --- config-ui/src/api/pipeline/index.ts | 3 ++- config-ui/src/routes/pipeline/components/table.tsx | 8 ++------ config-ui/src/routes/pipeline/pipelines.tsx | 5 +---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/config-ui/src/api/pipeline/index.ts b/config-ui/src/api/pipeline/index.ts index 0fe0f8a796b..ad06d28b399 100644 --- a/config-ui/src/api/pipeline/index.ts +++ b/config-ui/src/api/pipeline/index.ts @@ -21,7 +21,8 @@ import { request } from '@/utils'; import { SubTasksRes } from './types'; -export const list = (): Promise<{ count: number; pipelines: IPipeline[] }> => request('/pipelines'); +export const list = (params: Pagination): Promise<{ count: number; pipelines: IPipeline[] }> => + request('/pipelines', { data: params }); export const get = (id: ID) => request(`/pipelines/${id}`); diff --git a/config-ui/src/routes/pipeline/components/table.tsx b/config-ui/src/routes/pipeline/components/table.tsx index 2dfb6fb4f95..d63ddd6cedc 100644 --- a/config-ui/src/routes/pipeline/components/table.tsx +++ b/config-ui/src/routes/pipeline/components/table.tsx @@ -41,14 +41,9 @@ interface Props { pageSize: number; onChange: (page: number) => void; }; - noData?: { - text?: React.ReactNode; - btnText?: string; - onCreate?: () => void; - }; } -export const PipelineTable = ({ dataSource, pagination, noData }: Props) => { +export const PipelineTable = ({ loading, dataSource, pagination }: Props) => { const [JSON, setJSON] = useState(null); const [id, setId] = useState(null); @@ -72,6 +67,7 @@ export const PipelineTable = ({ dataSource, pagination, noData }: Props) => { { const [page, setPage] = useState(1); const [pageSize] = useState(20); - const { ready, data } = useRefreshData(() => API.pipeline.list()); + const { ready, data } = useRefreshData(() => API.pipeline.list({ page, pageSize }), [page, pageSize]); const [dataSource, total] = useMemo(() => [(data?.pipelines ?? []).map((it) => it), data?.count ?? 0], [data]); @@ -48,9 +48,6 @@ export const Pipelines = () => { pageSize, onChange: setPage, }} - noData={{ - text: 'Add new projects to see engineering metrics based on projects.', - }} /> );