Skip to content

Commit

Permalink
fix: not set page and pageSize for pipelines (#7830)
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsweet authored Aug 6, 2024
1 parent 938e22c commit 2566dd3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
3 changes: 2 additions & 1 deletion config-ui/src/api/pipeline/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand Down
8 changes: 2 additions & 6 deletions config-ui/src/routes/pipeline/components/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>(null);
const [id, setId] = useState<ID | null>(null);

Expand All @@ -72,6 +67,7 @@ export const PipelineTable = ({ dataSource, pagination, noData }: Props) => {
<Table
rowKey="id"
size="middle"
loading={loading}
columns={[
{
title: 'ID',
Expand Down
5 changes: 1 addition & 4 deletions config-ui/src/routes/pipeline/pipelines.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const Pipelines = () => {
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]);

Expand All @@ -48,9 +48,6 @@ export const Pipelines = () => {
pageSize,
onChange: setPage,
}}
noData={{
text: 'Add new projects to see engineering metrics based on projects.',
}}
/>
</PageHeader>
);
Expand Down

0 comments on commit 2566dd3

Please sign in to comment.