Skip to content

Commit

Permalink
Removed Started at date
Browse files Browse the repository at this point in the history
  • Loading branch information
pnaik1 committed Oct 26, 2023
1 parent c0dca01 commit d73145a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { relativeDuration } from '~/utilities/time';
import {
asTimestamp,
DetailItem,
isEmptyDateKF,
renderDetailItems,
} from '~/concepts/pipelines/content/pipelinesDetails/pipelineRun/utils';
type PipelineRunTabDetailsProps = {
Expand All @@ -24,7 +25,6 @@ const PipelineRunTabDetails: React.FC<PipelineRunTabDetailsProps> = ({
workflowName,
}) => {
const { namespace, project } = usePipelinesAPI();

if (!pipelineRunKF || !workflowName) {
return (
<EmptyState variant={EmptyStateVariant.large} data-id="loading-empty-state">
Expand Down Expand Up @@ -62,10 +62,11 @@ const PipelineRunTabDetails: React.FC<PipelineRunTabDetailsProps> = ({
{ 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)) },
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -43,3 +44,8 @@ export const asTimestamp = (date: Date): React.ReactNode => (
</FlexItem>
</Flex>
);

export const isEmptyDateKF = (date: DateTimeKF): boolean => {
const INVALID_TIMESTAMP = '1970-01-01T00:00:00Z';
return date === INVALID_TIMESTAMP ? true : false;
};

0 comments on commit d73145a

Please sign in to comment.