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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 21x 21x 21x 21x 21x 21x 21x 21x 5x | /* * 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, useParams } from 'react-router-dom' import { isEmpty } from 'lodash-es' import { ButtonSize, ButtonVariation } from '@wings-software/uicore' import routes from '@common/RouteDefinitions' import { Duration } from '@common/components/Duration/Duration' import { useDocumentTitle } from '@common/hooks/useDocumentTitle' import ExecutionStatusLabel from '@pipeline/components/ExecutionStatusLabel/ExecutionStatusLabel' import ExecutionActions from '@pipeline/components/ExecutionActions/ExecutionActions' import { formatDatetoLocale } from '@common/utils/dateUtils' import { PermissionIdentifier } from '@rbac/interfaces/PermissionIdentifier' import GitPopover from '@pipeline/components/GitPopover/GitPopover' import { String, useStrings } from 'framework/strings' import { GitSyncStoreProvider } from 'framework/GitRepoStore/GitSyncStoreContext' import { usePermission } from '@rbac/hooks/usePermission' import RbacButton from '@rbac/components/Button/Button' import { ResourceType } from '@rbac/interfaces/ResourceType' import type { ExecutionPathProps, PipelineType } from '@common/interfaces/RouteInterfaces' import type { ExecutionStatus } from '@pipeline/utils/statusHelpers' import { useExecutionContext } from '@pipeline/context/ExecutionContext' import { TagsPopover } from '@common/components' import { NGBreadcrumbs } from '@common/components/NGBreadcrumbs/NGBreadcrumbs' import RetryHistory from '@pipeline/components/RetryPipeline/RetryHistory/RetryHistory' import css from './ExecutionHeader.module.scss' export function ExecutionHeader(): React.ReactElement { const { orgIdentifier, projectIdentifier, executionIdentifier, accountId, pipelineIdentifier, module } = useParams<PipelineType<ExecutionPathProps>>() const { refetch, pipelineExecutionDetail, selectedStageId, selectedStepId, allNodeMap, isPipelineInvalid } = useExecutionContext() const { getString } = useStrings() const { pipelineExecutionSummary = {} } = pipelineExecutionDetail || {} const history = useHistory() const [canEdit, canExecute] = usePermission( { resourceScope: { accountIdentifier: accountId, orgIdentifier, projectIdentifier }, resource: { resourceType: ResourceType.PIPELINE, resourceIdentifier: pipelineIdentifier as string }, permissions: [PermissionIdentifier.EDIT_PIPELINE, PermissionIdentifier.EXECUTE_PIPELINE] }, [orgIdentifier, projectIdentifier, accountId, pipelineIdentifier] ) useDocumentTitle([ `${pipelineExecutionSummary.name || getString('pipelines')} ${getString( module === 'cd' ? 'execution.pipelineIdentifierTextCD' : 'execution.pipelineIdentifierTextCI', pipelineExecutionSummary )}` ]) return ( <header className={css.header}> <div className={css.headerTopRow}> <NGBreadcrumbs links={[ { url: routes.toPipelines({ orgIdentifier, projectIdentifier, accountId, module }), label: getString('pipelines') }, { url: routes.toPipelineDeploymentList({ orgIdentifier, projectIdentifier, pipelineIdentifier, accountId, module, branch: pipelineExecutionSummary?.gitDetails?.branch, repoIdentifier: pipelineExecutionSummary?.gitDetails?.repoIdentifier }), label: pipelineExecutionSummary.name || getString('common.pipeline') } ]} /> <div className={css.actionsBar}> {pipelineExecutionSummary.status ? ( <ExecutionStatusLabel status={pipelineExecutionSummary.status as ExecutionStatus} /> ) : null} {pipelineExecutionSummary.startTs && ( <div className={css.startTime}> <String tagName="div" className={css.startTimeText} stringID="pipeline.startTime" /> <span>{formatDatetoLocale(pipelineExecutionSummary.startTs)}</span> </div> )} <Duration className={css.duration} startTime={pipelineExecutionSummary.startTs} endTime={pipelineExecutionSummary.endTs} icon="time" iconProps={{ size: 12 }} durationText={' '} /> {pipelineExecutionSummary.showRetryHistory && ( <RetryHistory canExecute={canExecute} showRetryHistory={pipelineExecutionSummary.showRetryHistory} canRetry={pipelineExecutionSummary.canRetry || false} /> )} <RbacButton variation={ButtonVariation.SECONDARY} size={ButtonSize.SMALL} permission={{ resourceScope: { orgIdentifier, projectIdentifier, accountIdentifier: accountId }, resource: { resourceType: ResourceType.PIPELINE, resourceIdentifier: pipelineIdentifier as string }, permission: PermissionIdentifier.VIEW_PIPELINE }} text={getString('common.viewText')} icon="main-view" onClick={ev => { ev.stopPropagation() const allNodes = Object.values(allNodeMap) const matchedStepNode = allNodes?.find(eachNode => eachNode.uuid === selectedStepId) const matchedStageNode = allNodes?.find(eachNode => eachNode.setupId === selectedStageId) history.push( routes.toPipelineStudio({ orgIdentifier, projectIdentifier, pipelineIdentifier, accountId, module, repoIdentifier: pipelineExecutionSummary?.gitDetails?.repoIdentifier, branch: pipelineExecutionSummary?.gitDetails?.branch, stageId: matchedStageNode?.identifier, stepId: matchedStepNode?.identifier }) ) }} /> <ExecutionActions executionStatus={pipelineExecutionSummary.status as ExecutionStatus} refetch={refetch} params={{ orgIdentifier, pipelineIdentifier, projectIdentifier, accountId, executionIdentifier, module, repoIdentifier: pipelineExecutionSummary?.gitDetails?.repoIdentifier, branch: pipelineExecutionSummary?.gitDetails?.branch, stagesExecuted: pipelineExecutionSummary?.stagesExecuted }} isPipelineInvalid={isPipelineInvalid} canEdit={canEdit} showEditButton={false} canExecute={canExecute} canRetry={pipelineExecutionSummary.canRetry} modules={pipelineExecutionSummary.modules} /> </div> </div> <div className={css.titleContainer}> <div className={css.title}>{pipelineExecutionSummary.name}</div> <String tagName="div" className={css.pipelineId} stringID={module === 'cd' ? 'execution.pipelineIdentifierTextCD' : 'execution.pipelineIdentifierTextCI'} vars={pipelineExecutionSummary} /> {!isEmpty(pipelineExecutionSummary?.tags) ? ( <TagsPopover iconProps={{ size: 14 }} className={css.tags} popoverProps={{ wrapperTagName: 'div', targetTagName: 'div' }} tags={(pipelineExecutionSummary?.tags || []).reduce((val, tag) => { return Object.assign(val, { [tag.key]: tag.value }) }, {} as { [key: string]: string })} /> ) : null} {pipelineExecutionSummary.gitDetails ? ( <GitSyncStoreProvider> <GitPopover data={pipelineExecutionSummary.gitDetails} popoverProps={{ targetTagName: 'div', wrapperTagName: 'div', className: css.git }} /> </GitSyncStoreProvider> ) : null} </div> </header> ) } |