Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions modules/candidate_parameters/jsx/CandidateDOB.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Loader from 'Loader';
import swal from 'sweetalert2';

class CandidateDOB extends Component {
constructor(props) {
Expand Down Expand Up @@ -111,7 +112,7 @@ class CandidateDOB extends Component {
let dob = this.state.formData.dob ?
this.state.formData.dob : null;
if (dob > today) {
swal({
swal.fire({
title: 'Error!',
text: 'Date of birth cannot be later than today!',
type: 'error',
Expand Down Expand Up @@ -140,7 +141,7 @@ class CandidateDOB extends Component {
})
.then((resp) => {
if (resp.ok && resp.status === 200) {
swal({
swal.fire({
title: 'Success!',
text: 'Date of birth updated!',
type: 'success',
Expand All @@ -150,7 +151,7 @@ class CandidateDOB extends Component {
this.fetchData();
}
} else {
swal({
swal.fire({
title: 'Error!',
text: 'Something went wrong.',
type: 'error',
Expand Down
9 changes: 5 additions & 4 deletions modules/candidate_parameters/jsx/CandidateDOD.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Loader from 'Loader';
import swal from 'sweetalert2';

class CandidateDOD extends Component {
constructor(props) {
Expand Down Expand Up @@ -112,7 +113,7 @@ class CandidateDOD extends Component {
this.state.data.dob : null;

if (dod > today) {
swal({
swal.fire({
title: 'Invalid date',
text: 'Date of death cannot be later than today!',
type: 'error',
Expand All @@ -122,7 +123,7 @@ class CandidateDOD extends Component {
}

if (dob > dod) {
swal({
swal.fire({
title: 'Invalid date',
text: 'Date of death must be after date of birth!',
type: 'error',
Expand Down Expand Up @@ -152,7 +153,7 @@ class CandidateDOD extends Component {
}
).then((resp) => resp.text()
).then((result) => {
swal({
swal.fire({
title: 'Success!',
text: 'Date of death updated!',
type: 'success',
Expand All @@ -163,7 +164,7 @@ class CandidateDOD extends Component {
}
}).catch((error) => {
console.error(error);
swal({
swal.fire({
title: 'Error!',
text: 'Something went wrong.',
type: 'error',
Expand Down
6 changes: 3 additions & 3 deletions modules/candidate_parameters/jsx/ConsentStatus.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';

import swal from 'sweetalert2';
import Loader from 'Loader';

/**
Expand Down Expand Up @@ -181,13 +181,13 @@ class ConsentStatus extends Component {
contentType: false,
processData: false,
success: (data) => {
swal('Success!', 'Update successful.', 'success');
swal.fire('Success!', 'Update successful.', 'success');
this.fetchData();
},
error: (error) => {
console.error(error);
let errorMessage = error.responseText || 'Update failed.';
swal('Error!', errorMessage, 'error');
swal.fire('Error!', errorMessage, 'error');
},
});
}
Expand Down
5 changes: 3 additions & 2 deletions modules/data_release/jsx/addPermissionForm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Loader from 'jsx/Loader';
import swal from 'sweetalert2';

/**
* Add Permission Form
Expand Down Expand Up @@ -161,7 +162,7 @@ class AddPermissionForm extends Component {
body: formObj,
}).then( (response) => {
if (response.ok) {
swal({
swal.fire({
text: 'Permission Update Success!',
title: '',
type: 'success',
Expand All @@ -173,7 +174,7 @@ class AddPermissionForm extends Component {
let msg = response.statusText ?
response.statusText :
'Submission Error!';
swal(msg, '', 'error');
swal.fire(msg, '', 'error');
console.error(msg);
}
});
Expand Down
5 changes: 3 additions & 2 deletions modules/data_release/jsx/managePermissionsForm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Loader from 'jsx/Loader';
import swal from 'sweetalert2';
import Modal from 'Modal';

/**
Expand Down Expand Up @@ -130,7 +131,7 @@ class ManagePermissionsForm extends Component {
})
.then((response) => {
if (response.ok) {
swal({
swal.fire({
text: 'Permission Update Success!',
title: '',
type: 'success',
Expand All @@ -140,7 +141,7 @@ class ManagePermissionsForm extends Component {
} else {
let msg = response.statusText ?
response.statusText : 'Submission Error!';
swal(msg, '', 'error');
swal.fire(msg, '', 'error');
console.error(msg);
return Promise.reject();
}
Expand Down
11 changes: 6 additions & 5 deletions modules/data_release/jsx/uploadFileForm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import ProgressBar from 'ProgressBar';
import swal from 'sweetalert2';


/**
Expand Down Expand Up @@ -134,7 +135,7 @@ class UploadFileForm extends Component {
+ ')';
errorMessage['Filesize'] = msg;
hasError['Filesize'] = true;
swal({
swal.fire({
title: 'Error',
text: msg,
type: 'error',
Expand Down Expand Up @@ -175,12 +176,12 @@ class UploadFileForm extends Component {
errorMessage: msg,
uploadProgress: -1,
});
swal(msg, '', 'error');
swal.fire(msg, '', 'error');
console.error(msg);
} else {
const responseUrl = new URL(response.url);
if (responseUrl.searchParams.has('duplicate')) {
swal({
swal.fire({
title: 'Are you sure?',
text: 'A file with this name already exists!\n '
+ 'Would you like to overwrite existing file?\n '
Expand All @@ -207,7 +208,7 @@ class UploadFileForm extends Component {
formData: {}, // reset form data after successful file upload
uploadProgress: -1,
});
swal({
swal.fire({
text: 'Upload Successful!',
title: '',
type: 'success',
Expand All @@ -223,7 +224,7 @@ class UploadFileForm extends Component {
errorMessage: msg,
uploadProgress: -1,
});
swal(msg, '', 'error');
swal.fire(msg, '', 'error');
console.error(error);
});
}
Expand Down
4 changes: 3 additions & 1 deletion modules/document_repository/jsx/categoryForm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import PropTypes from 'prop-types';
import Loader from 'Loader';
import swal from 'sweetalert2';

/**
* Document Upload Form
*
Expand Down Expand Up @@ -129,7 +131,7 @@ class DocCategoryForm extends React.Component {
this.setState({
formData: {}, // reset form data after successful file upload
});
swal('Add Successful!', '', 'success');
swal.fire('Add Successful!', '', 'success');
});
}
/**
Expand Down
5 changes: 3 additions & 2 deletions modules/document_repository/jsx/docIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ChildTree from './childTree';
import Loader from 'Loader';
import FilterableDataTable from 'FilterableDataTable';
import NullFilterableDataTable from './NullFilterableDataTable';
import swal from 'sweetalert2';

class DocIndex extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -147,7 +148,7 @@ class DocIndex extends React.Component {
case 'Delete File':
let id = row['Edit'];
function click() {
swal({
swal.fire({
title: 'Are you sure?',
text: 'Your will not be able to recover this file!',
type: 'warning',
Expand All @@ -165,7 +166,7 @@ class DocIndex extends React.Component {
}).then((resp) => resp.json())
.then(()=>{
location.reload();
swal('delete Successful!', '', 'success');
swal.fire('delete Successful!', '', 'success');
});
}
);
Expand Down
3 changes: 2 additions & 1 deletion modules/document_repository/jsx/editForm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* exported DocEditForm */
import Loader from 'Loader';
import PropTypes from 'prop-types';
import swal from 'sweetalert2';
/**
* Document Edit Form
*
Expand Down Expand Up @@ -141,7 +142,7 @@ class DocEditForm extends React.Component {
})
.then((resp) => resp.json())
.then(()=>{
swal('Updated Successful!', '', 'success');
swal.fire('Updated Successful!', '', 'success');
this.fetchData();
});
}
Expand Down
6 changes: 4 additions & 2 deletions modules/help_editor/js/help_editor_helper.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import swal from 'sweetalert2';

$(document).ready(function(){
$("input[name=preview]").click(function(e) {
if($('div.help-content').length) {
Expand Down Expand Up @@ -65,7 +67,7 @@ $("#save-help").click(function(e) {
helpID: helpID ? helpID : '',
},
success: function() {
swal({
swal.fire({
title: "Content update successful!",
type: "success",
showCancelButton: true,
Expand All @@ -80,7 +82,7 @@ $("#save-help").click(function(e) {
},
error: function(xhr, errorCode, errorMsg) {
console.error(xhr);
swal({
swal.fire({
title: "Content update unsuccessful.",
text: errorCode + ": " + xhr.status + " " + errorMsg,
type: "error",
Expand Down
22 changes: 11 additions & 11 deletions modules/imaging_uploader/jsx/UploadForm.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ProgressBar from 'ProgressBar';
import React, {Component} from 'react';

import swal from 'sweetalert2';
/**
* Imaging Upload Form
*
Expand Down Expand Up @@ -97,7 +97,7 @@ class UploadForm extends Component {
// Make sure file is of type .zip|.tgz|.tar.gz format
const properExt = new RegExp('\.(zip|tgz|tar\.gz)$');
if (!fileName.match(properExt)) {
swal({
swal.fire({
title: 'Invalid extension for the uploaded file!',
text: 'Filename extension does not match .zip, .tgz or .tar.gz ',
type: 'error',
Expand Down Expand Up @@ -126,7 +126,7 @@ class UploadForm extends Component {

if (data.IsPhantom === 'N') {
if (!data.candID || !data.pSCID || !data.visitLabel) {
swal({
swal.fire({
title: 'Incorrect file name!',
text: 'Could not determine PSCID, CandID and Visit Label '
+ 'based on the filename!\n',
Expand All @@ -150,7 +150,7 @@ class UploadForm extends Component {

// File uploaded and completed mri pipeline
if (mriFile.status === 'Success') {
swal({
swal.fire({
title: 'File already exists!',
text: 'A file with this name has already successfully passed '
+ 'the MRI pipeline!\n',
Expand All @@ -162,7 +162,7 @@ class UploadForm extends Component {

// File in the middle of insertion pipeline
if (mriFile.status === 'In Progress...') {
swal({
swal.fire({
title: 'File is currently processing!',
text: 'A file with this name is currently going through '
+ 'the MRI pipeline!\n',
Expand All @@ -174,7 +174,7 @@ class UploadForm extends Component {

// File uploaded but failed during mri pipeline
if (mriFile.status === 'Failure') {
swal({
swal.fire({
title: 'Are you sure?',
text: 'A file with this name already exists!\n '
+ 'Would you like to overwrite the existing file?',
Expand All @@ -186,14 +186,14 @@ class UploadForm extends Component {
if (isConfirm) {
this.uploadFile(true);
} else {
swal('Cancelled', 'Your upload has been cancelled.', 'error');
swal.fire('Cancelled', 'Your upload has been cancelled.', 'error');
}
}.bind(this));
}

// Pipeline has not been triggered yet
if (mriFile.status === 'Not Started') {
swal({
swal.fire({
title: 'Are you sure?',
text: 'A file with this name has been uploaded '
+ 'but has not yet been processed by the MRI pipeline.\n '
Expand All @@ -206,7 +206,7 @@ class UploadForm extends Component {
if (isConfirm) {
this.uploadFile(true);
} else {
swal('Cancelled', 'Your upload has been cancelled.', 'error');
swal.fire('Cancelled', 'Your upload has been cancelled.', 'error');
}
}.bind(this));
}
Expand Down Expand Up @@ -270,7 +270,7 @@ class UploadForm extends Component {
+ 'Select this upload in the result table '
+ 'to view the processing progress';
}
swal({
swal.fire({
title: 'Upload Successful!',
text: text,
type: 'success',
Expand Down Expand Up @@ -318,7 +318,7 @@ class UploadForm extends Component {
}
}
}
swal({
swal.fire({
title: 'Submission error!',
text: messageToPrint,
type: 'error',
Expand Down
Loading