Skip to content

Commit

Permalink
Removed changes to files unrelated to task due to pointing a branch t…
Browse files Browse the repository at this point in the history
…o a branch other than main
  • Loading branch information
Jeff McMillen authored and Jeff McMillen committed Dec 18, 2024
1 parent d3a086c commit e8d9863
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const DataFilesPreviewModal = () => {
<NiiVue imageUrl={href} fileName={params.path}></NiiVue>
)}
{previewUsingHref && !previewUsingBrainmap && (
<div className="embed-responsive embed-responsive-4by3">
<div className="ratio ratio-4x3">
<iframe
title="preview"
frameBorder="0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,25 @@ import { LoadingSpinner, InlineMessage, Button } from '_common';
import { FileLengthCell } from '../../DataFilesListing/DataFilesListingCells';
import { useUpload } from 'hooks/datafiles/mutations';
import styles from './DataFilesUploadModalListingTable.module.scss';
import { useSelector } from 'react-redux';

const DataFilesUploadStatus = ({ i, removeCallback, rejectedFiles }) => {
if (rejectedFiles.filter((f) => f.id === i).length > 0) {
return <InlineMessage type="error">Exceeds File Size Limit</InlineMessage>;
}
const errorMessage = useSelector((state) => state.files.error.message);
const status = useUpload().status[i];
switch (status) {
case 'UPLOADING':
return <LoadingSpinner placement="inline" />;
case 'SUCCESS':
return <span className="badge badge-success">SUCCESS</span>;
case 'ERROR':
return <InlineMessage type="error">Upload Failed</InlineMessage>;
return (
<InlineMessage type="error">
Upload Failed: {errorMessage}
</InlineMessage>
);
default:
return (
<Button type="link" onClick={() => removeCallback(i)}>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Submissions/Submissions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const Submissions = () => {

const useSubmitterRole = () => {
const query = useQuery({
queryKey: 'submitter-role',
queryKey: ['submitter-role'],
queryFn: getSubmitterRole,
});
return query;
Expand Down
25 changes: 16 additions & 9 deletions client/src/redux/sagas/datafiles.sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,16 +486,23 @@ export async function uploadFileUtil(api, scheme, system, path, file) {
`/api/datafiles/${api}/upload/${scheme}/${system}/${apiPath}/`
);

const request = await fetch(url, {
method: 'POST',
headers: { 'X-CSRFToken': Cookies.get('csrftoken') },
credentials: 'same-origin',
body: formData,
});
if (!request.ok) {
throw new Error(request.status);
try {
const request = await fetch(url, {
method: 'POST',
headers: { 'X-CSRFToken': Cookies.get('csrftoken') },
credentials: 'same-origin',
body: formData,
});
if (!request.ok) {
throw new Error(`HTTP error: ${request.status}`);
}
return request;
} catch (error) {
if (error instanceof TypeError) {
throw new Error('Network error: The file upload was blocked.');
}
throw error;
}
return request;
}

export function* watchUpload() {
Expand Down

0 comments on commit e8d9863

Please sign in to comment.