Skip to content
Snippets Groups Projects
Commit b28d6543 authored by Imre Toth's avatar Imre Toth
Browse files

CE-2051: Change stepper component

parent 6a0f1f86
No related branches found
No related tags found
1 merge request!353Resolve CE-2051 "Change stepper component"
This commit is part of merge request !353. Comments created here will be created in the context of that merge request.
...@@ -7,8 +7,8 @@ import { ...@@ -7,8 +7,8 @@ import {
Container, Container,
Link as MuiLink Link as MuiLink
} from "@mui/material"; } from "@mui/material";
import { DeploymentStepper } from "../deployments/DeploymentStepper";
import { KeyValueTable, SimpleAccordion } from "@ess-ics/ce-ui-common"; import { KeyValueTable, SimpleAccordion } from "@ess-ics/ce-ui-common";
import { Stepper } from "@ess-ics/ce-ui-common";
import { JobBadge } from "./JobBadge"; import { JobBadge } from "./JobBadge";
import { DeploymentJobOutput } from "../deployments/DeploymentJobOutput"; import { DeploymentJobOutput } from "../deployments/DeploymentJobOutput";
import { Link as ReactRouterLink } from "react-router-dom"; import { Link as ReactRouterLink } from "react-router-dom";
...@@ -18,6 +18,21 @@ import AccessControl from "../auth/AccessControl"; ...@@ -18,6 +18,21 @@ import AccessControl from "../auth/AccessControl";
import { AWXJobDetails } from "../../api/DataTypes"; import { AWXJobDetails } from "../../api/DataTypes";
import AlertMessages from "../IOC/AlertMessages"; import AlertMessages from "../IOC/AlertMessages";
const STATUS = {
queued: {
label: "Queued",
alertType: "info"
},
running: {
label: "Running",
alertType: "info"
},
successful: {
label: "Completed",
alertType: "success"
}
};
function createAlert(operation, job) { function createAlert(operation, job) {
const jobDetails = new AWXJobDetails(operation.type, job); const jobDetails = new AWXJobDetails(operation.type, job);
const message = jobDetails.message(); const message = jobDetails.message();
...@@ -38,11 +53,6 @@ export function JobDetails({ operation, job }) { ...@@ -38,11 +53,6 @@ export function JobDetails({ operation, job }) {
const [alert, setAlert] = useState(createAlert(operation, job)); const [alert, setAlert] = useState(createAlert(operation, job));
const jobDetails = useMemo(
() => new AWXJobDetails(operation.type, job),
[operation, job]
);
useEffect(() => { useEffect(() => {
setAlert(createAlert(operation, job, finishedJob)); setAlert(createAlert(operation, job, finishedJob));
}, [finishedJob, operation, job]); }, [finishedJob, operation, job]);
...@@ -116,6 +126,12 @@ export function JobDetails({ operation, job }) { ...@@ -116,6 +126,12 @@ export function JobDetails({ operation, job }) {
: "-" : "-"
}; };
const normalizedStatus = job?.status?.toLowerCase();
const currentStep = Object.keys(STATUS).indexOf(normalizedStatus);
const activeStep = STATUS[normalizedStatus] ? currentStep + 1 : currentStep;
const jobFailed = job?.status?.toLowerCase() === "failed";
return ( return (
<Grid <Grid
container container
...@@ -155,12 +171,10 @@ export function JobDetails({ operation, job }) { ...@@ -155,12 +171,10 @@ export function JobDetails({ operation, job }) {
<CardContent> <CardContent>
<div> <div>
{job && ( {job && (
<DeploymentStepper <Stepper
activeStep={["queued", "running", "successful"].indexOf( steps={Object.values(STATUS).map((it) => it.label)}
job.status.toLowerCase() activeStep={activeStep}
)} isActiveStepFailed={jobFailed}
deploymentStart={operation.startDate}
jobDetails={jobDetails}
/> />
)} )}
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment