]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add admin videos loading animation
authorChocobozzz <me@florianbigard.com>
Tue, 2 Nov 2021 10:17:17 +0000 (11:17 +0100)
committerChocobozzz <me@florianbigard.com>
Tue, 2 Nov 2021 10:17:17 +0000 (11:17 +0100)
client/src/app/+admin/overview/videos/video-list.component.html
client/src/app/+admin/overview/videos/video-list.component.scss
client/src/app/+admin/overview/videos/video-list.component.ts

index dd4ab178e542e9b57f0a16df9a07b40c2820afbc..67b554aaf5bcded6b4ef86cb61704bc380013627 100644 (file)
@@ -10,6 +10,7 @@
   [showCurrentPageReport]="true" i18n-currentPageReportTemplate
   currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} videos"
   (onPage)="onPage($event)" [expandedRowKeys]="expandedRows"
+  [ngClass]="{ loading: loading }"
 >
   <ng-template pTemplate="caption">
     <div class="caption">
index 158c161af55ede28a1f100292a83812305307728..5ec9d48507c679e980c98298e7dd0bdb3959ec59 100644 (file)
@@ -15,3 +15,7 @@ my-embed {
 .video-info > div {
   display: flex;
 }
+
+.loading {
+  opacity: 0.5;
+}
index 8bd171c53ece4122aa1fa679146104c95296ee3c..ed3a86b963e9c47393d57e1e9adcfbfa9a4fef3d 100644 (file)
@@ -1,11 +1,12 @@
 import { SortMeta } from 'primeng/api'
+import { finalize } from 'rxjs/operators'
 import { Component, OnInit } from '@angular/core'
 import { ActivatedRoute, Router } from '@angular/router'
 import { AuthService, ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'
-import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
-import { UserRight, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'
 import { AdvancedInputFilter } from '@app/shared/shared-forms'
+import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
 import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature'
+import { UserRight, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'
 
 @Component({
   selector: 'my-video-list',
@@ -51,6 +52,8 @@ export class VideoListComponent extends RestTable implements OnInit {
     liveInfo: false
   }
 
+  loading = false
+
   constructor (
     protected route: ActivatedRoute,
     protected router: Router,
@@ -135,18 +138,21 @@ export class VideoListComponent extends RestTable implements OnInit {
   protected reloadData () {
     this.selectedVideos = []
 
+    this.loading = true
+
     this.videoService.getAdminVideos({
       pagination: this.pagination,
       sort: this.sort,
       search: this.search
-    }).subscribe({
-      next: resultList => {
-        this.videos = resultList.data
-        this.totalRecords = resultList.total
-      },
-
-      error: err => this.notifier.error(err.message)
-    })
+    }).pipe(finalize(() => this.loading = false))
+      .subscribe({
+        next: resultList => {
+          this.videos = resultList.data
+          this.totalRecords = resultList.total
+        },
+
+        error: err => this.notifier.error(err.message)
+      })
   }
 
   private async removeVideos (videos: Video[]) {