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

Merge branch 'CE-2051_Change_stepper_component' into 'develop'

Resolve CE-2051 "Change stepper component"

See merge request !353
parents bf3b9d12 1e56b0ba
No related branches found
No related tags found
2 merge requests!407CE-2141: 3.0.0,!353Resolve CE-2051 "Change stepper component"
Pipeline #160266 passed
......@@ -7,8 +7,8 @@ import {
Container,
Link as MuiLink
} from "@mui/material";
import { DeploymentStepper } from "../deployments/DeploymentStepper";
import { KeyValueTable, SimpleAccordion } from "@ess-ics/ce-ui-common";
import { Stepper } from "@ess-ics/ce-ui-common";
import { JobBadge } from "./JobBadge";
import { DeploymentJobOutput } from "../deployments/DeploymentJobOutput";
import { Link as ReactRouterLink } from "react-router-dom";
......@@ -18,6 +18,21 @@ import AccessControl from "../auth/AccessControl";
import { AWXJobDetails } from "../../api/DataTypes";
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) {
const jobDetails = new AWXJobDetails(operation.type, job);
const message = jobDetails.message();
......@@ -38,11 +53,6 @@ export function JobDetails({ operation, job }) {
const [alert, setAlert] = useState(createAlert(operation, job));
const jobDetails = useMemo(
() => new AWXJobDetails(operation.type, job),
[operation, job]
);
useEffect(() => {
setAlert(createAlert(operation, job, finishedJob));
}, [finishedJob, operation, job]);
......@@ -116,6 +126,17 @@ export function JobDetails({ operation, job }) {
: "-"
};
const normalizedStatus = job?.status?.toLowerCase();
const currentStep = Object.keys(STATUS).indexOf(normalizedStatus);
var activeStep = STATUS[normalizedStatus] ? currentStep + 1 : currentStep;
const jobFailed = job?.status?.toLowerCase() === "failed";
// to show the correct failed step for an already finished operation
if (jobFailed) {
activeStep = operation?.startTime ? 1 : 0;
}
return (
<Grid
container
......@@ -155,12 +176,10 @@ export function JobDetails({ operation, job }) {
<CardContent>
<div>
{job && (
<DeploymentStepper
activeStep={["queued", "running", "successful"].indexOf(
job.status.toLowerCase()
)}
deploymentStart={operation.startDate}
jobDetails={jobDetails}
<Stepper
steps={Object.values(STATUS).map((it) => it.label)}
activeStep={activeStep}
isActiveStepFailed={jobFailed}
/>
)}
</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