Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Show upload error details and fix delete dialog overflow
  • Loading branch information
Chris Scott committed Dec 14, 2025
commit 782bfe97dd57805783721bd2861fee2900dabe7f
49 changes: 33 additions & 16 deletions frontend/src/components/file-browser/FileBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,6 @@ useEffect(() => {
} : null)

await loadFiles(currentPath)

setTimeout(() => {
setUploadProgress(null)
if (errors.length > 0) {
setError(`${errors.length} file(s) failed to upload`)
}
}, 2000)
}, [currentPath, uploadSingleFile])

const handleUpload = useCallback(async (fileList: FileList) => {
Expand Down Expand Up @@ -408,14 +401,17 @@ useEffect(() => {
file.name.toLowerCase().includes(searchQuery.toLowerCase())
)

const isUploadComplete = uploadProgress && uploadProgress.current >= uploadProgress.total
const canDismissDialog = isUploadComplete || uploadProgress?.cancelled

const uploadDialog = (
<Dialog open={!!uploadProgress} onOpenChange={() => {}}>
<DialogContent className="sm:max-w-md" hideCloseButton>
<Dialog open={!!uploadProgress} onOpenChange={(open) => { if (!open && canDismissDialog) setUploadProgress(null) }}>
<DialogContent className="sm:max-w-md" hideCloseButton={!canDismissDialog}>
<DialogHeader>
<DialogTitle className="flex items-center justify-between">
<span>
{uploadProgress?.cancelled ? 'Upload Cancelled' :
uploadProgress && uploadProgress.current >= uploadProgress.total ? 'Upload Complete' : 'Uploading...'}
isUploadComplete ? 'Upload Complete' : 'Uploading...'}
</span>
{uploadProgress && uploadProgress.current < uploadProgress.total && !uploadProgress.cancelled && (
<Button variant="ghost" size="sm" onClick={cancelUpload}>
Expand All @@ -433,14 +429,35 @@ useEffect(() => {
<p className="text-sm text-muted-foreground">
{uploadProgress.current} / {uploadProgress.total} files
</p>
<p className="text-xs text-muted-foreground truncate">
{uploadProgress.currentFile}
</p>
{uploadProgress.errors.length > 0 && (
<p className="text-xs text-destructive">
{uploadProgress.errors.length} file(s) failed
{!isUploadComplete && (
<p className="text-xs text-muted-foreground truncate">
{uploadProgress.currentFile}
</p>
)}
{uploadProgress.errors.length > 0 && (
<div className="space-y-2">
<p className="text-sm font-medium text-destructive">
{uploadProgress.errors.length} file(s) failed:
</p>
<div className="max-h-32 overflow-y-auto rounded border border-destructive/20 bg-destructive/5 p-2">
{uploadProgress.errors.map((error, index) => (
<p key={index} className="text-xs text-destructive break-all">
{error}
</p>
))}
</div>
</div>
)}
{canDismissDialog && (
<Button
variant="outline"
size="sm"
className="w-full mt-2"
onClick={() => setUploadProgress(null)}
>
Close
</Button>
)}
</div>
)}
</DialogContent>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/ui/delete-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export function DeleteDialog({
</DialogHeader>

{itemName && (
<Alert>
<AlertTriangle className="h-4 w-4" />
<AlertDescription>
This will permanently delete "{itemName}". This action cannot be undone.
<Alert className="overflow-hidden">
<AlertTriangle className="h-4 w-4 flex-shrink-0" />
<AlertDescription className="break-all">
This will permanently delete "<span className="font-medium">{itemName}</span>". This action cannot be undone.
</AlertDescription>
</Alert>
)}
Expand Down