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 | 110x 110x 110x 110x 110x 110x 110x 110x 110x 110x 110x 110x 9x 9x 9x 9x 9x 9x 9x 9x | /* * 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 cx from 'classnames' import { isEmpty } from 'lodash-es' import { FormInput, getMultiTypeFromValue, MultiTypeInputType } from '@wings-software/uicore' import { useStrings } from 'framework/strings' import { FormMultiTypeDurationField } from '@common/components/MultiTypeDuration/MultiTypeDuration' import { useVariablesExpression } from '@pipeline/components/PipelineStudio/PiplineHooks/useVariablesExpression' import { FormMultiTypeTextAreaField } from '@common/components' import { FormMultiTypeUserGroupInput } from '@common/components/UserGroupsInput/FormMultitypeUserGroupInput' import { isApprovalStepFieldDisabled } from '../Common/ApprovalCommons' import type { HarnessApprovalDeploymentModeProps } from './types' import css from './HarnessApproval.module.scss' /* Used for input sets and deployment form Provide values for all runtime fields in approval step Open the same form in readonly view while viewing already run executions */ export default function HarnessApprovalDeploymentMode(props: HarnessApprovalDeploymentModeProps): JSX.Element { const { inputSetData, allowableTypes, formik } = props const template = inputSetData?.template const path = inputSetData?.path const prefix = isEmpty(path) ? '' : `${path}.` const readonly = inputSetData?.readonly const { getString } = useStrings() const { expressions } = useVariablesExpression() return ( <React.Fragment> {getMultiTypeFromValue(template?.timeout) === MultiTypeInputType.RUNTIME ? ( <FormMultiTypeDurationField name={`${isEmpty(inputSetData?.path) ? '' : `${inputSetData?.path}.`}timeout`} label={getString('pipelineSteps.timeoutLabel')} className={css.deploymentViewMedium} multiTypeDurationProps={{ enableConfigureOptions: false, allowableTypes, expressions, disabled: isApprovalStepFieldDisabled(readonly) }} disabled={isApprovalStepFieldDisabled(readonly)} /> ) : null} {getMultiTypeFromValue(template?.spec?.approvalMessage) === MultiTypeInputType.RUNTIME ? ( <FormMultiTypeTextAreaField className={cx(css.approvalMessage, css.deploymentViewMedium)} label={getString('pipeline.approvalStep.message')} name={`${prefix}spec.approvalMessage`} disabled={isApprovalStepFieldDisabled(readonly)} multiTypeTextArea={{ expressions, allowableTypes }} /> ) : null} {typeof template?.spec?.approvers?.userGroups === 'string' && getMultiTypeFromValue(template?.spec?.approvers?.userGroups) === MultiTypeInputType.RUNTIME ? ( <div className={css.deploymentViewMedium}> <FormMultiTypeUserGroupInput expressions={expressions} formik={formik} allowableTypes={allowableTypes} name={`${prefix}spec.approvers.userGroups`} label={getString('common.userGroups')} disabled={isApprovalStepFieldDisabled(readonly)} tooltipProps={{ dataTooltipId: 'harnessApprovalRuntime_userGroups' }} /> </div> ) : null} {typeof template?.spec?.approvers?.minimumCount === 'string' && getMultiTypeFromValue(template?.spec?.approvers?.minimumCount) === MultiTypeInputType.RUNTIME ? ( <FormInput.MultiTextInput label={getString('pipeline.approvalStep.minimumCount')} name={`${prefix}spec.approvers.minimumCount`} multiTextInputProps={{ disabled: isApprovalStepFieldDisabled(readonly), expressions, allowableTypes, textProps: { type: 'number' } }} className={css.deploymentViewMedium} /> ) : null} </React.Fragment> ) } |