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 | 82x 82x 82x 82x 82x 82x 82x 82x 21x 21x 22x 22x 31x 22x 1x 82x | /* * 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 cx from 'classnames' import { connect, FormikContext } from 'formik' import { filter, get } from 'lodash-es' import { Container, ExpressionAndRuntimeType, MultiTypeInputType } from '@wings-software/uicore' import { MonacoTextField } from '@common/components/MonacoTextField/MonacoTextField' import multiBtnCss from '@common/components/MultiTypeTextArea/MultiTypeTextArea.module.scss' import css from './MultiTypeExecutionCondition.module.scss' interface MultiTypeExecutionConditionProps { path: string allowableTypes?: MultiTypeInputType[] formik?: FormikContext<any> isInputDisabled?: boolean readonly?: boolean multiType?: MultiTypeInputType setMultiType?: (multiType: MultiTypeInputType) => void expressions: string[] } function MultiTypeMonacoTextFieldFixedTypeComponent(props: { readonly: boolean name: string expressions: string[] }): React.ReactElement { const { readonly, name, expressions } = props return ( <Container style={{ flexGrow: 1 }}> <MonacoTextField name={name} expressions={expressions} disabled={readonly} /> </Container> ) } function MultiTypeExecutionConditionInternal(props: MultiTypeExecutionConditionProps) { const { path, formik, allowableTypes, isInputDisabled, readonly, multiType, setMultiType, expressions } = props const conditionValue = get(formik?.values, path) const allowableTypesExceptExpression = filter(allowableTypes, type => type !== MultiTypeInputType.EXPRESSION) return ( <Container className={cx(css.conditionInputContainer)}> <ExpressionAndRuntimeType name={path} value={conditionValue} fixedTypeComponentProps={{ readonly: !!isInputDisabled, name: path, expressions: expressions }} fixedTypeComponent={MultiTypeMonacoTextFieldFixedTypeComponent} style={{ flexGrow: 1 }} allowableTypes={allowableTypesExceptExpression} onChange={val => formik?.setFieldValue(path, val)} onTypeChange={setMultiType} btnClassName={multiType === MultiTypeInputType.FIXED ? multiBtnCss.multiButtonForFixedType : ''} multitypeInputValue={multiType} disabled={readonly} /> </Container> ) } export const MultiTypeExecutionCondition = connect(MultiTypeExecutionConditionInternal) |