Improve robustness of book uploader error handling (#2130)
Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
@@ -86,7 +86,6 @@
|
||||
</div>
|
||||
<p-fileupload
|
||||
name="file"
|
||||
[maxFileSize]="maxFileSizeBytes"
|
||||
[customUpload]="true"
|
||||
[multiple]="true"
|
||||
accept=".pdf,.epub,.cbz,.cbr,.cb7,.fb2"
|
||||
@@ -133,7 +132,7 @@
|
||||
<div class="file-item">
|
||||
<div class="file-info">
|
||||
<p-badge
|
||||
[value]="uploadFile.status === 'Pending' ? 'Ready' : uploadFile.status"
|
||||
[value]="getFileStatusLabel(uploadFile)"
|
||||
[severity]="getBadgeSeverity(uploadFile.status)"/>
|
||||
<span class="file-name">{{ uploadFile.file.name }}</span>
|
||||
<span class="file-size">{{ formatSize(uploadFile.file.size) }}</span>
|
||||
@@ -155,11 +154,28 @@
|
||||
<i class="pi pi-check status-icon success"></i>
|
||||
}
|
||||
@case ('Failed') {
|
||||
<i
|
||||
class="pi pi-exclamation-triangle status-icon error"
|
||||
[pTooltip]="uploadFile.errorMessage || 'Upload failed'"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
@if (uploadFile.errorMessage?.includes('exceeds maximum size')) {
|
||||
@if (hasUploadCompleted()) {
|
||||
<i
|
||||
class="pi pi-exclamation-triangle status-icon warning"
|
||||
[pTooltip]="uploadFile.errorMessage || 'File too large'"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
} @else {
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
(click)="onRemoveTemplatingFile($event, uploadFile.file, removeFileCallback, i)"
|
||||
severity="danger"
|
||||
[text]="true"
|
||||
[rounded]="true"/>
|
||||
}
|
||||
} @else {
|
||||
<i
|
||||
class="pi pi-exclamation-triangle status-icon error"
|
||||
[pTooltip]="uploadFile.errorMessage || 'Upload failed'"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@@ -172,13 +188,13 @@
|
||||
<ng-template #empty>
|
||||
<div class="empty-state">
|
||||
<div class="empty-icon-wrapper">
|
||||
<i class="pi pi-cloud-upload empty-icon"></i>
|
||||
<i class="pi pi-cloud-upload empty-icon" [class.active]="isUploadZoneActive()"></i>
|
||||
</div>
|
||||
<h3 class="empty-title">Drag and Drop Files</h3>
|
||||
<p class="empty-description">
|
||||
Supported formats: <strong>.pdf</strong>, <strong>.epub</strong>, <strong>.cbz</strong>, <strong>.cbr</strong>, <strong>.cb7</strong>, <strong>.fb2</strong>
|
||||
<br/>
|
||||
Maximum file size: 100 MB per file
|
||||
Maximum file size: {{ maxFileSizeDisplay }} per file
|
||||
</p>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
Reference in New Issue
Block a user