diff --git a/SQL/0000-00-02-Permission.sql b/SQL/0000-00-02-Permission.sql index 8ebca54b267..65eb207676f 100644 --- a/SQL/0000-00-02-Permission.sql +++ b/SQL/0000-00-02-Permission.sql @@ -130,7 +130,8 @@ INSERT INTO `permissions` VALUES (59,'imaging_quality_control_view','Flagged Imaging Entries',(SELECT ID FROM modules WHERE Name='imaging_qc'),'View','2'), (60,'behavioural_quality_control_view','Flagged Behavioural Entries',(SELECT ID FROM modules WHERE Name='behavioural_qc'),'View','2'), (61,'api_docs','API documentation',(SELECT ID FROM modules WHERE Name='api_docs'),'View','2'), - (62,'electrophysiology_browser_edit_annotations','Annotations',(SELECT ID FROM modules WHERE Name='electrophysiology_browser'), 'Create/Edit', '2'); + (62,'electrophysiology_browser_edit_annotations','Annotations',(SELECT ID FROM modules WHERE Name='electrophysiology_browser'),'Create/Edit','2'), + (63,'monitor_eeg_uploads','Monitor EEG uploads',(SELECT ID FROM modules WHERE Name='electrophysiology_uploader'),NULL,'2'); INSERT INTO `user_perm_rel` (userID, permID) SELECT u.ID, p.permID diff --git a/SQL/New_patches/2023-02-24-electrophysiology_uploader.sql b/SQL/New_patches/2023-02-24-electrophysiology_uploader.sql index 363482be29f..73218ac50c1 100644 --- a/SQL/New_patches/2023-02-24-electrophysiology_uploader.sql +++ b/SQL/New_patches/2023-02-24-electrophysiology_uploader.sql @@ -17,5 +17,9 @@ CREATE TABLE `electrophysiology_uploader` ( INSERT INTO modules (Name, Active) VALUES ('electrophysiology_uploader', 'Y'); -- Add new configurations for eeg uploader -INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'EEGUploadIncomingPath', 'Path to the upload directory for incoming EEG studies', 1, 0, 'text', ID, 'EEG Incoming Directory', 7 FROM ConfigSettings WHERE Name="paths"; +INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) + SELECT 'EEGUploadIncomingPath', 'Path to the upload directory for incoming EEG studies', 1, 0, 'text', ID, 'EEG Incoming Directory', 7 FROM ConfigSettings WHERE Name="paths"; +-- Add new permissions for eeg uploader +INSERT INTO permissions (code, description, moduleID, action, categoryID) VALUES + ('monitor_eeg_uploads','Monitor EEG uploads',(SELECT ID FROM modules WHERE Name='electrophysiology_uploader'),NULL,'2'); \ No newline at end of file diff --git a/modules/electrophysiology_uploader/jsx/UploadForm.js b/modules/electrophysiology_uploader/jsx/UploadForm.js index 39521e32b23..86b53e8fcbe 100644 --- a/modules/electrophysiology_uploader/jsx/UploadForm.js +++ b/modules/electrophysiology_uploader/jsx/UploadForm.js @@ -15,6 +15,16 @@ export default function UploadForm(props) { const [errorMessage, setErrorMessage] = useState({}); const [uploadProgress, setuploadProgress] = useState(-1); + /** + * Reset form + */ + const resetForm = () => { + setFormData({}); + setErrorMessage({}); + setHasError({}); + setuploadProgress(-1); + }; + /** * Updates values in formData * @@ -139,7 +149,6 @@ export default function UploadForm(props) { pscid: null, visit: null, }); - setHasError({ eegFile: false, candID: false, @@ -149,15 +158,15 @@ export default function UploadForm(props) { let text = ''; if (props.autoLaunch === 'true' || props.autoLaunch === '1') { - text = 'Processing of this file by the MRI pipeline has started\n' - + 'Select this upload in the result table ' - + 'to view the processing progress'; + text = 'Processing of this file by the EEG pipeline has started'; } swal.fire({ title: 'Upload Successful!', text: text, type: 'success', }); + + resetForm(); } else { processError(xhr); } diff --git a/modules/electrophysiology_uploader/php/upload.class.inc b/modules/electrophysiology_uploader/php/upload.class.inc index 9c2aae8960b..3c638cf13b2 100644 --- a/modules/electrophysiology_uploader/php/upload.class.inc +++ b/modules/electrophysiology_uploader/php/upload.class.inc @@ -208,14 +208,15 @@ class Upload extends \NDB_Page $db->insert('electrophysiology_uploader', $saveValues); - // Send notification to specific users - $to_list = [ - 'santiago.morales@usc.edu', - 'lyoder@umd.edu', - 'fox@umd.edu', - 'mmcsw1@umd.edu', - 'mantunez@umd.edu' - ]; + // Send notification to eeg managers + $emails = $db->pselectCol( + "SELECT Email + FROM users u + JOIN user_perm_rel upr ON upr.userID = u.ID + JOIN permissions p ON upr.permID = p.permID + WHERE p.code='monitor_eeg_uploads'", + [] + ); $timepoint = \TimePoint::singleton(new \SessionID($sessionID)); $msg_data = [ 'Site' => $timepoint->getPSC(), @@ -227,8 +228,7 @@ class Upload extends \NDB_Page 'UploadLocation' => $saveValues['UploadLocation'], 'UploadUrl' => null, ]; - - foreach ($to_list as $email) { + foreach ($emails as $email) { \Email::send( $email, 'new_electrophysiology_upload.tpl',