import * as React from 'react'; import { DescriptionList, DescriptionListGroup, DescriptionListTerm, DescriptionListDescription, Flex, FlexItem, } from '@patternfly/react-core'; import GitRepoLink from '~/components/GitLink/GitRepoLink'; import HelpPopover from '~/components/HelpPopover'; import { useLatestPushBuildPipelineRunForComponentV2 } from '~/hooks/useLatestPushBuildPipeline'; import { useIsImageControllerEnabled } from '~/image-controller/conditional-checks'; import { ImageUrlDisplay } from '~/shared/components/image-display'; import { useNamespace } from '~/shared/providers/Namespace/useNamespaceInfo'; import { ComponentKind } from '~/types'; import { getLastestImage } from '~/utils/component-utils'; import { getPipelineRunStatusResults } from '~/utils/pipeline-utils'; import ComponentImageRepositoryVisibility from './ComponentImageRepositoryVisibility'; type ComponentDetailsProps = { component: ComponentKind; }; const RESULT_NAME = 'IMAGE_URL'; const ComponentDetails: React.FC> = ({ component, }) => { const namespace = useNamespace(); const [latestPushBuildPLR, pipelineRunLoaded, error] = useLatestPushBuildPipelineRunForComponentV2(namespace, component.metadata.name); const results = !error && pipelineRunLoaded && latestPushBuildPLR?.status ? getPipelineRunStatusResults(latestPushBuildPLR) : null; const latestImageURL = results?.find((result) => result.name === RESULT_NAME); const componentImageURL = latestImageURL?.value ?? getLastestImage(component); // Check if image controller is enabled for this cluster const { isImageControllerEnabled } = useIsImageControllerEnabled(); return ( {component.spec.source?.git && ( Source code )} {isImageControllerEnabled && ( Image repository visibility{' '} Controls whether the built container images are publicly accessible or private.

Pull and push secrets are automatically created and managed by the image controller for your build pipelines. } />
)} {componentImageURL && ( Latest image{' '} For private repositories, shows the proxied URL when available, otherwise shows the original URL.

Use with the 'Registry Login Information' below to pull private images. } />
)}
); }; export default ComponentDetails;