mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-21 01:57:41 +02:00
Multiple fixes and ZIP file support in File Manager
Features: - ZIP file support in File Manager (Issue #121): Upload ZIP files to automatically extract contents with option to preserve folder structure - Delete operation loading indicator: Shows progress during folder/file deletion operations Fixed: - Print time stats using actual elapsed time instead of slicer estimates (Issue #137) - Skip objects modal overflow with scrollable list for many objects (Issue #134) Removed: - Duplicate badge feature from File Manager (per user request) Tests: - Added ZIP extraction backend tests (5 tests) - Added ConfirmModal loading state frontend tests (5 tests)
This commit is contained in:
@@ -2720,6 +2720,26 @@ export const api = {
|
||||
}
|
||||
return response.json();
|
||||
},
|
||||
extractZipFile: async (
|
||||
file: File,
|
||||
folderId?: number | null,
|
||||
preserveStructure: boolean = true
|
||||
): Promise<ZipExtractResponse> => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const params = new URLSearchParams();
|
||||
if (folderId) params.set('folder_id', String(folderId));
|
||||
params.set('preserve_structure', String(preserveStructure));
|
||||
const response = await fetch(`${API_BASE}/library/files/extract-zip?${params}`, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
});
|
||||
if (!response.ok) {
|
||||
const error = await response.json().catch(() => ({}));
|
||||
throw new Error(error.detail || `HTTP ${response.status}`);
|
||||
}
|
||||
return response.json();
|
||||
},
|
||||
updateLibraryFile: (id: number, data: LibraryFileUpdate) =>
|
||||
request<LibraryFile>(`/library/files/${id}`, {
|
||||
method: 'PUT',
|
||||
@@ -3007,6 +3027,24 @@ export interface LibraryStats {
|
||||
disk_used_bytes: number;
|
||||
}
|
||||
|
||||
export interface ZipExtractResult {
|
||||
filename: string;
|
||||
file_id: number;
|
||||
folder_id: number | null;
|
||||
}
|
||||
|
||||
export interface ZipExtractError {
|
||||
filename: string;
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface ZipExtractResponse {
|
||||
extracted: number;
|
||||
folders_created: number;
|
||||
files: ZipExtractResult[];
|
||||
errors: ZipExtractError[];
|
||||
}
|
||||
|
||||
// Library Queue types
|
||||
export interface AddToQueueResult {
|
||||
file_id: number;
|
||||
|
||||
Reference in New Issue
Block a user