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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 7x 6x 7x 6x 6x 1x | /* * 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 { Layout } from '@wings-software/uicore' import { identity, uniqBy } from 'lodash-es' import { String } from 'framework/strings' import type { ExecutionCardInfoProps } from '@pipeline/factories/ExecutionFactory/types' import type { CDPipelineModuleInfo, CDStageModuleInfo, ServiceExecutionSummary } from 'services/cd-ng' import { getPipelineStagesMap } from '@pipeline/utils/executionUtils' import { ServicesList } from '../CDExecutionSummary/ServicesList' import { EnvironmentsList } from '../CDExecutionSummary/EnvironmentsList' import css from './CDExecutionCardSummary.module.scss' const SERVICES_LIMIT = 3 const ENV_LIMIT = 3 export function CDExecutionCardSummary(props: ExecutionCardInfoProps): React.ReactElement { const { data, nodeMap, startingNodeId } = props const serviceIdentifiers: string[] = ((data as CDPipelineModuleInfo)?.serviceIdentifiers as string[]) || [] const { servicesMap, environments } = React.useMemo(() => { const stagesMap = getPipelineStagesMap(nodeMap, startingNodeId) const serviceMapObj: ServiceExecutionSummary[] = [] const environmentsList: string[] = [] stagesMap.forEach(stage => { const stageInfo = stage.moduleInfo?.cd || ({} as CDStageModuleInfo) const serviceInfo = stageInfo?.serviceInfo if (stageInfo.infraExecutionSummary?.name || stageInfo.infraExecutionSummary?.identifier) { environmentsList.push(stageInfo.infraExecutionSummary.name || stageInfo.infraExecutionSummary.identifier) } // istanbul ignore else if (serviceInfo?.identifier) { serviceMapObj.push(serviceInfo) } }) return { servicesMap: uniqBy(serviceMapObj, s => s.identifier), environments: uniqBy(environmentsList, identity) } }, [nodeMap, startingNodeId]) return ( <Layout.Horizontal spacing="medium"> <div className={css.cardSummary}> <String tagName="div" className={css.heading} stringID="pipeline.executionList.servicesDeployedText" vars={{ size: serviceIdentifiers.length }} /> <ServicesList className={css.service} services={servicesMap} limit={SERVICES_LIMIT} /> </div> <div className={css.cardSummary}> <String tagName="div" className={css.heading} stringID="pipeline.executionList.EnvironmentsText" vars={{ size: environments.length }} /> <EnvironmentsList className={css.environment} environments={environments} limit={ENV_LIMIT} /> </div> </Layout.Horizontal> ) } |