Skip to content

Commit

Permalink
Merge branch 'master' into onload-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tabraiz12 authored Jan 15, 2025
2 parents a69c434 + d2c8ce0 commit 5ab854d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
3 changes: 1 addition & 2 deletions apps/filebrowser/src/filebrowser/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def display(request):
return HttpResponse(f'Cannot request chunks greater than {MAX_CHUNK_SIZE_BYTES} bytes.', status=400)

# Read out based on meta.
compression, offset, length, contents = read_contents(compression, path, request.fs, offset, length)
_, offset, length, contents = read_contents(compression, path, request.fs, offset, length)

# Get contents as string for text mode, or at least try
file_contents = None
Expand All @@ -364,7 +364,6 @@ def display(request):
'length': length,
'end': offset + len(contents),
'mode': mode,
'compression': compression,
}

return JsonResponse(data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ $icon-margin: 5px;
height: $cell-height;
@include mixins.nowrap-ellipsis;
}

td.ant-table-cell:first-child {
text-overflow: initial;
}
}

.hue-storage-browser__table-cell-name {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ import formatBytes from '../../../utils/formatBytes';
import './StorageDirectoryPage.scss';
import { formatTimestamp } from '../../../utils/dateTimeUtils';
import useLoadData from '../../../utils/hooks/useLoadData';
import { DEFAULT_PAGE_SIZE, FileUploadStatus } from '../../../utils/constants/storageBrowser';
import {
DEFAULT_PAGE_SIZE,
DEFAULT_POLLING_TIME,
FileUploadStatus
} from '../../../utils/constants/storageBrowser';
import CreateAndUploadAction from './CreateAndUploadAction/CreateAndUploadAction';
import DragAndDrop from '../../../reactComponents/DragAndDrop/DragAndDrop';
import UUID from '../../../utils/string/UUID';
Expand Down Expand Up @@ -77,6 +81,7 @@ const StorageDirectoryPage = ({
const [tableHeight, setTableHeight] = useState<number>(100);
const [selectedFiles, setSelectedFiles] = useState<StorageDirectoryTableData[]>([]);
const [filesToUpload, setFilesToUpload] = useState<UploadItem[]>([]);
const [polling, setPolling] = useState<boolean>(false);

const [pageSize, setPageSize] = useState<number>(DEFAULT_PAGE_SIZE);
const [pageNumber, setPageNumber] = useState<number>(1);
Expand Down Expand Up @@ -106,7 +111,8 @@ const StorageDirectoryPage = ({
fileStats.type !== BrowserViewType.dir,
onSuccess: () => {
setSelectedFiles([]);
}
},
pollInterval: polling ? DEFAULT_POLLING_TIME : undefined
});

const tableData: StorageDirectoryTableData[] = useMemo(() => {
Expand Down Expand Up @@ -234,6 +240,7 @@ const StorageDirectoryPage = ({
status: FileUploadStatus.Pending
};
});
setPolling(true);
setFilesToUpload(prevFiles => [...prevFiles, ...newUploadItems]);
};

Expand Down Expand Up @@ -302,7 +309,10 @@ const StorageDirectoryPage = ({
</div>

<DragAndDrop onDrop={onFilesDrop}>
<LoadingErrorWrapper loading={loadingFiles || listDirectoryLoading} errors={errorConfig}>
<LoadingErrorWrapper
loading={(loadingFiles || listDirectoryLoading) && !polling}
errors={errorConfig}
>
<Table
className={className}
columns={getColumns(tableData[0] ?? {})}
Expand All @@ -312,11 +322,13 @@ const StorageDirectoryPage = ({
rowClassName={rowClassName}
rowKey={r => `${r.path}_${r.type}_${r.mtime}`}
rowSelection={{
hideSelectAll: !tableData.length,
columnWidth: 36,
type: 'checkbox',
...rowSelection
}}
scroll={{ y: tableHeight }}
data-testid={`${testId}`}
data-testid={testId}
locale={locale}
{...restProps}
/>
Expand All @@ -337,7 +349,10 @@ const StorageDirectoryPage = ({
<FileUploadQueue
filesQueue={filesToUpload}
onClose={() => setFilesToUpload([])}
onComplete={reloadData}
onComplete={() => {
reloadData();
setPolling(false);
}}
/>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const DEFAULT_PAGE_SIZE = 50;
export const DEFAULT_CHUNK_SIZE = 5 * 1024 * 1024; // 5 MiB
export const DEFAULT_CONCURRENT_MAX_CONNECTIONS = 3;
export const DEFAULT_ENABLE_CHUNK_UPLOAD = false;
export const DEFAULT_POLLING_TIME = 10 * 1000; // 10 seconds

export enum SupportedFileTypes {
IMAGE = 'image',
Expand Down

0 comments on commit 5ab854d

Please sign in to comment.