From 23343a4d1b97c93f3378c4e4999e0fb44f2a12fb Mon Sep 17 00:00:00 2001 From: Nathan Vieira Marcelino Date: Mon, 8 Apr 2024 11:19:13 -0300 Subject: [PATCH 1/2] fix: run report page missing request --- .../components/ResultsReport/index.tsx | 29 +++++++++++-------- .../components/ResultsReport/skeleton.tsx | 17 +++++++---- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/frontend/src/features/myWorkflows/components/ResultsReport/index.tsx b/frontend/src/features/myWorkflows/components/ResultsReport/index.tsx index ada0fa96..dc64b596 100644 --- a/frontend/src/features/myWorkflows/components/ResultsReport/index.tsx +++ b/frontend/src/features/myWorkflows/components/ResultsReport/index.tsx @@ -31,11 +31,8 @@ dayjs.extend(duration); export const ResultsReport: React.FC = () => { const { id, runId } = useParams<{ id: string; runId: string }>(); const { workspace } = useWorkspaces(); + const navigate = useNavigate(); - const { data } = useRunReport({ - workflowId: id, - runId, - }); const isPrint = useMediaQuery("print"); @@ -51,8 +48,14 @@ export const ResultsReport: React.FC = () => { workspaceId: workspace?.id, }); + const { data: runReport } = useRunReport({ + workspaceId: workspace?.id, + workflowId: id, + runId, + }); + const { startDate, endDate, duration } = useMemo(() => { - if (!data?.data) { + if (!runReport?.data) { return { startDate: null, endDate: null, @@ -60,8 +63,10 @@ export const ResultsReport: React.FC = () => { }; } - const startDate = dayjs(data?.data[0]?.start_date); - const endDate = dayjs(data?.data[data?.data.length - 1]?.end_date); + const startDate = dayjs(runReport?.data[0]?.start_date); + const endDate = dayjs( + runReport?.data[runReport?.data.length - 1]?.end_date, + ); const durationRaw = dayjs.duration(endDate.diff(startDate)); @@ -78,9 +83,9 @@ export const ResultsReport: React.FC = () => { endDate: endDate.format("YYYY-MM-DD HH:mm:ss"), duration: formattedDuration, }; - }, [data]); + }, [runReport]); - if (!data?.data) { + if (!runReport?.data) { return ; } @@ -111,7 +116,7 @@ export const ResultsReport: React.FC = () => { Pieces : - {data?.data.map((task, idx) => ( + {runReport?.data.map((task, idx) => (
{ /> - {idx !== data?.data.length - 1 ? : null} + {idx !== runReport?.data.length - 1 ? : null}
))}
@@ -238,7 +243,7 @@ export const ResultsReport: React.FC = () => { - {data?.data.map((d, i) => ( + {runReport?.data.map((d, i) => ( { + const navigate = useNavigate(); + const array = Array(5).fill(0); return ( @@ -29,11 +32,16 @@ export const ResultsReportSkeleton: React.FC = () => { }} > - - + @@ -42,9 +50,8 @@ export const ResultsReportSkeleton: React.FC = () => { {array.map((_, idx) => ( - <> +
@@ -53,7 +60,7 @@ export const ResultsReportSkeleton: React.FC = () => { {idx !== array.length - 1 ? : null} - +
))}
From 34cf4536aa66df09d9721bbc23a44663e4d4bd13 Mon Sep 17 00:00:00 2001 From: vinicvaz Date: Mon, 8 Apr 2024 11:22:14 -0300 Subject: [PATCH 2/2] mb --- .../src/features/myWorkflows/components/ResultsReport/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/features/myWorkflows/components/ResultsReport/index.tsx b/frontend/src/features/myWorkflows/components/ResultsReport/index.tsx index dc64b596..5a5abef8 100644 --- a/frontend/src/features/myWorkflows/components/ResultsReport/index.tsx +++ b/frontend/src/features/myWorkflows/components/ResultsReport/index.tsx @@ -156,7 +156,7 @@ export const ResultsReport: React.FC = () => { justifyContent="center" alignItems="center" > - + {" "}