From 463ef39afd9bde072f92d0f55de2064436ad97e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Agneray?= <francois.agneray@lam.fr>
Date: Tue, 15 Mar 2022 11:01:36 +0100
Subject: [PATCH] Add spinner for download pending file

---
 .../components/result/download-file-tab.component.html     | 7 ++++++-
 .../app/instance/store/reducers/download-file.reducer.ts   | 3 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/client/src/app/instance/search/components/result/download-file-tab.component.html b/client/src/app/instance/search/components/result/download-file-tab.component.html
index 49f60cee..c4032c0b 100644
--- a/client/src/app/instance/search/components/result/download-file-tab.component.html
+++ b/client/src/app/instance/search/components/result/download-file-tab.component.html
@@ -3,7 +3,12 @@
         Files downloaded : 
         <ul>
             <li *ngFor="let downloadFile of downloadedFiles">
-                {{ downloadFile.fileName }} : 
+                {{ downloadFile.fileName }} :
+                <ng-container *ngIf="downloadFile.state == 'PENDING'">
+                    <br>
+                    <span class="fas fa-circle-notch fa-spin"></span>
+                    <span class="sr-only">Loading...</span>
+                </ng-container>
                 <progressbar [value]="downloadFile.progress" [type]="getType(downloadFile.progress)" [animate]="true">{{ downloadFile.progress }}%</progressbar> 
             </li>
         </ul>
diff --git a/client/src/app/instance/store/reducers/download-file.reducer.ts b/client/src/app/instance/store/reducers/download-file.reducer.ts
index 64daf37e..372e24a9 100644
--- a/client/src/app/instance/store/reducers/download-file.reducer.ts
+++ b/client/src/app/instance/store/reducers/download-file.reducer.ts
@@ -63,7 +63,8 @@ export const fileReducer = createReducer(
             ...state.downloadedFiles.filter(f => f.id !== fileId),
             {
                 ...state.downloadedFiles.find(f => f.id === fileId),
-                progress: progress
+                progress: progress,
+                state: 'IN_PROGRESS'
             }
         ]
     })),
-- 
GitLab