diff --git a/react-web/src/pages/certification/Certification.scss b/react-web/src/pages/certification/Certification.scss index 65ccf1e2..6138fa1e 100644 --- a/react-web/src/pages/certification/Certification.scss +++ b/react-web/src/pages/certification/Certification.scss @@ -23,10 +23,13 @@ margin-bottom: 20px; color: $body-text-gray; } - .btn { + .footer { display: flex; - margin: 0 auto; - min-width: 160px; + justify-content: center; + column-gap: 10px; + .btn { + display: flex; + } } } diff --git a/react-web/src/pages/certification/Certification.tsx b/react-web/src/pages/certification/Certification.tsx index a9c8f1fc..8f299eb6 100644 --- a/react-web/src/pages/certification/Certification.tsx +++ b/react-web/src/pages/certification/Certification.tsx @@ -30,6 +30,8 @@ import CreateCertificate from "components/CreateCertificate/CreateCertificate"; import { useAppDispatch, useAppSelector } from "store/store"; import { clearUuid, setUuid } from "./slices/certification.slice"; +import { deleteTestHistoryData } from "pages/testHistory/slices/deleteTestHistory.slice"; +import { useConfirm } from "material-ui-confirm"; const TIMEOFFSET = 1000; @@ -42,6 +44,7 @@ const Certification = () => { const { uuid } = useAppSelector((state) => state.certification); const { userDetails } = useAppSelector((state) => state.auth); const dispatch = useAppDispatch(); + const confirm = useConfirm(); const [submitting, setSubmitting] = useState(false); const [formSubmitted, setFormSubmitted] = useState(false); const [timelineConfig, setTimelineConfig] = useState(TIMELINE_CONFIG); @@ -188,6 +191,14 @@ const Certification = () => { exportObjectToJsonFile(resultData); }; + const abortRun = () => { + confirm({ title: "", description: "Are sure you want to abort this run!" }) + .then(async () => { + await dispatch(deleteTestHistoryData({ url: "/run/" + uuid + "?delete=true" })); + resetStates() + }).catch(() => { }); + } + useEffect(() => { if (uuid.length) { triggerFetchRunStatus(); @@ -252,17 +263,26 @@ const Certification = () => { disabled={submitting} {...form.register("commit")} /> +