-<app-widget-frame [title]="savedView.name">
+<app-widget-frame [title]="savedView.name" [loading]="loading">
<a class="btn-link" header-buttons [routerLink]="[]" (click)="showAll()" i18n>Show all</a>
styleUrls: ['./saved-view-widget.component.scss'],
})
export class SavedViewWidgetComponent implements OnInit, OnDestroy {
+ loading: boolean = true
+
constructor(
private documentService: DocumentService,
private router: Router,
}
reload() {
+ this.loading = true
this.documentService
.listFiltered(
1,
this.savedView.filter_rules
)
.subscribe((result) => {
+ this.loading = false
this.documents = result.results
})
}
-<app-widget-frame title="Statistics" i18n-title>
+<app-widget-frame title="Statistics" [loading]="loading" i18n-title>
<ng-container content>
<p class="card-text" i18n *ngIf="statistics?.documents_inbox != null">Documents in inbox: {{statistics?.documents_inbox}}</p>
<p class="card-text" i18n>Total documents: {{statistics?.documents_total}}</p>
styleUrls: ['./statistics-widget.component.scss'],
})
export class StatisticsWidgetComponent implements OnInit, OnDestroy {
+ loading: boolean = true
+
constructor(
private http: HttpClient,
private consumerStatusService: ConsumerStatusService
}
reload() {
+ this.loading = true
this.getStatistics().subscribe((statistics) => {
+ this.loading = false
this.statistics = statistics
})
}
<div class="card-header">
<div class="d-flex justify-content-between align-items-center">
<h5 class="card-title mb-0">{{title}}</h5>
+ <ng-container *ngIf="loading">
+ <div class="spinner-border spinner-border-sm fw-normal ms-2 me-auto" role="status"></div>
+ <div class="visually-hidden" i18n>Loading...</div>
+ </ng-container>
<ng-content select ="[header-buttons]"></ng-content>
</div>
@Input()
title: string
+ @Input()
+ loading: boolean = false
+
ngOnInit(): void {}
}