Skip to content

Commit

Permalink
Merge branch 'master' into feat/storage-browser-14
Browse files Browse the repository at this point in the history
  • Loading branch information
ramprasadagarwal authored Jan 14, 2025
2 parents 9b485dd + b4b4e0e commit 5271bf3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 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 @@ -35,6 +35,7 @@ export const COPY_API_URL = '/api/v1/storage/copy/';
export const BULK_COPY_API_URL = '/api/v1/storage/copy/bulk/';
export const MOVE_API_URL = '/api/v1/storage/move/';
export const BULK_MOVE_API_URL = '/api/v1/storage/move/bulk/';
export const UPLOAD_AVAILABLE_SPACE_URL = '/api/v1/taskserver/upload/available_space/';

export interface ApiFileSystem {
file_system: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import {
UploadChunkItem,
UploadItem
} from './util';
import { get } from '../../../api/utils';
import { UPLOAD_AVAILABLE_SPACE_URL } from '../../../reactComponents/FileChooser/api';

interface UseUploadQueueResponse {
addFiles: (item: UploadItem[]) => void;
Expand Down Expand Up @@ -134,7 +136,20 @@ const useChunkUpload = ({
});
};

const checkAvailableSpace = async (fileSize: number) => {
const { upload_available_space: availableSpace } = await get<{
upload_available_space: number;
}>(UPLOAD_AVAILABLE_SPACE_URL);
return availableSpace >= fileSize;
};

const uploadItem = async (item: UploadItem) => {
const isSpaceAvailable = await checkAvailableSpace(item.file.size);
if (!isSpaceAvailable) {
onStatusUpdate(item, FileUploadStatus.Failed);
return Promise.resolve();
}

onStatusUpdate(item, FileUploadStatus.Uploading);
const chunks = getTotalChunk(item.file.size, chunkSize);
if (chunks === 1) {
Expand Down
2 changes: 1 addition & 1 deletion desktop/core/src/desktop/templates/job_browser_common.mako
Original file line number Diff line number Diff line change
Expand Up @@ -2401,7 +2401,7 @@
<tbody data-bind="foreach: properties['actions']">
<tr>
<td>
<a data-bind="hueLink: '/jobbrowser/jobs/' + ko.unwrap(externalId), clickBubble: false">
<a data-bind="hueLink: '/jobbrowser/jobs/#!id=' + ko.unwrap(externalId), clickBubble: false">
<i class="fa fa-tasks"></i>
</a>
</td>
Expand Down

0 comments on commit 5271bf3

Please sign in to comment.