From d73145aaeb8611ca61c00167a63381f54e9ebb64 Mon Sep 17 00:00:00 2001 From: pnaik1 Date: Thu, 21 Sep 2023 15:58:50 +0530 Subject: [PATCH] Removed Started at date --- .../pipelineRun/PipelineRunTabDetails.tsx | 9 +++++---- .../content/pipelinesDetails/pipelineRun/utils.tsx | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunTabDetails.tsx b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunTabDetails.tsx index ac4bb06fe5..fd21f192fe 100644 --- a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunTabDetails.tsx +++ b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/PipelineRunTabDetails.tsx @@ -12,6 +12,7 @@ import { relativeDuration } from '~/utilities/time'; import { asTimestamp, DetailItem, + isEmptyDateKF, renderDetailItems, } from '~/concepts/pipelines/content/pipelinesDetails/pipelineRun/utils'; type PipelineRunTabDetailsProps = { @@ -24,7 +25,6 @@ const PipelineRunTabDetails: React.FC = ({ workflowName, }) => { const { namespace, project } = usePipelinesAPI(); - if (!pipelineRunKF || !workflowName) { return ( @@ -62,10 +62,11 @@ const PipelineRunTabDetails: React.FC = ({ { key: 'Workflow name', value: workflowName }, { key: 'Created at', value: asTimestamp(new Date(pipelineRunKF.created_at)) }, { - key: 'Started at', - value: asTimestamp(new Date(pipelineRunKF.scheduled_at || pipelineRunKF.created_at)), + key: 'Finished at', + value: isEmptyDateKF(pipelineRunKF.finished_at) + ? 'N/A' + : asTimestamp(new Date(pipelineRunKF.finished_at)), }, - { key: 'Finished at', value: asTimestamp(new Date(pipelineRunKF.finished_at)) }, { key: 'Duration', value: relativeDuration(getRunDuration(pipelineRunKF)) }, ]; diff --git a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/utils.tsx b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/utils.tsx index b4b18c6cca..be441c93f1 100644 --- a/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/utils.tsx +++ b/frontend/src/concepts/pipelines/content/pipelinesDetails/pipelineRun/utils.tsx @@ -9,6 +9,7 @@ import { TimestampFormat, } from '@patternfly/react-core'; import { GlobeAmericasIcon } from '@patternfly/react-icons'; +import { DateTimeKF } from '~/concepts/pipelines/kfTypes'; export type DetailItem = { key: string; @@ -43,3 +44,8 @@ export const asTimestamp = (date: Date): React.ReactNode => ( ); + +export const isEmptyDateKF = (date: DateTimeKF): boolean => { + const INVALID_TIMESTAMP = '1970-01-01T00:00:00Z'; + return date === INVALID_TIMESTAMP ? true : false; +};