import * as React from 'react'; import { Link } from 'react-router-dom'; import { Button, CodeBlock, CodeBlockCode, DescriptionList, DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, } from '@patternfly/react-core'; import { APPLICATION_DETAILS_PATH, COMPONENT_DETAILS_PATH, PIPELINERUN_DETAILS_PATH, TASKRUN_LOGS_PATH, } from '@routes/paths'; import ScanDescriptionListGroup from '~/components/PipelineRun/PipelineRunDetailsView/tabs/ScanDescriptionListGroup'; import { StatusIconWithText } from '~/components/topology/StatusIcon'; import { PipelineRunLabel, runStatus } from '~/consts/pipelinerun'; import { SyncMarkdownView } from '~/shared/components/markdown-view/MarkdownView'; import { ErrorDetailsWithStaticLog } from '~/shared/components/pipeline-run-logs/logs/log-snippet-types'; import { getTRLogSnippet } from '~/shared/components/pipeline-run-logs/logs/pipelineRunLogSnippet'; import { TaskRunInfrastructureDiagnostic } from '~/shared/components/TaskRunInfrastructureDiagnostic'; import { TaskRunKind, TektonResourceLabel } from '~/types'; import { getTaskRunInfrastructureDiagnostic, taskName } from '~/utils/pipeline-utils'; type Props = { taskRun: TaskRunKind; taskRunName: string; applicationName?: string; namespace: string; status: runStatus | null; }; const TaskRunDetailsSection: React.FC = ({ taskRun, taskRunName, applicationName: routeApplicationName, namespace, status, }) => { const taskRunFailed = (getTRLogSnippet(taskRun) || {}) as ErrorDetailsWithStaticLog; const infrastructureDiagnostic = getTaskRunInfrastructureDiagnostic(taskRun); const applicationName = routeApplicationName ?? taskRun?.metadata?.labels?.[PipelineRunLabel.APPLICATION]; const plrName = taskRun?.metadata?.labels?.[TektonResourceLabel.pipelinerun]; return ( {taskRun && taskName(taskRun) && ( Task {taskName(taskRun)} )} Description Status {Object.keys(taskRunFailed).length > 0 && ( <> Message {taskRunFailed.title ?? '-'} Log snippet {taskRunFailed.staticMessage ?? '-'} )} Pipeline run {plrName ? ( {plrName} ) : ( '-' )} Application {applicationName ? ( {applicationName} ) : ( '-' )} Component {taskRun.metadata?.labels?.[PipelineRunLabel.COMPONENT] ? ( applicationName ? ( {taskRun.metadata.labels?.[PipelineRunLabel.COMPONENT]} ) : ( taskRun.metadata.labels?.[PipelineRunLabel.COMPONENT] ) ) : ( '-' )} ); }; export default TaskRunDetailsSection;