Skip to content
Snippets Groups Projects
Commit 74d6e414 authored by Johanna Szepanski's avatar Johanna Szepanski
Browse files

converted to stepper states uppercase

parent f47b0b4c
No related branches found
No related tags found
2 merge requests!612Release 5.0.0,!579CE-3371: Converted to stepper states uppercase
Pipeline #208938 passed
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
formatDateAndTime, formatDateAndTime,
EmptyValue, EmptyValue,
Duration, Duration,
StepperComponents, SingleStateStepper,
STEPPER_STATES, STEPPER_STATES,
AccessControl AccessControl
} from "@ess-ics/ce-ui-common"; } from "@ess-ics/ce-ui-common";
...@@ -79,9 +79,6 @@ export const JobsDetails = ({ jobDetail: operation }: JobDetailsProps) => { ...@@ -79,9 +79,6 @@ export const JobsDetails = ({ jobDetail: operation }: JobDetailsProps) => {
const [alerts, setAlerts] = useState< const [alerts, setAlerts] = useState<
{ type?: Status; message?: string; link?: string }[] { type?: Status; message?: string; link?: string }[]
>(operation.alerts ?? []); >(operation.alerts ?? []);
const StepIcon = operation?.status
? StepperComponents[operation.status.toLowerCase()]
: StepperComponents[STEPPER_STATES.unknown];
const [expanded, setExpanded] = useState(false); const [expanded, setExpanded] = useState(false);
const awxJob = useMemo( const awxJob = useMemo(
...@@ -129,10 +126,10 @@ export const JobsDetails = ({ jobDetail: operation }: JobDetailsProps) => { ...@@ -129,10 +126,10 @@ export const JobsDetails = ({ jobDetail: operation }: JobDetailsProps) => {
> >
Job log stream Job log stream
</Typography> </Typography>
<StepIcon <SingleStateStepper
showToolTip showToolTip
step={{ step={{
state: operation?.status?.toLowerCase(), state: operation?.status || STEPPER_STATES.UNKNOWN,
label: awxJob.message() label: awxJob.message()
}} }}
/> />
......
...@@ -13,23 +13,23 @@ interface JobStatusProps { ...@@ -13,23 +13,23 @@ interface JobStatusProps {
} }
const getStatus = (status: string) => { const getStatus = (status: string) => {
switch (status.toLowerCase()) { switch (status) {
case STEPPER_STATES.queued: case STEPPER_STATES.QUEDUED:
return { return {
label: "Queued", label: "Queued",
icon: IconRunning icon: IconRunning
}; };
case STEPPER_STATES.running: case STEPPER_STATES.RUNNING:
return { return {
label: "Running", label: "Running",
icon: IconRunning icon: IconRunning
}; };
case STEPPER_STATES.successful: case STEPPER_STATES.SUCCESSFUL:
return { return {
label: "Successful", label: "Successful",
icon: IconSuccessful icon: IconSuccessful
}; };
case STEPPER_STATES.failed: case STEPPER_STATES.FAILED:
return { return {
label: "Failed", label: "Failed",
icon: IconFailed icon: IconFailed
...@@ -43,8 +43,7 @@ const getStatus = (status: string) => { ...@@ -43,8 +43,7 @@ const getStatus = (status: string) => {
}; };
export const JobStatus = ({ status }: JobStatusProps) => { export const JobStatus = ({ status }: JobStatusProps) => {
const convertedStatus = status ? status.toString().toLowerCase() : ""; const convertedStatus = status || "";
const activeStep = getStatus(convertedStatus); const activeStep = getStatus(convertedStatus);
const Icon = activeStep.icon; const Icon = activeStep.icon;
...@@ -54,7 +53,7 @@ export const JobStatus = ({ status }: JobStatusProps) => { ...@@ -54,7 +53,7 @@ export const JobStatus = ({ status }: JobStatusProps) => {
labelPosition="right" labelPosition="right"
LabelProps={{ LabelProps={{
color: color:
convertedStatus === STEPPER_STATES.failed convertedStatus === STEPPER_STATES.FAILED
? theme.palette.status.fail.main ? theme.palette.status.fail.main
: "inherit" : "inherit"
}} }}
......
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