From cf2adc3b88c13a9669c46e9e7ff0e24574de3484 Mon Sep 17 00:00:00 2001
From: Florent Poittevin <florent.poittevin@unige.ch>
Date: Thu, 31 Oct 2019 15:26:22 +0100
Subject: [PATCH] style: display no data found on data table only when no
 current loading

---
 .../components/routables/home-search/home-search.routable.html | 1 +
 .../dialogs/shared-history/shared-history.dialog.html          | 1 +
 .../shared-data-table/shared-data-table.presentational.html    | 2 +-
 .../shared-data-table/shared-data-table.presentational.ts      | 3 +++
 .../shared-abstract-list/shared-abstract-list.routable.html    | 1 +
 5 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/app/features/home/components/routables/home-search/home-search.routable.html b/src/app/features/home/components/routables/home-search/home-search.routable.html
index 2563bcfcb..b7ecae3cc 100644
--- a/src/app/features/home/components/routables/home-search/home-search.routable.html
+++ b/src/app/features/home/components/routables/home-search/home-search.routable.html
@@ -31,6 +31,7 @@
      class="wrapper"
 >
   <dlcm-shared-data-table *ngIf="(listAdaptedObs | async).length > 0;"
+                          [isLoading]="(isLoadingObs | async) || (isLoadingOrgUnitObs | async)"
                           [columns]="columns"
                           [datas]="listAdaptedObs | async"
                           [skipInitialQuery]="true"
diff --git a/src/app/shared/components/dialogs/shared-history/shared-history.dialog.html b/src/app/shared/components/dialogs/shared-history/shared-history.dialog.html
index 5864167ba..6f4f45555 100644
--- a/src/app/shared/components/dialogs/shared-history/shared-history.dialog.html
+++ b/src/app/shared/components/dialogs/shared-history/shared-history.dialog.html
@@ -4,6 +4,7 @@
        [dlcmSpinner]="data.isLoading | async"
   >
     <dlcm-shared-data-table [columns]="columns"
+                            [isLoading]="data.isLoading | async"
                             [datas]="data.statusHistory | async"
     ></dlcm-shared-data-table>
   </div>
diff --git a/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.html b/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.html
index 2cc95bed7..dfb5fa9c8 100644
--- a/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.html
+++ b/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.html
@@ -128,7 +128,7 @@
       </tr>
     </ng-template>
   </p-table>
-  <div *ngIf="isDatasPresent === false"
+  <div *ngIf="isLoading === false && isDatasPresent === false"
        class="no-datas"
   >
     <mat-icon class="icon">sentiment_dissatisfied</mat-icon>
diff --git a/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.ts b/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.ts
index eb40cf17b..6bc30678c 100644
--- a/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.ts
+++ b/src/app/shared/components/presentationals/shared-data-table/shared-data-table.presentational.ts
@@ -56,6 +56,9 @@ export class SharedDataTablePresentational<T> extends SharedAbstractPresentation
   @Input()
   skipInitialQuery: boolean = false;
 
+  @Input()
+  isLoading: boolean = false;
+
   private _queryParameters: QueryParameters;
 
   @Input()
diff --git a/src/app/shared/components/routables/shared-abstract-list/shared-abstract-list.routable.html b/src/app/shared/components/routables/shared-abstract-list/shared-abstract-list.routable.html
index d6a5ae0c7..397fc2795 100644
--- a/src/app/shared/components/routables/shared-abstract-list/shared-abstract-list.routable.html
+++ b/src/app/shared/components/routables/shared-abstract-list/shared-abstract-list.routable.html
@@ -29,6 +29,7 @@
        [dlcmSpinner]="isLoadingObs | async"
   >
     <dlcm-shared-data-table [columns]="columns"
+                            [isLoading]="isLoadingObs | async"
                             [datas]="listObs | async"
                             [queryParameters]="queryParametersObs | async"
                             (selectChange)="showDetail($event)"
-- 
GitLab