All files / modules/85-cv/pages/slos/components/CVCreateSLO CVCreateSLO.types.ts

100% Statements 59/59
100% Branches 20/20
100% Functions 10/10
100% Lines 59/59

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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163                                        16x 16x 16x 16x     16x 16x 16x     16x 16x 16x     16x 16x 16x     16x 16x 16x 16x 16x     16x 16x 16x 16x     16x 16x 16x     16x 16x 16x 16x     16x 16x 16x 16x 16x 16x 16x 16x     16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x                                                                                                                                    
/*
 * 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 { FormikProps } from 'formik'
import type {
  ServiceLevelIndicatorDTO,
  ServiceLevelIndicatorSpec,
  ThresholdSLIMetricSpec,
  RatioSLIMetricSpec,
  SLOTarget,
  CalenderSLOTargetSpec,
  WeeklyCalendarSpec
} from 'services/cv'
import type { SLOTargetChartWithAPIGetSliGraphProps } from '@cv/pages/slos/components/SLOTargetChart/SLOTargetChart.types'
import type { SelectOption } from '@pipeline/components/PipelineSteps/Steps/StepsTypes'
 
export enum CreateSLOTabs {
  NAME = 'NAME',
  SLI = 'SLI',
  SLO_TARGET_BUDGET_POLICY = 'SLO_TARGET_BUDGET_POLICY'
}
 
export enum SLITypes {
  AVAILABILITY = 'Availability',
  LATENCY = 'Latency'
}
 
export enum SLIMetricTypes {
  THRESHOLD = 'Threshold',
  RATIO = 'Ratio'
}
 
export enum SLIEventTypes {
  GOOD = 'Good',
  BAD = 'Bad'
}
 
export enum Comparators {
  LESS = '<',
  GREATER = '>',
  LESS_EQUAL = '<=',
  GREATER_EQUAL = '>='
}
 
export enum SLIMissingDataTypes {
  GOOD = 'Good',
  BAD = 'Bad',
  IGNORE = 'Ignore'
}
 
export enum PeriodTypes {
  ROLLING = 'Rolling',
  CALENDAR = 'Calender'
}
 
export enum PeriodLengthTypes {
  WEEKLY = 'Weekly',
  MONTHLY = 'Monthly',
  QUARTERLY = 'Quarterly'
}
 
export enum Days {
  MONDAY = 'Mon',
  TUESDAY = 'Tue',
  WEDNESDAY = 'Wed',
  THURSDAY = 'Thu',
  FRIDAY = 'Fri',
  SATURDAY = 'Sat',
  SUNDAY = 'Sun'
}
 
export const enum SLOFormFields {
  NAME = 'name',
  IDENTIFIER = 'identifier',
  DESCRIPTION = 'description',
  TAGS = 'tags',
  USER_JOURNEY_REF = 'userJourneyRef',
  MONITORED_SERVICE_REF = 'monitoredServiceRef',
  HEALTH_SOURCE_REF = 'healthSourceRef',
  SLI_TYPE = 'SLIType',
  SLI_METRIC_TYPE = 'SLIMetricType',
  EVENT_TYPE = 'eventType',
  VALID_REQUEST_METRIC = 'validRequestMetric',
  GOOD_REQUEST_METRIC = 'goodRequestMetric',
  OBJECTIVE_VALUE = 'objectiveValue',
  OBJECTIVE_COMPARATOR = 'objectiveComparator',
  SLI_MISSING_DATA_TYPE = 'SLIMissingDataType',
  PERIOD_TYPE = 'periodType',
  PERIOD_LENGTH = 'periodLength',
  PERIOD_LENGTH_TYPE = 'periodLengthType',
  DAY_OF_MONTH = 'dayOfMonth',
  DAY_OF_WEEK = 'dayOfWeek',
  SLO_TARGET_PERCENTAGE = 'SLOTargetPercentage'
}
 
export interface SLIForm {
  [SLOFormFields.SLI_TYPE]: ServiceLevelIndicatorDTO['type']
  [SLOFormFields.SLI_METRIC_TYPE]?: ServiceLevelIndicatorSpec['type']
  [SLOFormFields.EVENT_TYPE]?: RatioSLIMetricSpec['eventType']
  [SLOFormFields.VALID_REQUEST_METRIC]: string
  [SLOFormFields.GOOD_REQUEST_METRIC]?: string
  [SLOFormFields.OBJECTIVE_VALUE]?: number
  [SLOFormFields.OBJECTIVE_COMPARATOR]?: ThresholdSLIMetricSpec['thresholdType']
  [SLOFormFields.SLI_MISSING_DATA_TYPE]: ServiceLevelIndicatorDTO['sliMissingDataType']
  [SLOFormFields.NAME]?: string
  [SLOFormFields.IDENTIFIER]?: string
  [SLOFormFields.HEALTH_SOURCE_REF]?: string
}
 
export interface SLOForm extends SLIForm {
  [SLOFormFields.NAME]: string
  [SLOFormFields.IDENTIFIER]: string
  [SLOFormFields.DESCRIPTION]?: string
  [SLOFormFields.TAGS]?: { [key: string]: string }
  [SLOFormFields.USER_JOURNEY_REF]: string
  [SLOFormFields.MONITORED_SERVICE_REF]: string
  [SLOFormFields.HEALTH_SOURCE_REF]: string
  [SLOFormFields.PERIOD_TYPE]?: SLOTarget['type']
  [SLOFormFields.PERIOD_LENGTH]?: string
  [SLOFormFields.PERIOD_LENGTH_TYPE]?: CalenderSLOTargetSpec['type']
  [SLOFormFields.DAY_OF_MONTH]?: string
  [SLOFormFields.DAY_OF_WEEK]?: WeeklyCalendarSpec['dayOfWeek']
  [SLOFormFields.SLO_TARGET_PERCENTAGE]: number
}
 
export interface CreateSLOFormProps {
  formikProps: FormikProps<SLOForm>
  loading?: boolean
  createOrUpdateLoading?: boolean
  error?: string
  retryOnError: () => Promise<void>
  handleRedirect: () => void
}
 
export interface NavButtonsProps {
  loading?: boolean
}
 
export interface SLONameProps {
  children: JSX.Element
  formikProps: FormikProps<SLOForm>
  identifier?: string
  monitoredServicesLoading: boolean
  monitoredServicesOptions: SelectOption[]
  fetchingMonitoredServices: () => void
}
 
export interface SLIProps
  extends Omit<SLOTargetChartWithAPIGetSliGraphProps, 'serviceLevelIndicator' | 'monitoredServiceIdentifier'> {
  children: JSX.Element
  formikProps: FormikProps<SLOForm>
}
 
export interface SLOTargetAndBudgetPolicyProps
  extends Omit<SLOTargetChartWithAPIGetSliGraphProps, 'serviceLevelIndicator' | 'monitoredServiceIdentifier'> {
  children: JSX.Element
  formikProps: FormikProps<SLOForm>
}