Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherry-pick #7830 fix: not set page and pageSize for pipelines #7837

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading