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 | 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 12x 12x 12x 12x 12x 12x 12x 72x 12x 8x 8x 12x | /*
* 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 { merge } from 'lodash-es'
import { Tabs, Tab } from '@wings-software/uicore'
import { useStrings } from 'framework/strings'
import { isExecutionWaitingForIntervention } from '@pipeline/utils/statusHelpers'
import type { StepDetailProps } from '@pipeline/factories/ExecutionFactory/types'
import { StepDetailsTab } from '@pipeline/components/execution/StepDetails/tabs/StepDetailsTab/StepDetailsTab'
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.module.scss'
enum StepDetailTab {
STEP_DETAILS = 'STEP_DETAILS',
INPUT = 'INPUT',
OUTPUT = 'OUTPUT',
MANUAL_INTERVENTION = 'MANUAL_INTERVENTION'
}
export function DefaultView(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 shouldShowInputOutput = ((step?.stepType ?? '') as string) !== 'liteEngineTask'
const isManualInterruption = isExecutionWaitingForIntervention(step.status)
const failureStrategies = allowedStrategiesAsPerStep(stageType)[StepMode.STEP].filter(
st => st !== Strategy.ManualIntervention
)
React.useEffect(() => {
Eif (!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={<StepDetailsTab step={step} />} />
{shouldShowInputOutput && (
<Tab
id={StepDetailTab.INPUT}
title={getString('common.input')}
panel={<InputOutputTab baseFqn={step.baseFqn} mode="input" data={step.stepParameters} />}
/>
)}
{shouldShowInputOutput && (
<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>
)
}
|