diff --git a/src/components/Job/JobDetailsSingleJob.tsx b/src/components/Job/JobDetailsSingleJob.tsx index a6a2e77e5f70e447adfaa70de5455982cac031e6..53ff1fa421158f373e00e98ee0d75f4b5d27825e 100644 --- a/src/components/Job/JobDetailsSingleJob.tsx +++ b/src/components/Job/JobDetailsSingleJob.tsx @@ -1,15 +1,30 @@ -import { Stack } from "@mui/material"; import { InternalLink, KeyValueTable } from "@ess-ics/ce-ui-common"; -import { calculateHostText } from "./JobUtils"; -import { JobGitRefLink } from "./JobGitRefLink"; -import { JobGitRefIcon } from "./JobGitRefIcon"; +import { calculateHostText, isDeploymentJob } from "./JobUtils"; +import { JobRevisionChip } from "./JobRevisionChip"; import { JobDetails } from "../../store/deployApi"; interface JobDetailsSingleJobProps { job: JobDetails; } -const getSingleOperationFields = (operation: JobDetails) => { +const getRevision = (operation: JobDetails) => { + return { + revision: + operation.gitReference && operation.gitProjectId ? ( + <JobRevisionChip + gitReference={operation.gitReference} + gitProjectId={operation.gitProjectId} + /> + ) : ( + "Unknown" + ) + }; +}; + +const getSingleOperationFields = ( + operation: JobDetails, + isDeployJob: boolean +) => { return { ioc: ( <InternalLink @@ -19,34 +34,16 @@ const getSingleOperationFields = (operation: JobDetails) => { {operation.iocName} </InternalLink> ), - revision: - operation.gitReference && operation.gitProjectId ? ( - <Stack - flexDirection="row" - alignItems="center" - gap={0.5} - > - <JobGitRefIcon - gitReference={operation.gitReference} - gitProjectId={operation.gitProjectId} - /> - <JobGitRefLink - gitReference={operation.gitReference} - gitProjectId={operation.gitProjectId} - disableExternalLinkIcon - /> - </Stack> - ) : ( - "Unknown" - ), + ...(isDeployJob && getRevision(operation)), host: calculateHostText(operation) }; }; export const JobDetailsSingleJob = ({ job }: JobDetailsSingleJobProps) => { + const isDeployJob = isDeploymentJob(job.action); return ( <KeyValueTable - obj={getSingleOperationFields(job)} + obj={getSingleOperationFields(job, isDeployJob)} variant="overline" sx={{ border: 0 }} valueOptions={{ headerName: "" }}