From 74d6e414fdd27185bde5e16c2ea9d324d5057d03 Mon Sep 17 00:00:00 2001 From: Johanna Szepanski <johanna.szepanski@softhouse.se> Date: Mon, 9 Dec 2024 08:56:55 +0100 Subject: [PATCH 1/3] converted to stepper states uppercase --- src/components/Job/JobDetails.tsx | 9 +++------ src/components/Job/JobStatus.tsx | 15 +++++++-------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/components/Job/JobDetails.tsx b/src/components/Job/JobDetails.tsx index ace93bee..8f7453a1 100644 --- a/src/components/Job/JobDetails.tsx +++ b/src/components/Job/JobDetails.tsx @@ -9,7 +9,7 @@ import { formatDateAndTime, EmptyValue, Duration, - StepperComponents, + SingleStateStepper, STEPPER_STATES, AccessControl } from "@ess-ics/ce-ui-common"; @@ -79,9 +79,6 @@ export const JobsDetails = ({ jobDetail: operation }: JobDetailsProps) => { const [alerts, setAlerts] = useState< { type?: Status; message?: string; link?: string }[] >(operation.alerts ?? []); - const StepIcon = operation?.status - ? StepperComponents[operation.status.toLowerCase()] - : StepperComponents[STEPPER_STATES.unknown]; const [expanded, setExpanded] = useState(false); const awxJob = useMemo( @@ -129,10 +126,10 @@ export const JobsDetails = ({ jobDetail: operation }: JobDetailsProps) => { > Job log stream </Typography> - <StepIcon + <SingleStateStepper showToolTip step={{ - state: operation?.status?.toLowerCase(), + state: operation?.status || STEPPER_STATES.UNKNOWN, label: awxJob.message() }} /> diff --git a/src/components/Job/JobStatus.tsx b/src/components/Job/JobStatus.tsx index f9099804..e9d44402 100644 --- a/src/components/Job/JobStatus.tsx +++ b/src/components/Job/JobStatus.tsx @@ -13,23 +13,23 @@ interface JobStatusProps { } const getStatus = (status: string) => { - switch (status.toLowerCase()) { - case STEPPER_STATES.queued: + switch (status) { + case STEPPER_STATES.QUEDUED: return { label: "Queued", icon: IconRunning }; - case STEPPER_STATES.running: + case STEPPER_STATES.RUNNING: return { label: "Running", icon: IconRunning }; - case STEPPER_STATES.successful: + case STEPPER_STATES.SUCCESSFUL: return { label: "Successful", icon: IconSuccessful }; - case STEPPER_STATES.failed: + case STEPPER_STATES.FAILED: return { label: "Failed", icon: IconFailed @@ -43,8 +43,7 @@ const getStatus = (status: string) => { }; export const JobStatus = ({ status }: JobStatusProps) => { - const convertedStatus = status ? status.toString().toLowerCase() : ""; - + const convertedStatus = status || ""; const activeStep = getStatus(convertedStatus); const Icon = activeStep.icon; @@ -54,7 +53,7 @@ export const JobStatus = ({ status }: JobStatusProps) => { labelPosition="right" LabelProps={{ color: - convertedStatus === STEPPER_STATES.failed + convertedStatus === STEPPER_STATES.FAILED ? theme.palette.status.fail.main : "inherit" }} -- GitLab From 4099520396b85008906307b4ed3af02c949199aa Mon Sep 17 00:00:00 2001 From: Johanna Szepanski <johanna.szepanski@softhouse.se> Date: Mon, 9 Dec 2024 14:27:52 +0100 Subject: [PATCH 2/3] fixed MR comments --- src/components/Job/JobStatus.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Job/JobStatus.tsx b/src/components/Job/JobStatus.tsx index e9d44402..320bc6a5 100644 --- a/src/components/Job/JobStatus.tsx +++ b/src/components/Job/JobStatus.tsx @@ -7,14 +7,15 @@ import { IconUnknown } from "@ess-ics/ce-ui-common"; import { theme } from "../../style/Theme"; +import { JobDetails } from "../../store/deployApi"; interface JobStatusProps { - status: string | undefined; + status: JobDetails["status"]; } -const getStatus = (status: string) => { +const getStatus = (status: JobDetails["status"]) => { switch (status) { - case STEPPER_STATES.QUEDUED: + case STEPPER_STATES.QUEUED: return { label: "Queued", icon: IconRunning @@ -43,8 +44,7 @@ const getStatus = (status: string) => { }; export const JobStatus = ({ status }: JobStatusProps) => { - const convertedStatus = status || ""; - const activeStep = getStatus(convertedStatus); + const activeStep = getStatus(status); const Icon = activeStep.icon; return ( @@ -53,7 +53,7 @@ export const JobStatus = ({ status }: JobStatusProps) => { labelPosition="right" LabelProps={{ color: - convertedStatus === STEPPER_STATES.FAILED + status === STEPPER_STATES.FAILED ? theme.palette.status.fail.main : "inherit" }} -- GitLab From 75e9639c99ac0afaf428386259f310a6d4a0bca5 Mon Sep 17 00:00:00 2001 From: Johanna Szepanski <johanna.szepanski@softhouse.se> Date: Mon, 9 Dec 2024 13:48:39 +0100 Subject: [PATCH 3/3] updated ess-common version --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index ec16852c..eff73ecc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", - "@ess-ics/ce-ui-common": "^10.1.0", + "@ess-ics/ce-ui-common": "^11.0.0", "@mui/icons-material": "^5.14.1", "@mui/material": "^5.14.1", "@reduxjs/toolkit": "^2.2.7", @@ -1399,9 +1399,9 @@ } }, "node_modules/@ess-ics/ce-ui-common": { - "version": "10.1.0", - "resolved": "https://artifactory.esss.lu.se/artifactory/api/npm/ics-npm/@ess-ics/ce-ui-common/-/ce-ui-common-10.1.0.tgz", - "integrity": "sha512-xkhcghB9pqNq3pZcDaSS7AOpggnFgglSd9qpivJAFMov8hxje/RZHumCi+lFDX3g31Ul7u5ZrElq4xbvuBgTpg==", + "version": "11.0.0", + "resolved": "https://artifactory.esss.lu.se/artifactory/api/npm/ics-npm/@ess-ics/ce-ui-common/-/ce-ui-common-11.0.0.tgz", + "integrity": "sha512-SuxD9+oH9M4DrAHeOO306HUbql4yMwe2vljMPju1RYnorVCP/eBSzwIzIXmP8cPx0/aiVeWLfTflMi9LY31ahg==", "dependencies": { "@fontsource/titillium-web": "^5.0.22", "@mui/x-data-grid-pro": "^6.5.0", diff --git a/package.json b/package.json index 2a75a5e3..df935780 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", - "@ess-ics/ce-ui-common": "^10.1.0", + "@ess-ics/ce-ui-common": "^11.0.0", "@mui/icons-material": "^5.14.1", "@mui/material": "^5.14.1", "@reduxjs/toolkit": "^2.2.7", -- GitLab