diff --git a/frontend/cypress/e2e/modifyOrder.cy.js b/frontend/cypress/e2e/modifyOrder.cy.js index 6df6bcd2ee..0b257b216a 100644 --- a/frontend/cypress/e2e/modifyOrder.cy.js +++ b/frontend/cypress/e2e/modifyOrder.cy.js @@ -102,7 +102,7 @@ describe("Modify Order search by patient ", function () { ); }); }); - + //TO DO needs fixing it("Should be able to search by respective patient ", function () { cy.wait(1000); modifyOrderPage.clickRespectivePatient(); diff --git a/frontend/cypress/pages/ModifyOrderPage.js b/frontend/cypress/pages/ModifyOrderPage.js index c1f6eda74c..efddfb1e1f 100644 --- a/frontend/cypress/pages/ModifyOrderPage.js +++ b/frontend/cypress/pages/ModifyOrderPage.js @@ -41,9 +41,9 @@ class ModifyOrderPage { clickRespectivePatient() { return cy - .get( - ":nth-child(2) > :nth-child(1) > .cds--radio-button-wrapper > .cds--radio-button__label > .cds--radio-button__appearance", - ) + .get('tbody tr') + .first() + .find('.cds--radio-button__appearance') .click(); } } diff --git a/frontend/src/components/addOrder/Index.js b/frontend/src/components/addOrder/Index.js index 7eca6c5a1c..ea10879042 100755 --- a/frontend/src/components/addOrder/Index.js +++ b/frontend/src/components/addOrder/Index.js @@ -45,6 +45,7 @@ const Index = () => { const [orderFormValues, setOrderFormValues] = useState(SampleOrderFormValues); const [samples, setSamples] = useState([sampleObject]); const [errors, setErrors] = useState([]); + const [isSubmitting, setIsSubmitting] = useState(false); let SampleTypes = []; let sampleTypeMap = {}; @@ -536,6 +537,7 @@ const Index = () => { }; const handlePost = (status) => { + setIsSubmitting(false); if (status === 200) { showAlertMessage( , @@ -562,6 +564,11 @@ const Index = () => { const handleSubmitOrderForm = (e) => { e.preventDefault(); + // Prevent multiple submissions. + if (isSubmitting) { + return; + } + setIsSubmitting(true); if ("years" in orderFormValues.patientProperties) { delete orderFormValues.patientProperties.years; } @@ -802,7 +809,9 @@ const Index = () => { diff --git a/frontend/src/components/admin/reflexTests/ReflexRuleForm.js b/frontend/src/components/admin/reflexTests/ReflexRuleForm.js index 035ec8988c..d696a6b681 100644 --- a/frontend/src/components/admin/reflexTests/ReflexRuleForm.js +++ b/frontend/src/components/admin/reflexTests/ReflexRuleForm.js @@ -87,6 +87,7 @@ function ReflexRule() { }); //{field :{index :{field_index:[]}}} const [counter, setCounter] = useState(0); const [loading, setLoading] = useState(true); + const [isSubmitting, setIsSubmitting] = useState(false); const [errors, setErrors] = useState({}); const { notificationVisible, setNotificationVisible, addNotification } = useContext(NotificationContext); @@ -340,6 +341,7 @@ function ReflexRule() { }; const handleSubmited = (status, index) => { + setIsSubmitting(false); setNotificationVisible(true); if (status == "200") { const element = document.getElementById("submit_" + index); @@ -360,6 +362,10 @@ function ReflexRule() { const handleSubmit = (event, index) => { event.preventDefault(); + if (isSubmitting) { + return; + } + setIsSubmitting(true); console.debug(JSON.stringify(ruleList[index])); postToOpenElisServer( "/rest/reflexrule", @@ -737,7 +743,13 @@ function ReflexRule() { <> diff --git a/frontend/src/components/pathology/PathologyCaseView.js b/frontend/src/components/pathology/PathologyCaseView.js index 2a573fda2f..af659ed8b0 100644 --- a/frontend/src/components/pathology/PathologyCaseView.js +++ b/frontend/src/components/pathology/PathologyCaseView.js @@ -70,6 +70,7 @@ function PathologyCaseView() { const [pagination, setPagination] = useState(false); const [currentApiPage, setCurrentApiPage] = useState(null); const [totalApiPages, setTotalApiPages] = useState(null); + const [isSubmitting, setIsSubmitting] = useState(false); const [reportParams, setReportParams] = useState({ 0: { submited: false, @@ -80,6 +81,7 @@ function PathologyCaseView() { async function displayStatus(response) { var body = await response.json(); console.debug(body); + setIsSubmitting(false); var status = response.status; setNotificationVisible(true); if (status == "200") { @@ -145,6 +147,10 @@ function PathologyCaseView() { }); const save = (e) => { + if (isSubmitting) { + return; + } + setIsSubmitting(true); let submitValues = { assignedTechnicianId: pathologySampleInfo.assignedTechnicianId, assignedPathologistId: pathologySampleInfo.assignedPathologistId, @@ -375,6 +381,7 @@ function PathologyCaseView() { @@ -1015,6 +1022,7 @@ function CreatePatientForm(props) { diff --git a/frontend/src/components/validation/Validation.js b/frontend/src/components/validation/Validation.js index cd7526fbb6..eb1190b237 100644 --- a/frontend/src/components/validation/Validation.js +++ b/frontend/src/components/validation/Validation.js @@ -35,6 +35,7 @@ const Validation = (props) => { const [page, setPage] = useState(1); const [pageSize, setPageSize] = useState(100); + const [isSubmitting, setIsSubmitting] = useState(false); useEffect(() => { componentMounted.current = true; @@ -114,6 +115,10 @@ const Validation = (props) => { ]; const handleSave = (values) => { + if (isSubmitting) { + return; + } + setIsSubmitting(true); postToOpenElisServer( "/rest/accessionValidationByRangeUpdate", JSON.stringify(props.results), @@ -123,6 +128,7 @@ const Validation = (props) => { const handleResponse = (status) => { let message = intl.formatMessage({ id: "validation.save.error" }); let kind = NotificationKinds.error; + setIsSubmitting(false); if (status == 200) { message = intl.formatMessage({ id: "validation.save.success" }); kind = NotificationKinds.success; @@ -464,6 +470,7 @@ const Validation = (props) => { onClick={() => handleSave(values)} id="submit" style={{ marginTop: "16px" }} + disabled={isSubmitting} > diff --git a/frontend/src/index.css b/frontend/src/index.css index 5aa3ee2f3b..3d6c7d3bef 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -71,7 +71,7 @@ code { .slide-over-panel { width: 25%; /* Use percentage for width on larger screens */ - /* max-width: 25%;*/ + /* max-width: 25%;*/ max-width: 50%; /* Use percentage for max-width on larger screens */ }