diff --git a/src/components/Job/JobDetails.tsx b/src/components/Job/JobDetails.tsx index 454ad5e353ea7a45d2285adddd7fb378e919d77d..1a60b195736de7fd898fc5f885589258ffa517c4 100644 --- a/src/components/Job/JobDetails.tsx +++ b/src/components/Job/JobDetails.tsx @@ -16,14 +16,11 @@ import { } from "@ess-ics/ce-ui-common"; import { JobBadge } from "./JobBadge"; import { DeploymentJobOutput } from "../deployments/DeploymentJobOutput"; -import { JobGitRefIcon } from "./JobTable/JobGitRefIcon"; -import { JobGitRefLink } from "./JobTable/JobGitRefLink"; -import { AWXJobDetails, Status } from "../../api/DataTypes"; - -interface JobDetailsProps { - operation: OperationDetails; - job: AwxJobDetails; -} +import { JobGitRefIcon } from "./JobGitRefIcon"; +import { JobGitRefLink } from "./JobGitRefLink"; +import AccessControl from "../auth/AccessControl"; +import { AWXJobDetails } from "../../api/DataTypes"; +import { JobStatusStepper } from "./JobStatus"; const createAlert = (type: Status, message: string) => { return { diff --git a/src/components/Job/JobTable/JobGitRefIcon.js b/src/components/Job/JobGitRefIcon.js similarity index 81% rename from src/components/Job/JobTable/JobGitRefIcon.js rename to src/components/Job/JobGitRefIcon.js index abf97c78ea2acc664476f0776e35d9a5d80d41d6..ec2b1b6bb77fb069c85599bf1f6e3fcf53408258 100644 --- a/src/components/Job/JobTable/JobGitRefIcon.js +++ b/src/components/Job/JobGitRefIcon.js @@ -1,10 +1,10 @@ import { useContext, useMemo } from "react"; -import { apiContext } from "../../../api/DeployApi"; +import { apiContext } from "../../api/DeployApi"; import { useAPIMethod } from "@ess-ics/ce-ui-common"; import { Skeleton } from "@mui/material"; -import { GitRefTypeIcon } from "../../common/Git/GitRefTypeIcon"; +import { GitRefTypeIcon } from "../common/Git/GitRefTypeIcon"; -export const JobGitRefIcon = ({ job, fontSize }) => { +export const JobGitRefIcon = ({ job, fontSize = null }) => { const client = useContext(apiContext); const params = useMemo( () => ({ diff --git a/src/components/Job/JobTable/JobGitRefLink.js b/src/components/Job/JobGitRefLink.js similarity index 93% rename from src/components/Job/JobTable/JobGitRefLink.js rename to src/components/Job/JobGitRefLink.js index dce748983ec8724e630d9144946ce57949293629..edd460cf7a8c0fd5b4e17d4d4f09147b663b9b89 100644 --- a/src/components/Job/JobTable/JobGitRefLink.js +++ b/src/components/Job/JobGitRefLink.js @@ -1,6 +1,6 @@ import { useContext, useMemo } from "react"; -import { GitRefLink } from "../../common/Git/GitRefLink"; -import { apiContext } from "../../../api/DeployApi"; +import { GitRefLink } from "../common/Git/GitRefLink"; +import { apiContext } from "../../api/DeployApi"; import { useAPIMethod } from "@ess-ics/ce-ui-common"; import { Skeleton } from "@mui/material"; diff --git a/src/components/Job/JobRevisionChip.tsx b/src/components/Job/JobRevisionChip.tsx new file mode 100644 index 0000000000000000000000000000000000000000..f4ecc68e5831ed2950c47baf819ee88bb37ccd87 --- /dev/null +++ b/src/components/Job/JobRevisionChip.tsx @@ -0,0 +1,31 @@ +import { PagedOperationResponse } from "../../store/deployApi"; +import { Chip } from "@mui/material"; +import { JobGitRefIcon } from "./JobGitRefIcon"; +import { JobGitRefLink } from "./JobGitRefLink"; + +interface JobRevisionChipProps { + job: PagedOperationResponse; +} + +export const JobRevisionChip = ({ job }: JobRevisionChipProps) => { + return ( + <Chip + sx={{ + padding: "8px", + gap: "4px", + "& .MuiChip-label": { + paddingLeft: "0", + paddingRight: "0" + } + }} + size="small" + icon={<JobGitRefIcon job={job} />} + label={ + <JobGitRefLink + job={job} + disableExternalLinkIcon + /> + } + /> + ); +}; diff --git a/src/components/Job/JobTable/JobDetailsColumn.js b/src/components/Job/JobTable/JobDetailsColumn.js new file mode 100644 index 0000000000000000000000000000000000000000..d1eb0c2994721c57c362e647d98eaa7c1983b8fd --- /dev/null +++ b/src/components/Job/JobTable/JobDetailsColumn.js @@ -0,0 +1,62 @@ +import { Stack, Typography } from "@mui/material"; +import { InternalLink } from "@ess-ics/ce-ui-common"; +import { JobTypeIcon } from "../JobIcons"; +import { JobRevisionChip } from "../JobRevisionChip"; + +export const JobDetailsColumn = ({ job, colorStyle }) => { + return ( + <Stack> + <JobTypeIcon + type={job.type} + colorStyle={colorStyle} + labelPosition="right" + /> + {/* TODO: Fix hard coded job types in next commit */} + {job.type !== "BATCH_DEPLOY" || job.type !== "BATCH_UNDEPLOY" ? ( + <Stack> + <Stack + flexDirection="row" + gap={1} + alignItems="center" + > + <InternalLink + to={`/iocs/${job.iocId}`} + label={`IOC Details, ${job.iocName}`} + > + {job.iocName} + </InternalLink> + {job.type === "DEPLOY" && <JobRevisionChip job={job} />} + </Stack> + <Stack + flexDirection="row" + gap={1} + alignItems="baseline" + > + <InternalLink + to={`/hosts/${job?.host?.hostId}`} + label={`Host details, ${job.host?.hostName}`} + > + {job.host.hostName} + </InternalLink> + <Typography variant="body2">{job.host.network}</Typography> + </Stack> + </Stack> + ) : ( + <Stack> + <Typography + variant="body2" + sx={{ width: "30px" }} + > + {job.noOfIOCs} IOCs + </Typography> + <Typography + variant="body2" + sx={{ width: "30px" }} + > + {job.noOfHosts} Hosts + </Typography> + </Stack> + )} + </Stack> + ); +}; diff --git a/src/components/Job/JobTable/JobHostColumn.js b/src/components/Job/JobTable/JobHostColumn.js deleted file mode 100644 index a06afea4265603ccba80636a7ea82a03d31b1d95..0000000000000000000000000000000000000000 --- a/src/components/Job/JobTable/JobHostColumn.js +++ /dev/null @@ -1,20 +0,0 @@ -import { Stack, Typography } from "@mui/material"; -import { InternalLink } from "@ess-ics/ce-ui-common"; - -export const JobHostColumn = ({ job }) => { - if (job.host?.hostName) { - return ( - <Stack> - <InternalLink - to={`/hosts/${job?.host?.hostId}`} - label={`Host details, ${job.host?.hostName}`} - > - {job.host.hostName} - </InternalLink> - <Typography variant="body2">{job.host.network}</Typography> - </Stack> - ); - } - - return null; -}; diff --git a/src/components/Job/JobTable/JobSummaryColumn.js b/src/components/Job/JobTable/JobSummaryColumn.js deleted file mode 100644 index 9c835931866e8b7774740d6e03c61e0277ceadb3..0000000000000000000000000000000000000000 --- a/src/components/Job/JobTable/JobSummaryColumn.js +++ /dev/null @@ -1,55 +0,0 @@ -import { Chip, Stack } from "@mui/material"; -import { JobGitRefLink } from "./JobGitRefLink"; -import { JobTypeIcon } from "../JobIcons"; -import { InternalLink } from "@ess-ics/ce-ui-common"; -import { JobGitRefIcon } from "./JobGitRefIcon"; - -export const JobSummaryColumn = ({ job, colorStyle }) => { - return ( - <Stack> - <JobTypeIcon - type={job.type} - colorStyle={colorStyle} - labelPosition="right" - /> - <InternalLink - to={`/iocs/${job.iocId}`} - label={`IOC Details, ${job.iocName}`} - > - {job.iocName} - </InternalLink> - <Stack - flexDirection="row" - gap={0.5} - alignItems="center" - > - <InternalLink - to={`/jobs/${job?.id}`} - label={`Job Details, ID ${job.id}`} - > - {`#${job.id}`} - </InternalLink> - {job.type === "DEPLOY" ? ( - <Chip - sx={{ - padding: "8px", - gap: "4px", - "& .MuiChip-label": { - paddingLeft: "0", - paddingRight: "0" - } - }} - size="small" - icon={<JobGitRefIcon job={job} />} - label={ - <JobGitRefLink - job={job} - disableExternalLinkIcon - /> - } - /> - ) : null} - </Stack> - </Stack> - ); -};