Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
let hasError = {
mriFile: true,
candID: false,
pSCID: false,
visitLabel: false,
};
this.setState({errorMessage, hasError});
return;
}
if (data.IsPhantom === 'N') {
if (!data.candID || !data.pSCID || !data.visitLabel) {
swal.fire({
title: 'Incorrect file name!',
text: 'Could not determine PSCID, CandID and Visit Label '
+ 'based on the filename!\n',
type: 'error',
confirmButtonText: 'OK',
});
return;
}
}
// Checks if a file with a given fileName has already been uploaded
const mriFile = this.props.mriList.find(
(mriFile) => mriFile.fileName.indexOf(fileName) > -1
);
// New File
async function promptTimeOffset(inputValue) {
const { value } = await swal.fire({
title: 'Set custom start time offset',
text: 'Instead of video apparently starting at 0, you can offset by a specified value (useful for viewing/cutting videos according to timecodes)',
input: 'text',
inputValue: inputValue || '',
showCancelButton: true,
inputPlaceholder: '00:00:00.000',
});
if (value === undefined) {
return undefined;
}
const duration = parseDuration(value);
// Invalid, try again
if (duration === undefined) return promptTimeOffset(value);
$('.delete-swal').click(function (e) {
e.preventDefault(); // Prevent the href from redirecting directly
var url = $(this).attr("href");
var title = $(this).attr("title");
Swal.fire({
title: title,
text: '',
icon: 'warning',
showCancelButton: true,
cancelButtonText: 'Cancel',
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes',
}).then((result) => {
if (result.value) {
/*Swal.fire(
'Deleted!',
'Your file has been deleted.',
'success'
)*/
window.location.href = url;
.then((data) => {
if (data.success) {
window.location.href = this.props.baseURL
+ '/issue_tracker/issue/'
+ this.props.issue;
} else {
swal.fire('Permission denied', '', 'error');
}
}).catch((error) => {
console.error(error);
.then((response) => {
if (response.ok) {
swal.fire({
text: 'Permission Update Success!',
title: '',
type: 'success',
});
this.props.fetchData();
return Promise.resolve();
} else {
let msg = response.statusText ?
response.statusText : 'Submission Error!';
swal.fire(msg, '', 'error');
console.error(msg);
return Promise.reject();
}
});
}
}, function(isConfirm) {
if (isConfirm) {
this.uploadFile(true);
} else {
swal.fire('Cancelled', 'Your upload has been cancelled.', 'error');
}
}.bind(this));
}
onInfoClick = () => {
Swal.fire({
title: 'Info',
text:
'Please copy and send the survey link to all participants. You will see the survey results for your session as soon as they are being submitted',
type: 'info',
confirmButtonText: 'Ok',
});
};
success: function() {
swal.fire('Edit Successful!', '', 'success');
},
error: function(jqXHR) {
let selection;
if (document.body.createTextRange) {
range = document.body.createTextRange();
range.moveToElementText(copyText);
range.select();
} else if (window.getSelection) {
selection = window.getSelection();
range = document.createRange();
range.selectNodeContents(copyText);
selection.removeAllRanges();
selection.addRange(range);
}
try {
document.execCommand('copy');
Swal.fire({
title: 'Success',
text: 'Link copied!',
type: 'success',
timer: 2000,
confirmButtonText: 'Ok',
});
} catch (err) {
Swal.fire({
title: 'Error',
text: 'Unable to cop the Link',
type: 'error',
timer: 2000,
confirmButtonText: 'Ok',
});
}
};
protected swalToast(duration: number, type: string, title: string) {
Swal.fire({
toast: true,
position: 'bottom-end',
showConfirmButton: false,
timer: duration,
type,
title
} as any);
}