From fa8e1a7c95b038cfda93b6507813b27c438759a2 Mon Sep 17 00:00:00 2001 From: Felix Edel Date: Wed, 20 Oct 2021 09:38:32 +0200 Subject: [PATCH] UI: Fix gant chart on buildset page for missing timestamps Currently, the "Builds Timeline" gant chart on the buildset result page is broken when at least one build doesn't provide the required time information (e.g. SKIPPED builds). index.js:1 Warning: Received NaN for the `x1` attribute. If this is expected, cast the value to a string. in line (created by Line) in Line in LineSegment in g in g in VictoryAxis (created by ChartAxis) in ChartAxis (at GanttChart.jsx:88) ... To fix this, we fill the missing timestamp information with 0 values. Change-Id: I3ec6a36a3cfcf818127b827543fd7b8ecf5d785a --- web/src/containers/charts/GanttChart.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/containers/charts/GanttChart.jsx b/web/src/containers/charts/GanttChart.jsx index dfbf3b6aac..5ac065fce3 100644 --- a/web/src/containers/charts/GanttChart.jsx +++ b/web/src/containers/charts/GanttChart.jsx @@ -43,8 +43,8 @@ function BuildsetGanttChart(props) { const data = sortedByStartTime.map((build) => { return { x: build.job_name, - y0: (moment.utc(build.start_time).tz(timezone) - origin) / 1000, - y: (moment.utc(build.end_time).tz(timezone) - origin) / 1000, + y0: build.start_time ? (moment.utc(build.start_time).tz(timezone) - origin) / 1000 : 0, + y: build.end_time ? (moment.utc(build.end_time).tz(timezone) - origin) / 1000 : 0, result: build.result, started: moment.utc(build.start_time).tz(timezone).format('YYYY-MM-DD HH:mm:ss'), ended: moment.utc(build.end_time).tz(timezone).format('YYYY-MM-DD HH:mm:ss'),