This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a commit to branch release-v1.0
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v1.0 by this push:
new 1340c7df3 fix: incomplete historical pipelines (#8072)
1340c7df3 is described below
commit 1340c7df3aa13e4772101d72c182e686a58d0462
Author: 青湛 <[email protected]>
AuthorDate: Thu Sep 19 20:52:55 2024 +1200
fix: incomplete historical pipelines (#8072)
---
config-ui/src/api/blueprint/index.ts | 2 +-
.../src/routes/blueprint/detail/status-panel.tsx | 42 ++++++++++------------
config-ui/src/routes/pipeline/components/table.tsx | 2 +-
config-ui/src/routes/pipeline/pipelines.tsx | 4 +--
4 files changed, 22 insertions(+), 28 deletions(-)
diff --git a/config-ui/src/api/blueprint/index.ts
b/config-ui/src/api/blueprint/index.ts
index 727c026de..3876d3e20 100644
--- a/config-ui/src/api/blueprint/index.ts
+++ b/config-ui/src/api/blueprint/index.ts
@@ -34,7 +34,7 @@ export const remove = (id: ID) =>
request(`/blueprints/${id}`, { method: 'delete
export const update = (id: ID, data: Partial<IBlueprint>) =>
request(`/blueprints/${id}`, { method: 'patch', data });
-export const pipelines = (id: ID) => request(`/blueprints/${id}/pipelines`);
+export const pipelines = (id: ID, data?: Pagination) =>
request(`/blueprints/${id}/pipelines`, { data });
type TriggerQuery = {
skipCollectors?: boolean;
diff --git a/config-ui/src/routes/blueprint/detail/status-panel.tsx
b/config-ui/src/routes/blueprint/detail/status-panel.tsx
index 7f0f02c33..50be81fe3 100644
--- a/config-ui/src/routes/blueprint/detail/status-panel.tsx
+++ b/config-ui/src/routes/blueprint/detail/status-panel.tsx
@@ -24,9 +24,9 @@ import { Card, Modal, Switch, Button, Tooltip, Dropdown,
Flex, Space } from 'ant
import API from '@/api';
import { Message } from '@/components';
import { getCron, PATHS } from '@/config';
-import { useAutoRefresh } from '@/hooks';
+import { useRefreshData } from '@/hooks';
import { PipelineInfo, PipelineTasks, PipelineTable } from '@/routes/pipeline';
-import { IBlueprint, IPipeline, IPipelineStatus } from '@/types';
+import { IBlueprint } from '@/types';
import { formatTime, operator } from '@/utils';
import { FromEnum } from '../types';
@@ -40,32 +40,17 @@ interface Props {
export const StatusPanel = ({ from, blueprint, pipelineId, onRefresh }: Props)
=> {
const [type, setType] = useState<'delete' | 'fullSync'>();
+ const [page, setPage] = useState(1);
+ const [pageSize] = useState(10);
const [operating, setOperating] = useState(false);
const navigate = useNavigate();
const cron = useMemo(() => getCron(blueprint.isManual,
blueprint.cronConfig), [blueprint]);
- const { loading, data } = useAutoRefresh<IPipeline[]>(
- async () => {
- const res = await API.blueprint.pipelines(blueprint.id);
- return res.pipelines;
- },
- [],
- {
- cancel: (data) =>
- !!(
- data &&
- data.every((it) =>
- [
- IPipelineStatus.COMPLETED,
- IPipelineStatus.PARTIAL,
- IPipelineStatus.CANCELLED,
- IPipelineStatus.FAILED,
- ].includes(it.status),
- )
- ),
- },
+ const { ready, data } = useRefreshData(
+ () => API.blueprint.pipelines(blueprint.id, { page, pageSize }),
+ [blueprint.id, page, pageSize],
);
const handleResetType = () => {
@@ -208,10 +193,19 @@ export const StatusPanel = ({ from, blueprint,
pipelineId, onRefresh }: Props) =
<h3>Historical Pipelines</h3>
- {!data?.length ? (
+ {!data?.count ? (
<Card>There are no historical runs associated with this
blueprint.</Card>
) : (
- <PipelineTable loading={loading} dataSource={data} />
+ <PipelineTable
+ loading={!ready}
+ dataSource={data.pipelines}
+ pagination={{
+ current: page,
+ pageSize,
+ total: data.count,
+ onChange: setPage,
+ }}
+ />
)}
</Space>
diff --git a/config-ui/src/routes/pipeline/components/table.tsx
b/config-ui/src/routes/pipeline/components/table.tsx
index d63ddd6ce..ca16ed890 100644
--- a/config-ui/src/routes/pipeline/components/table.tsx
+++ b/config-ui/src/routes/pipeline/components/table.tsx
@@ -37,7 +37,7 @@ interface Props {
dataSource: IPipeline[];
pagination?: {
total: number;
- page: number;
+ current: number;
pageSize: number;
onChange: (page: number) => void;
};
diff --git a/config-ui/src/routes/pipeline/pipelines.tsx
b/config-ui/src/routes/pipeline/pipelines.tsx
index 4f15b8fbe..3eca563df 100644
--- a/config-ui/src/routes/pipeline/pipelines.tsx
+++ b/config-ui/src/routes/pipeline/pipelines.tsx
@@ -43,9 +43,9 @@ export const Pipelines = () => {
loading={!ready}
dataSource={dataSource}
pagination={{
- total,
- page,
+ current: page,
pageSize,
+ total,
onChange: setPage,
}}
/>