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

100% Statements 9/9
100% Branches 4/4
100% Functions 1/1
100% Lines 9/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 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              32x 32x 32x 32x 32x 32x                     151x 151x                                                                                                 32x  
/*
 * 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, { FormEvent } from 'react'
import { PopoverPosition, Radio, RadioGroup } from '@blueprintjs/core'
import { Icon, Layout, Text } from '@wings-software/uicore'
import cx from 'classnames'
import { useStrings } from 'framework/strings'
import css from './RunPipelineForm.module.scss'
 
interface SelectExistingInputsOrProvideNewProps {
  existingProvide: string
  onExistingProvideRadioChange: (e: FormEvent<HTMLInputElement>) => void
}
 
function SelectExistingInputsOrProvideNew({
  existingProvide,
  onExistingProvideRadioChange
}: SelectExistingInputsOrProvideNewProps): React.ReactElement {
  const { getString } = useStrings()
  return (
    <div>
      <Layout.Horizontal className={css.runModalSubHeading} id="use-input-set">
        <RadioGroup
          name="existingProvideRadio"
          label={getString('pipeline.pipelineInputPanel.selectedExisitingOrProvide')}
          inline
          selectedValue={existingProvide}
          onChange={onExistingProvideRadioChange}
        >
          <Radio
            label={getString('pipeline.pipelineInputPanel.provide')}
            value="provide"
            className={cx(css.valueProviderRadio, existingProvide === 'provide' ? css.selectedValueProvider : '')}
          />
          <Radio
            label={getString('pipeline.pipelineInputPanel.existing')}
            value="existing"
            className={cx(css.valueProviderRadio, existingProvide === 'existing' ? css.selectedValueProvider : '')}
          />
        </RadioGroup>
        <span className={css.helpSection}>
          <Icon name="question" className={css.helpIcon} intent="primary" />
          <Text
            data-testid="input-set-description-tooltip"
            tooltipProps={{
              position: PopoverPosition.BOTTOM
            }}
            tooltip={
              <Text padding="medium" width={400}>
                {getString('pipeline.inputSets.aboutInputSets')}
                <a
                  href="https://ngdocs.harness.io/article/3fqwa8et3d-input-sets"
                  target="_blank"
                  rel="noopener noreferrer"
                >
                  {getString('learnMore')}
                </a>
              </Text>
            }
          >
            {getString('pipeline.pipelineInputPanel.whatAreInputsets')}
          </Text>
        </span>
      </Layout.Horizontal>
    </div>
  )
}
 
export default SelectExistingInputsOrProvideNew