Add admin videos loading animation

pull/4481/head
Chocobozzz 2021-11-02 11:17:17 +01:00
parent 7e7d8e4853
commit 61f85385bb
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 20 additions and 9 deletions

View File

@ -10,6 +10,7 @@
[showCurrentPageReport]="true" i18n-currentPageReportTemplate [showCurrentPageReport]="true" i18n-currentPageReportTemplate
currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} videos" currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} videos"
(onPage)="onPage($event)" [expandedRowKeys]="expandedRows" (onPage)="onPage($event)" [expandedRowKeys]="expandedRows"
[ngClass]="{ loading: loading }"
> >
<ng-template pTemplate="caption"> <ng-template pTemplate="caption">
<div class="caption"> <div class="caption">

View File

@ -15,3 +15,7 @@ my-embed {
.video-info > div { .video-info > div {
display: flex; display: flex;
} }
.loading {
opacity: 0.5;
}

View File

@ -1,11 +1,12 @@
import { SortMeta } from 'primeng/api' import { SortMeta } from 'primeng/api'
import { finalize } from 'rxjs/operators'
import { Component, OnInit } from '@angular/core' import { Component, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router' import { ActivatedRoute, Router } from '@angular/router'
import { AuthService, ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' 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 { AdvancedInputFilter } from '@app/shared/shared-forms'
import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature' import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature'
import { UserRight, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'
@Component({ @Component({
selector: 'my-video-list', selector: 'my-video-list',
@ -51,6 +52,8 @@ export class VideoListComponent extends RestTable implements OnInit {
liveInfo: false liveInfo: false
} }
loading = false
constructor ( constructor (
protected route: ActivatedRoute, protected route: ActivatedRoute,
protected router: Router, protected router: Router,
@ -135,11 +138,14 @@ export class VideoListComponent extends RestTable implements OnInit {
protected reloadData () { protected reloadData () {
this.selectedVideos = [] this.selectedVideos = []
this.loading = true
this.videoService.getAdminVideos({ this.videoService.getAdminVideos({
pagination: this.pagination, pagination: this.pagination,
sort: this.sort, sort: this.sort,
search: this.search search: this.search
}).subscribe({ }).pipe(finalize(() => this.loading = false))
.subscribe({
next: resultList => { next: resultList => {
this.videos = resultList.data this.videos = resultList.data
this.totalRecords = resultList.total this.totalRecords = resultList.total