import * as React from 'react'; import { Link } from 'react-router-dom'; import { DescriptionList, DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, DrawerActions, DrawerCloseButton, DrawerHead, DrawerPanelBody, } from '@patternfly/react-core'; import { GithubIcon } from '@patternfly/react-icons/dist/esm/icons/github-icon'; import { ElementModel, GraphElement } from '@patternfly/react-topology'; import { useNamespace } from '~/shared/providers/Namespace'; import { COMPONENT_DETAILS_PATH } from '../../../../routes/paths'; import ExternalLink from '../../../../shared/components/links/ExternalLink'; import { Timestamp } from '../../../../shared/components/timestamp/Timestamp'; import { Commit } from '../../../../types'; import { createRepoBranchURL, createRepoPullRequestURL } from '../../../../utils/commits-utils'; import { StatusIconWithTextLabel } from '../../../topology/StatusIcon'; import CommitLabel from '../../commit-label/CommitLabel'; import { CommitIcon } from '../../CommitIcon'; import { CommitWorkflowNodeModelData } from '../visualization/commit-visualization-types'; export interface CommitSidePanelBodyProps { onClose: () => void; workflowNode: GraphElement; } const CommitSidePanel: React.FC> = ({ workflowNode, onClose, }) => { const namespace = useNamespace(); const workflowData = workflowNode.getData(); const commit = workflowData.resource as Commit; if (!commit) { return null; } return ( <> {' '} {commit.shaTitle} Source code Commit ID {commit.isPullRequest ? ( <> Pull request {createRepoPullRequestURL(commit) ? ( ) : ( commit.pullRequestNumber )} ) : null} Created at By {commit.user} Component {commit.components.map((component, index) => { return ( {component} {index < commit.components.length - 1 && ','} ); })} Branch {createRepoBranchURL(commit) ? ( ) : ( `${commit.branch}` )} ); }; export default CommitSidePanel;