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 | 26x 26x 26x 26x 26x 26x 26x 26x 26x 26x 15x 15x 15x 15x 15x 15x | /* * 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 React, { useContext, useState } from 'react' import { SelectOption, Container } from '@wings-software/uicore' import type { CustomHealthMetricDefinition } from 'services/cv' import { useStrings } from 'framework/strings' import { NameId } from '@common/components/NameIdDescriptionTags/NameIdDescriptionTags' import { SetupSourceTabsContext } from '@cv/components/CVSetupSourcesView/SetupSourceTabs/SetupSourceTabs' import { GroupName } from '@cv/pages/health-source/common/GroupName/GroupName' import { initializeGroupNames } from '@cv/pages/health-source/common/GroupName/GroupName.utils' import { CustomHealthSourceFieldNames } from '../../CustomHealthSource.constants' import type { MapMetricsToServicesInterface } from './MapMetricsToServices.types' import css from './MapMetricsToServices.module.scss' export default function MapMetricsToServices({ onChange, formValue, mappedMetrics, selectedMetric }: MapMetricsToServicesInterface): JSX.Element { const { getString } = useStrings() const { sourceData: { existingMetricDetails } } = useContext(SetupSourceTabsContext) const [groupNames, setGroupName] = useState<SelectOption[]>(initializeGroupNames(mappedMetrics, getString)) const metricDefinitions = existingMetricDetails?.spec?.metricDefinitions const currentSelectedMetricDetail = metricDefinitions?.find( (metricDefinition: CustomHealthMetricDefinition) => metricDefinition.metricName === mappedMetrics.get(selectedMetric || '')?.metricName ) return ( <Container className={css.main}> <NameId nameLabel={getString('cv.monitoringSources.metricNameLabel')} identifierProps={{ inputName: CustomHealthSourceFieldNames.METRIC_NAME, idName: CustomHealthSourceFieldNames.METRIC_IDENTIFIER, isIdentifierEditable: Boolean(!currentSelectedMetricDetail?.identifier) }} /> <GroupName groupNames={groupNames} onChange={onChange} item={formValue?.groupName} setGroupNames={setGroupName} /> </Container> ) } |