X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fapp%2Fvideos%2Fvideo-list%2Fvideo-list.component.ts;h=6322860be8b0e8f3cd8d9a8f4df1a649af4fd9f3;hb=575fdcece562b914149f89f5a5b96ab206648f09;hp=3f54c98ceda6ca94e54785865d7360608e2836c9;hpb=ccf6ed16f1eeb05b77103bd44bc06ccbbbba9bdd;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/app/videos/video-list/video-list.component.ts b/client/app/videos/video-list/video-list.component.ts index 3f54c98ce..6322860be 100644 --- a/client/app/videos/video-list/video-list.component.ts +++ b/client/app/videos/video-list/video-list.component.ts @@ -19,27 +19,27 @@ import { VideoSortComponent } from './video-sort.component'; selector: 'my-videos-list', styleUrls: [ 'client/app/videos/video-list/video-list.component.css' ], templateUrl: 'client/app/videos/video-list/video-list.component.html', - directives: [ ROUTER_DIRECTIVES, PAGINATION_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent, LoaderComponent ] + directives: [ LoaderComponent, PAGINATION_DIRECTIVES, ROUTER_DIRECTIVES, VideoMiniatureComponent, VideoSortComponent ] }) export class VideoListComponent implements OnInit { - user: User = null; - videos: Video[] = []; + loading = false; pagination: Pagination = { currentPage: 1, itemsPerPage: 9, total: 0 }; sort: SortField; - loading = false; + user: User = null; + videos: Video[] = []; private search: Search; constructor( private authService: AuthService, - private videoService: VideoService, + private router: Router, private routeParams: RouteParams, - private router: Router + private videoService: VideoService ) { this.search = { value: this.routeParams.get('search'), @@ -73,12 +73,17 @@ export class VideoListComponent implements OnInit { ({ videos, totalVideos }) => { this.videos = videos; this.pagination.total = totalVideos; + this.loading = false; }, error => alert(error) ); } + noVideo() { + return !this.loading && this.videos.length === 0; + } + onRemoved(video: Video) { this.videos.splice(this.videos.indexOf(video), 1); } @@ -91,8 +96,8 @@ export class VideoListComponent implements OnInit { }; if (this.search.value) { - params.search = this.search.value; params.field = this.search.field; + params.search = this.search.value; } this.router.navigate(['VideosList', params]);