All files / modules/70-pipeline/components/RunPipelineModal ReplacedExpressionInputForm.tsx

88.89% Statements 8/9
28.57% Branches 2/7
50% Functions 1/2
88.89% Lines 8/9

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              31x 31x 31x 31x 31x                 192x   192x                                                 31x  
/*
 * 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 { Text, Label, Layout, TextInput } from '@wings-software/uicore'
import { FontVariation } from '@harness/design-system'
import { useStrings } from 'framework/strings'
import css from './RunPipelineForm.module.scss'
interface ReplacedExpressionInputFormProps {
  expressions?: string[]
  updateExpressionValue: React.FormEventHandler<HTMLElement>
}
function ReplacedExpressionInputForm({
  expressions = [],
  updateExpressionValue
}: ReplacedExpressionInputFormProps): React.ReactElement | null {
  const { getString } = useStrings()
 
  return expressions.length > 0 ? (
    <Layout.Vertical className={css.replaceExpressionForm}>
      <Text
        font={{
          variation: FontVariation.FORM_TITLE
        }}
      >
        {getString('pipeline.replacedExpressions')}
      </Text>
 
      <div className={css.form}>
        {expressions?.map((exprName: string) => (
          <Layout.Vertical key={exprName}>
            <Label>
              <Text width={300} lineClamp={1}>
                {exprName}
              </Text>
            </Label>
            <TextInput name={exprName} onChange={updateExpressionValue} />
          </Layout.Vertical>
        ))}
      </div>
    </Layout.Vertical>
  ) : null
}
export default ReplacedExpressionInputForm