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 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 4x 4x 4x 4x 4x 4x 4x | /* * 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 type { ApprovalInstanceResponse, JiraApprovalInstanceDetails } from 'services/pipeline-ng' import { Duration } from '@common/exports' import { ApprovalStatus } from '@pipeline/utils/approvalUtils' import { String } from 'framework/strings' export type ApprovalData = | (ApprovalInstanceResponse & { details: JiraApprovalInstanceDetails }) | null export interface JiraApprovalTabProps { approvalData: ApprovalData isWaiting: boolean } import ExecutionStatusLabel from '@pipeline/components/ExecutionStatusLabel/ExecutionStatusLabel' import { JiraCriteria } from './JiraCriteria/JiraCriteria' import headerCss from '@pipeline/pages/execution/ExecutionPipelineView/ExecutionGraphView/ExecutionStageDetailsHeader/ExecutionStageDetailsHeader.module.scss' import css from './JiraApprovalTab.module.scss' export function JiraApprovalTab(props: JiraApprovalTabProps): React.ReactElement { const { approvalData, isWaiting } = props const wasApproved = !isWaiting && approvalData?.status === ApprovalStatus.APPROVED const wasRejected = !isWaiting && (approvalData?.status === ApprovalStatus.REJECTED || approvalData?.status === ApprovalStatus.EXPIRED) const wasFailed = !isWaiting && approvalData?.status === ApprovalStatus.FAILED const jiraKey = approvalData?.details.issue.key const jiraUrl = approvalData?.details.issue.url return ( <React.Fragment> {wasFailed ? ( <div className={headerCss.errorMsgWrapper}> <ExecutionStatusLabel status={'Failed'} /> <div className={headerCss.errorMsg}> <String className={headerCss.errorTitle} stringID="errorSummaryText" tagName="div" /> <p>{approvalData?.errorMessage}</p> </div> </div> ) : ( <div className={css.info} data-type="jira"> {isWaiting ? ( <> <div className={css.timer}> <Duration className={css.duration} durationText="" icon="hourglass" startTime={approvalData?.deadline} iconProps={{ size: 8 }} /> <String stringID="pipeline.timeRemainingSuffix" /> </div> {jiraKey && jiraUrl ? ( <div className={css.jiraTicket}> <String stringID="pipeline.jiraApprovalStep.execution.jiraTicket" /> <a href={jiraUrl} target="_blank" rel="noopener noreferrer"> {jiraKey} </a> </div> ) : null} </> ) : null} {wasApproved && jiraUrl && jiraKey ? ( <div className={css.jiraTicket}> <String stringID="pipeline.jiraApprovalStep.execution.wasApproved" /> <a href={jiraUrl} target="_blank" rel="noopener noreferrer"> {jiraKey} </a> </div> ) : null} {wasRejected && jiraUrl && jiraKey ? ( <div className={css.jiraTicket}> {approvalData?.status === ApprovalStatus.REJECTED ? ( <String stringID="pipeline.jiraApprovalStep.execution.wasRejected" /> ) : null} {approvalData?.status === ApprovalStatus.EXPIRED ? ( <String stringID="pipeline.jiraApprovalStep.execution.wasExpired" /> ) : null} <a href={jiraUrl} target="_blank" rel="noopener noreferrer"> {jiraKey} </a> </div> ) : null} </div> )} <div className={css.jiraApproval}> {approvalData?.details?.approvalCriteria ? ( <JiraCriteria type="approval" criteria={approvalData.details.approvalCriteria} /> ) : null} {approvalData?.details?.rejectionCriteria ? ( <JiraCriteria type="rejection" criteria={approvalData.details.rejectionCriteria} /> ) : null} </div> </React.Fragment> ) } |