feat(ui): add auto-refresh after upload and inline file preview
- Auto-refresh files table after successful uploads using custom event - Add inline preview support for PDFs, images, and text files - Set Content-Disposition header to inline for preview endpoint - Add download button as secondary action in file details view Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -835,27 +835,17 @@
|
||||
|
||||
// Process the dropped files
|
||||
processFiles(e.dataTransfer.files, uploadProgressContainer, uploadStatusMessage);
|
||||
|
||||
// Optionally reload page after uploads complete (with a delay)
|
||||
setTimeout(() => {
|
||||
const fileStatuses = document.querySelectorAll('.file-status');
|
||||
let allCompleted = true;
|
||||
fileStatuses.forEach(status => {
|
||||
if (!status.textContent.includes('Success') && !status.textContent.includes('Error')) {
|
||||
allCompleted = false;
|
||||
}
|
||||
});
|
||||
|
||||
if (allCompleted && fileStatuses.length > 0) {
|
||||
// Refresh the page after a short delay to show the new files
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 2000);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
// Listen for upload completion event and reload the page to show new files
|
||||
window.addEventListener('allUploadsComplete', (e) => {
|
||||
// Wait 2 seconds to let users see the success message
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
function closeUploadModal() {
|
||||
uploadModal.classList.remove('active');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user