Skip to content

Commit

Permalink
fix: not set page and pageSize for pipelines (#7830) (#7837)
Browse files Browse the repository at this point in the history
Co-authored-by: 青湛 <0x1304570@gmail.com>
  • Loading branch information
github-actions[bot] and mintsweet authored Aug 6, 2024
1 parent b1cb790 commit cd6a80c
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 cd6a80c

Please sign in to comment.