All files / modules/30-delegates/components/CreateDelegate/DelegateSelectStep/Prerequisites/K8sPrerequisites K8sPrerequisites.tsx

100% Statements 15/15
66.67% Branches 4/6
100% Functions 2/2
100% Lines 15/15

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              2x 2x   2x 2x 2x 2x   2x   2x 2x 2x 2x       2x   2x                                                               2x                                                       2x  
/*
 * 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 { useParams, Link } from 'react-router-dom'
 
import { Layout, Text, Container } from '@wings-software/uicore'
import { Color } from '@harness/design-system'
import { useStrings } from 'framework/strings'
import { DelegateSizeDetails, useGetDelegateSizes } from 'services/portal'
import type { ProjectPathProps } from '@common/interfaces/RouteInterfaces'
import css from './K8sPrerequisites.module.scss'
 
const K8sPrerequisites = () => {
  const { getString } = useStrings()
  const { accountId, orgIdentifier, projectIdentifier } = useParams<ProjectPathProps>()
  const { data: delegateSizes } = useGetDelegateSizes({
    queryParams: { accountId, orgId: orgIdentifier, projectId: projectIdentifier }
  })
 
  const delegateSizeMappings: DelegateSizeDetails[] | undefined = delegateSizes?.resource || []
 
  return (
    <>
      <Text className={css.prereq}>{getString('delegate.kubernetes.prerequisites')}</Text>
      <Container
        style={{
          display: 'flex',
          flexDirection: 'column',
          justifyContent: 'space-between',
          flex: 1,
          height: '340px',
          fontSize: '13px',
          lineHeight: '20px',
          /* or 154% */
 
          letterSpacing: '0.233333px'
        }}
      >
        <Text font={{ size: 'normal' }} className={css.preReqContent}>
          {getString('delegate.kubernetes.prerequisites_info1')}
        </Text>
 
        <Container>
          <Text className={css.preReqContent}>
            {getString('delegate.kubernetes.prerequisites_info2')}
            <Link color={Color.BLUE_600} to="https://app.harness.io" target="_blank">
              https://app.harness.io
            </Link>
          </Text>
        </Container>
        <Text className={css.preReqContent}>{getString('delegate.kubernetes.prerequisites_info3')}</Text>
        <Container>
          {delegateSizeMappings.map(size => (
            <Layout.Horizontal key={size.label}>
              <Text inline className={css.preReqContent} icon="arrow-right" iconProps={{ size: 8 }}>
                {getString('delegate.kubernetes.prerequisites_worload', {
                  ...size,
                  ram: (Number(size.ram) / 1000).toFixed(1)
                })}
              </Text>
            </Layout.Horizontal>
          ))}
        </Container>
        <Text className={css.preReqContent}>{getString('delegate.kubernetes.permissions_title')}</Text>
        <Container>
          <Layout.Horizontal>
            <Text className={css.preReqContent} icon="arrow-right" iconProps={{ size: 8 }}>
              {getString('delegate.kubernetes.permissions_info1')}
            </Text>
          </Layout.Horizontal>
          <Layout.Horizontal>
            <Text className={css.preReqContent} icon="arrow-right" iconProps={{ size: 8 }}>
              {getString('delegate.kubernetes.permissions_info2')}
            </Text>
          </Layout.Horizontal>
        </Container>
      </Container>
    </>
  )
}
 
export default K8sPrerequisites