Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 20x 2x 20x 44x 44x 44x 44x 44x 44x 44x | /* * Copyright 2021 Harness Inc. All rights reserved. * Use of this source code is governed by the PolyForm Shield 1.0.0 license * that can be found in the licenses directory at the root of this repository, also available at * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt. */ import React from 'react' import { useHistory } from 'react-router-dom' import { Popover, IPopoverProps } from '@blueprintjs/core' import cx from 'classnames' import { Icon } from '@wings-software/uicore' import { ExecutionStatusIconMap as IconMap, getStageType } from '@pipeline/utils/executionUtils' import { ExecutionStatus, isExecutionNotStarted } from '@pipeline/utils/statusHelpers' import routes from '@common/RouteDefinitions' import type { ModulePathParams, PipelinePathProps } from '@common/interfaces/RouteInterfaces' import type { GraphLayoutNode } from 'services/pipeline-ng' import CDInfo from '@pipeline/pages/execution/ExecutionPipelineView/ExecutionGraphView/ExecutionGraph/components/CD/CDInfo/CDInfo' import StageHeader from '@pipeline/pages/execution/ExecutionPipelineView/ExecutionGraphView/ExecutionGraph/components/StageHeader' import css from './MiniExecutionGraph.module.scss' export function RunningIcon(): React.ReactElement { return ( <div className={css.runningAnimation}> <div /> <div /> <div /> </div> ) } export interface StageNodeProps extends Omit<IPopoverProps, 'content'>, PipelinePathProps, ModulePathParams { stage: GraphLayoutNode planExecutionId: string } export function StageNode(props: StageNodeProps): React.ReactElement { const { accountId, orgIdentifier, projectIdentifier, pipelineIdentifier, module, stage, planExecutionId, ...rest } = props const { status } = stage || {} const statusLower = status?.toLowerCase() || '' const history = useHistory() const stageType = getStageType(stage) function getOnStageClick(stageId: string) { return (e: React.MouseEvent<HTMLDivElement>): void => { e.stopPropagation() e.preventDefault() const path = routes.toExecutionPipelineView({ accountId, module, orgIdentifier, pipelineIdentifier, projectIdentifier, executionIdentifier: planExecutionId }) if (!isExecutionNotStarted(status)) { history.push(`${path}?stage=${stageId}`) } } } return ( <Popover position="top" {...rest} className={cx(css.stageWrapper, css[statusLower as keyof typeof css])} targetClassName={css.stage} targetTagName="div" wrapperTagName="div" targetProps={{ onClick: getOnStageClick(stage.nodeUuid || '') }} interactionKind="hover" hoverOpenDelay={1000} > {stage.status === 'Running' ? ( <RunningIcon /> ) : ( <Icon name={IconMap[stage.status as ExecutionStatus] || IconMap.NotStarted} size={13} className={css.icon} /> )} <div className={css.infoPopover}> <StageHeader data={{ name: stage.name, status: stage.status, data: stage }} /> {stageType === 'cd' && <CDInfo data={{ data: stage }} />} </div> </Popover> ) } |