diff --git a/modules/instruments/jsx/ControlpanelDeleteInstrumentData.js b/modules/instruments/jsx/ControlpanelDeleteInstrumentData.js index f645d0d4988..6bb52500abd 100644 --- a/modules/instruments/jsx/ControlpanelDeleteInstrumentData.js +++ b/modules/instruments/jsx/ControlpanelDeleteInstrumentData.js @@ -30,9 +30,25 @@ class ControlpanelDeleteInstrumentData extends Component { confirmButtonText: 'Yes, delete the data', }).then((result) => { if (result.value) { - this.refs.ClearInstrument.dispatchEvent( - new Event('submit') - ); + const formData = new FormData(); + formData.append('ClearInstrument', 1); + fetch( + window.location.href, + { + method: 'POST', + body: formData, + } + ).then((response) => { + if (!response.ok) { + console.error( + response.status + ': ' + response.statusText + ); + return; + } + window.location.reload(); + }).catch((error) => { + console.error(error); + }); } }); } @@ -43,19 +59,14 @@ class ControlpanelDeleteInstrumentData extends Component { * @return {JSX} - React markup for the component */ render() { - return
; + ); } } diff --git a/php/libraries/NDB_BVL_InstrumentStatus_ControlPanel.class.inc b/php/libraries/NDB_BVL_InstrumentStatus_ControlPanel.class.inc index 22af43507f0..1faf62b796d 100644 --- a/php/libraries/NDB_BVL_InstrumentStatus_ControlPanel.class.inc +++ b/php/libraries/NDB_BVL_InstrumentStatus_ControlPanel.class.inc @@ -183,7 +183,7 @@ class NDB_BVL_InstrumentStatus_ControlPanel extends NDB_BVL_InstrumentStatus $this->subtest ?? '' ); $instrument->clearInstrument(); - return false; + return true; } else { return false; } diff --git a/webpack.config.js b/webpack.config.js index 869394fc742..3e9af4db2be 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -320,7 +320,7 @@ const lorisModules = { imaging_qc: ['imagingQCIndex'], server_processes_manager: ['server_processes_managerIndex'], statistics: ['WidgetIndex'], - instruments: ['CandidateInstrumentList'], + instruments: ['CandidateInstrumentList', 'ControlpanelDeleteInstrumentData'], candidate_profile: ['CandidateInfo'], api_docs: ['swagger-ui_custom'], };