]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
disable download buttons while awaiting zip 630/head
authorshamoon <4887959+shamoon@users.noreply.github.com>
Sun, 3 Apr 2022 05:20:24 +0000 (22:20 -0700)
committershamoon <4887959+shamoon@users.noreply.github.com>
Sun, 3 Apr 2022 05:23:42 +0000 (22:23 -0700)
src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.html
src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.ts

index 0a92cd083a9109e5e9c1a66ca36bb9371c63dd0e..631b558d0bd70159c7e30af28703887edd8ce6d9 100644 (file)
   </div>
   <div class="col-auto ms-auto mb-2 mb-xl-0 d-flex">
     <div class="btn-group btn-group-sm me-2">
-      <button type="button" class="btn btn-outline-primary btn-sm" (click)="downloadSelected()">
-        <svg width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor">
+      <button type="button" [disabled]="awaitingDownload" class="btn btn-outline-primary btn-sm" (click)="downloadSelected()">
+        <svg *ngIf="!awaitingDownload" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor">
           <use xlink:href="assets/bootstrap-icons.svg#download" />
-        </svg>&nbsp;<ng-container i18n>Download</ng-container>
+        </svg>
+        <div *ngIf="awaitingDownload" class="spinner-border spinner-border-sm" role="status">
+          <span class="visually-hidden">Preparing download...</span>
+        </div>
+        &nbsp;
+        <ng-container i18n>Download</ng-container>
       </button>
       <div class="btn-group" ngbDropdown role="group" aria-label="Button group with nested dropdown">
-        <button class="btn btn-outline-primary btn-sm dropdown-toggle-split" ngbDropdownToggle></button>
+        <button [disabled]="awaitingDownload" class="btn btn-outline-primary btn-sm dropdown-toggle-split" ngbDropdownToggle></button>
         <div class="dropdown-menu shadow" ngbDropdownMenu>
           <button ngbDropdownItem i18n (click)="downloadSelected('originals')">Download originals</button>
         </div>
index 00d6a2273f8560116865ea1bca639ecac3e8eefa..c451f851e6b8ee24c4910d472267acd7432c4ff8 100644 (file)
@@ -39,6 +39,7 @@ export class BulkEditorComponent {
   tagSelectionModel = new FilterableDropdownSelectionModel()
   correspondentSelectionModel = new FilterableDropdownSelectionModel()
   documentTypeSelectionModel = new FilterableDropdownSelectionModel()
+  awaitingDownload: boolean
 
   constructor(
     private documentTypeService: DocumentTypeService,
@@ -317,10 +318,12 @@ export class BulkEditorComponent {
   }
 
   downloadSelected(content = 'archive') {
+    this.awaitingDownload = true
     this.documentService
       .bulkDownload(Array.from(this.list.selected), content)
       .subscribe((result: any) => {
         saveAs(result, 'documents.zip')
+        this.awaitingDownload = false
       })
   }
 }