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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x 24x 4x 3x 3x 4x | /* * Copyright 2022 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 { merge } from 'lodash-es' import { Tabs, Tab } from '@harness/uicore' import { useStrings } from 'framework/strings' import { isExecutionWaitingForIntervention } from '@pipeline/utils/statusHelpers' import type { StepDetailProps } from '@pipeline/factories/ExecutionFactory/types' import { PolicyEvaluationTab } from '@pipeline/components/execution/StepDetails/tabs/PolicyEvaluationTab/PolicyEvaluationTab' import { InputOutputTab } from '@pipeline/components/execution/StepDetails/tabs/InputOutputTab/InputOutputTab' import { ManualInterventionTab } from '@pipeline/components/execution/StepDetails/tabs/ManualInterventionTab/ManualInterventionTab' import { Strategy } from '@pipeline/utils/FailureStrategyUtils' import { allowedStrategiesAsPerStep } from '@pipeline/components/PipelineSteps/AdvancedSteps/FailureStrategyPanel/StrategySelection/StrategyConfig' import { StageType } from '@pipeline/utils/stageHelpers' import { StepMode } from '@pipeline/utils/stepUtils' import css from '../DefaultView/DefaultView.module.scss' enum StepDetailTab { STEP_DETAILS = 'STEP_DETAILS', INPUT = 'INPUT', OUTPUT = 'OUTPUT', MANUAL_INTERVENTION = 'MANUAL_INTERVENTION' } export function PolicyEvaluationView(props: StepDetailProps): React.ReactElement { const { step, stageType = StageType.DEPLOY } = props const { getString } = useStrings() const [activeTab, setActiveTab] = React.useState(StepDetailTab.STEP_DETAILS) const manuallySelected = React.useRef(false) const isManualInterruption = isExecutionWaitingForIntervention(step.status) const failureStrategies = allowedStrategiesAsPerStep(stageType)[StepMode.STEP].filter( st => st !== Strategy.ManualIntervention ) React.useEffect(() => { // istanbul ignore else if (!manuallySelected.current) { setActiveTab(isManualInterruption ? StepDetailTab.MANUAL_INTERVENTION : StepDetailTab.STEP_DETAILS) } }, [step.identifier, isManualInterruption]) return ( <div className={css.tabs}> <Tabs id="step-details" selectedTabId={activeTab} onChange={newTab => { manuallySelected.current = true setActiveTab(newTab as StepDetailTab) }} renderAllTabPanels={false} > <Tab id={StepDetailTab.STEP_DETAILS} title={getString('details')} panel={<PolicyEvaluationTab step={step} />} /> <Tab id={StepDetailTab.INPUT} title={getString('common.input')} panel={<InputOutputTab baseFqn={step.baseFqn} mode="input" data={step.stepParameters} />} /> <Tab id={StepDetailTab.OUTPUT} title={getString('outputLabel')} panel={ <InputOutputTab baseFqn={step.baseFqn} mode="output" data={Array.isArray(step.outcomes) ? { output: merge({}, ...step.outcomes) } : step.outcomes} /> } /> {isManualInterruption ? ( <Tab id={StepDetailTab.MANUAL_INTERVENTION} title={getString('pipeline.failureStrategies.strategiesLabel.ManualIntervention')} panel={<ManualInterventionTab step={step} allowedStrategies={failureStrategies} />} /> ) : null} </Tabs> </div> ) } |