All files / modules/85-cv/utils routeUtils.ts

65.22% Statements 15/23
63.04% Branches 29/46
100% Functions 4/4
61.9% Lines 13/21

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              49x   49x   49x       49x             49x 2x                               2x       49x       49x 1x 1x 1x 1x              
/*
 * 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 { StepType } from '@pipeline/components/PipelineSteps/PipelineStepInterface'
import type { PipelineInfoConfig } from 'services/cd-ng'
import { getStepType } from '@pipeline/utils/templateUtils'
 
export const ActivitySourceSetupRoutePaths = {
  KUBERNETES: 'kubernetes',
  HARNESS_CD: 'harness-cd'
}
export const MonitoringSourceSetupRoutePaths = {
  APP_DYNAMICS: 'app-dynamics',
  GOOGLE_CLOUD_OPERATIONS: 'google-cloud-operations',
  NEW_RELIC: 'new-relic',
  PROMETHEUS: 'prometheus'
}
 
export const getRoutePathByType = (type: any) => {
  switch (type) {
    case 'KUBERNETES':
      return ActivitySourceSetupRoutePaths.KUBERNETES
    case 'HARNESS_CD10':
      return ActivitySourceSetupRoutePaths.HARNESS_CD
    case 'APP_DYNAMICS':
      return MonitoringSourceSetupRoutePaths.APP_DYNAMICS
    case 'STACKDRIVER':
      return MonitoringSourceSetupRoutePaths.GOOGLE_CLOUD_OPERATIONS
    case 'STACKDRIVER_LOG':
      return MonitoringSourceSetupRoutePaths.GOOGLE_CLOUD_OPERATIONS
    case 'NEW_RELIC':
      return MonitoringSourceSetupRoutePaths.NEW_RELIC
    case 'PROMETHEUS':
      return MonitoringSourceSetupRoutePaths.PROMETHEUS
    default:
      return ''
  }
}
 
export const editParams = {
  identifier: ':identifier'
}
 
export const isVerifyStepPresent = (pipeline: PipelineInfoConfig): boolean => {
  return !!pipeline?.stages?.some(el =>
    el?.stage?.spec?.execution?.steps?.some(step => {
      Eif (step?.step) {
        return getStepType(step?.step) === StepType.Verify
      } else {
        return false
      }
    })
  )
}