Skip to content

Commit fa7c4a5

Browse files
committed
fix(upload): fix visual issues on dataset upload UI
1 parent 8ee05c1 commit fa7c4a5

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

features/DatasetUpload/FileUpload.tsx renamed to features/DatasetUpload/DatasetUpload.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { BulkUploadDropzone } from "./BulkUploadDropzone";
2020
/**
2121
* Button that controls a modal with UI to upload files to the DM API
2222
*/
23-
export const FileUpload = () => {
23+
export const DatasetUpload = () => {
2424
const [open, setOpen] = useState(false);
2525
// Array of the user uploaded files with associated errors
2626
const [files, setFiles] = useState<UploadableFile[]>([]);

features/DatasetUpload/SingleFileUploader.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@ export function SingleFileUploadWithProgress({
4242
// const typeLabelParts = fileWrapper.file.name.split('.');
4343

4444
const [interval, setInterval] = useState<number | false>(2000);
45-
const { data: task, isLoading } = useGetTask(fileWrapper.taskId ?? "", undefined, {
45+
const {
46+
data: task,
47+
isLoading,
48+
isFetching,
49+
} = useGetTask(fileWrapper.taskId ?? "", undefined, {
4650
query: {
51+
enabled: fileWrapper.taskId !== null,
4752
// When a task id has been set, we poll the task endpoint to wait for the file to finish
4853
// processing
4954
refetchInterval: interval,
@@ -63,7 +68,7 @@ export function SingleFileUploadWithProgress({
6368
const disabled =
6469
(task && !task.done) ||
6570
(fileWrapper.progress < 100 && fileWrapper.progress > 0) ||
66-
isLoading ||
71+
isFetching ||
6772
(fileWrapper.progress === 100 && task === undefined);
6873

6974
return (
@@ -125,7 +130,9 @@ export function SingleFileUploadWithProgress({
125130
<LinearProgress value={fileWrapper.progress} variant="determinate" />
126131
)}
127132

128-
{(fileWrapper.progress === 100 && task === undefined) || (task && !task.done) || isLoading ? (
133+
{(fileWrapper.progress === 100 && task === undefined) ||
134+
(task && !task.done) ||
135+
isFetching ? (
129136
<LinearProgress />
130137
) : null}
131138

features/DatasetUpload/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from "./FileUpload";
1+
export * from "./DatasetUpload";

features/DatasetsTable/DatasetsTable.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import type { TableDataset } from "./types";
2323
import { useDatasetsFilter } from "./useDatasetsFilter";
2424
import { useSelectedDatasets } from "./useSelectedDatasets";
2525

26-
const FileUpload = dynamic<Record<string, never>>(
27-
() => import("../DatasetUpload").then((mod) => mod.FileUpload),
26+
const DatasetUpload = dynamic<Record<string, never>>(
27+
() => import("../DatasetUpload").then((mod) => mod.DatasetUpload),
2828
{
2929
loading: () => <CircularProgress size="1rem" />,
3030
},
@@ -143,7 +143,7 @@ export const DatasetsTable = () => {
143143
ToolbarActionChild={<DatasetsBulkActions selectedDatasets={selectedDatasets} />}
144144
ToolbarChild={
145145
<>
146-
<FileUpload />
146+
<DatasetUpload />
147147
<DatasetsFilterToolbar
148148
fullWidthFilters={
149149
<LabelsFilter

0 commit comments

Comments
 (0)