All files / modules/75-ci/pages/get-started-with-ci/InfraProvisioningWizard Constants.ts

100% Statements 24/24
100% Branches 10/10
100% Functions 5/5
100% Lines 24/24

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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116                                4x 4x 4x     4x 4x 4x 4x 4x                                           4x               4x                                                       4x 4x 4x 4x 4x       4x 4x 4x 4x 4x                   4x           4x 4x 4x    
/*
 * 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 type { IconName } from '@harness/uicore'
import type { ConnectorInfoDTO } from 'services/cd-ng'
import type { StringsMap } from 'stringTypes'
 
export interface InfraProvisioningWizardProps {
  lastConfiguredWizardStepId?: InfraProvisiongWizardStepId
  stepMetaData?: Map<string, Record<string, any>>
}
 
export const enum Hosting {
  SaaS = 'SAAS',
  OnPrem = 'ON_PREM'
}
 
export const enum BuildLocation {
  HostedByHarness = 'HOSTED_BY_HARNESS',
  Kubernetes = 'KUBERNETES',
  AWS = 'AWS',
  DockerRunner = 'DOCKER_RUNNER'
}
 
export interface BuildLocationDetails {
  icon: IconName
  location: BuildLocation
  label: keyof StringsMap
  details: keyof StringsMap
  approxETAInMins: number
  disabled?: boolean
}
 
export interface WizardStep {
  stepRender: React.ReactElement
  onClickNext?: () => void
  onClickBack?: () => void
  stepFooterLabel?: keyof StringsMap
}
 
export interface SelectBuildLocationProps {
  selectedBuildLocation: BuildLocationDetails
}
export const HostedByHarnessBuildLocation: BuildLocationDetails = {
  icon: 'harness',
  location: BuildLocation.HostedByHarness,
  label: 'ci.getStartedWithCI.hostedByHarness',
  details: 'ci.getStartedWithCI.hostedByHarnessBuildLocation',
  approxETAInMins: 2
}
 
export const AllBuildLocations: BuildLocationDetails[] = [
  HostedByHarnessBuildLocation,
  {
    icon: 'app-kubernetes',
    location: BuildLocation.Kubernetes,
    label: 'kubernetesText',
    details: 'ci.getStartedWithCI.k8sBuildLocation',
    approxETAInMins: 12,
    disabled: true
  },
  {
    icon: 'service-aws',
    location: BuildLocation.AWS,
    label: 'common.aws',
    details: 'ci.getStartedWithCI.awsBuildLocation',
    approxETAInMins: 15,
    disabled: true
  },
  {
    icon: 'docker-step',
    location: BuildLocation.DockerRunner,
    label: 'ci.getStartedWithCI.dockerRunner',
    details: 'ci.getStartedWithCI.dockerRunnerBuildLocation',
    approxETAInMins: 2,
    disabled: true
  }
]
 
export enum InfraProvisiongWizardStepId {
  SelectBuildLocation = 'SELECT_BUILD_LOCATION',
  SelectGitProvider = 'SELECT_GIT_PROVIDER',
  SelectGitProviderWithAuthenticationMethod = 'SELECT_GIT_PROVIDER_WITH_AUTHENTICATION_METHOD',
  SelectRepository = 'SELECT_REPOSITORY'
}
 
// TODO Need to use exported StepStatus from uicore -> MultiStepProgressIndicator component
export enum StepStatus {
  ToDo = 'TODO',
  InProgress = 'INPROGRESS',
  Failed = 'FAILED',
  Success = 'SUCCESS'
}
 
export interface GitProvider {
  icon: IconName
  label: keyof StringsMap
  type: ConnectorInfoDTO['type']
  disabled?: boolean
}
 
export const AllGitProviders: GitProvider[] = [
  { icon: 'github', label: 'common.repo_provider.githubLabel', type: 'Github' },
  { icon: 'gitlab', label: 'common.repo_provider.gitlabLabel', type: 'Gitlab', disabled: true },
  { icon: 'bitbucket-blue', label: 'common.repo_provider.bitbucketLabel', type: 'Bitbucket', disabled: true }
]
 
export enum GitAuthenticationMethod {
  OAuth = 'OAUTH',
  AccessToken = 'ACCESS_TOKEN'
}