All files / modules/70-pipeline/pages/execution/ExecutionTestView TICallToAction.tsx

100% Statements 16/16
62.5% Branches 5/8
100% Functions 1/1
100% Lines 16/16

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              1x 1x 1x 1x 1x 1x 1x 1x 1x 1x           1x 1x   1x 4x 4x   4x                                                                                  
/*
 * 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 { Text, Container, Heading, Button, Layout, ButtonVariation } from '@wings-software/uicore'
import { Color } from '@harness/design-system'
import { FeatureIdentifier } from 'framework/featureStore/FeatureIdentifier'
import { useFeature } from '@common/hooks/useFeatures'
import { FeatureWarningWithTooltip } from '@common/components/FeatureWarning/FeatureWarningWithTooltip'
import { useStrings } from 'framework/strings'
import tiUpgrade from './images/ti_upgrade.svg'
import css from './BuildTests.module.scss'
 
export interface TICallToActionProps {
  type?: string
}
 
const setUpTIDocs = 'https://ngdocs.harness.io/article/428cs02e6u'
const aboutTIDocs = 'https://ngdocs.harness.io/article/vtu9k1dsfa-test-intelligence-concepts'
 
export function TICallToAction(_props: TICallToActionProps): React.ReactElement {
  const { getString } = useStrings()
  const canUseTI = useFeature({ featureRequest: { featureName: FeatureIdentifier.TEST_INTELLIGENCE } })
 
  return (
    <div className={cx(css.widgetWrapper, css.tiCallToActionWrapper)}>
      <Container style={{ paddingTop: 'var(--spacing-3)' }} className={css.widget} height="100%">
        <Layout.Horizontal spacing="medium">
          <Container className={css.tiUpgradeImage}>
            <img height={123} width={90} src={tiUpgrade} />
          </Container>
          <Layout.Vertical style={{ justifyContent: 'space-between', height: '170px' }} width={378}>
            <Container width={334}>
              <Heading width={314} color={Color.BLACK} level={5}>
                {getString('pipeline.testsReports.tiCallToAction.header')}
              </Heading>
              <Text color={Color.BLACK} className={css.subText}>
                {canUseTI
                  ? getString('pipeline.testsReports.tiCallToAction.utilizeTISubText')
                  : getString('pipeline.testsReports.tiCallToAction.upsellSubText')}
              </Text>
              {canUseTI && <Text color={Color.GREY_500}>Support for .Net and Python coming soon!</Text>}
            </Container>
            <Layout.Horizontal spacing="medium" className={css.actionsContainer}>
              <a rel="noreferrer" target="_blank" href={canUseTI ? setUpTIDocs : aboutTIDocs}>
                <Button className={css.findOutMoreBtn} variation={ButtonVariation.PRIMARY}>
                  {getString('common.findOutMore')}
                </Button>
              </a>
              {canUseTI ? (
                <Text style={{ fontSize: '13px' }} color={Color.PRIMARY_7}>
                  {getString('pipeline.testsReports.tiCallToAction.addRunTestsStep')}
                </Text>
              ) : (
                <Container className={css.upgradeRequiredWrapper}>
                  <FeatureWarningWithTooltip featureName={FeatureIdentifier.TEST_INTELLIGENCE} />
                </Container>
              )}
            </Layout.Horizontal>
          </Layout.Vertical>
        </Layout.Horizontal>
      </Container>
    </div>
  )
}