Skip to content

Commit 4d6a557

Browse files
lokanandaprabhuvikram-raj
authored andcommitted
Resolved overview page breaking issue for empty response
1 parent a3fe891 commit 4d6a557

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/components/pipelines-overview/PipelineRunsStatusCard.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,31 +296,31 @@ const PipelinesRunsStatusCard: React.FC<PipelinesRunsStatusCardProps> = ({
296296
{
297297
x: t('Succeeded'),
298298
y: Math.round(
299-
(100 * data?.summary?.[0].succeeded) / data?.summary?.[0].total,
299+
(100 * data?.summary?.[0]?.succeeded) / data?.summary?.[0]?.total,
300300
),
301301
},
302302
{
303303
x: t('Failed'),
304304
y: Math.round(
305-
(100 * data?.summary?.[0].failed) / data?.summary?.[0].total,
305+
(100 * data?.summary?.[0]?.failed) / data?.summary?.[0]?.total,
306306
),
307307
},
308308
{
309309
x: t('Running'),
310310
y: Math.round(
311-
(100 * data?.summary?.[0].running) / data?.summary?.[0].total,
311+
(100 * data?.summary?.[0]?.running) / data?.summary?.[0]?.total,
312312
),
313313
},
314314
{
315315
x: t('Cancelled'),
316316
y: Math.round(
317-
(100 * data?.summary?.[0].cancelled) / data?.summary?.[0].total,
317+
(100 * data?.summary?.[0]?.cancelled) / data?.summary?.[0]?.total,
318318
),
319319
},
320320
{
321321
x: t('Others'),
322322
y: Math.round(
323-
(100 * data?.summary?.[0].others) / data?.summary?.[0].total,
323+
(100 * data?.summary?.[0]?.others) / data?.summary?.[0]?.total,
324324
),
325325
},
326326
];
@@ -397,7 +397,9 @@ const PipelinesRunsStatusCard: React.FC<PipelinesRunsStatusCardProps> = ({
397397
}}
398398
/>
399399
}
400-
title={`${data?.summary?.[0].succeeded}/${data?.summary?.[0].total}`}
400+
title={`${data?.summary?.[0]?.succeeded ?? 0}/${
401+
data?.summary?.[0]?.total ?? 0
402+
}`}
401403
titleComponent={
402404
<ChartLabel
403405
style={{

src/components/pipelines-overview/PipelineRunsTotalCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const PipelinesRunsTotalCard: React.FC<PipelinesRunsDurationProps> = ({
6767
)
6868
.then((response) => {
6969
setLoaded(true);
70-
setData(response.summary?.[0].total);
70+
setData(response?.summary?.[0]?.total);
7171
})
7272
.catch((e) => {
7373
console.error('Error in getSummary', e);

0 commit comments

Comments
 (0)