import { FC, PropsWithChildren, useCallback } from 'react'; import { DescriptionList, DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, Flex, FlexItem, ModalVariant, } from '@patternfly/react-core'; import { ComponentProps, createModalLauncher } from '~/components/modal/createModalLauncher'; import { useModalLauncher } from '~/components/modal/ModalProvider'; import { PipelineRunLabel } from '~/consts/pipelinerun'; import { Timestamp } from '~/shared'; import { PipelineRunKind } from '~/types'; import { MintmakerLogs } from './MintmakerLogs'; import './MintmakerLogViewer.scss'; type MintmakerLogViewerProps = ComponentProps & { dependencyRun: PipelineRunKind; }; export const MintmakerLogViewer: FC> = ({ dependencyRun, }) => ( Component {dependencyRun.metadata?.labels?.[PipelineRunLabel.MINTMAKER_COMPONENT_LABEL] ?? '-'} Mintmaker pipeline run {dependencyRun.metadata?.name ?? '-'} Started ); export const mintmakerLogViewerLauncher = createModalLauncher(MintmakerLogViewer, { className: 'mintmaker-log-viewer', 'data-test': 'view-mintmaker-logs-modal', variant: ModalVariant.large, }); export const useMintmakerLogViewerModal = (dependencyRun: PipelineRunKind) => { const showModal = useModalLauncher(); return useCallback( () => showModal(mintmakerLogViewerLauncher({ dependencyRun })), [dependencyRun, showModal], ); };