X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2Fvideo-list%2Fvideo-local.component.ts;h=fd67be67b5cba2cee1d3a4fcc51d88e2b18c0d0e;hb=2a2c19dfef7a9aa313c6ca0798f271c9a63449a9;hp=8cac2c12c2a052e1ba3d7535b647a6df3abb37a9;hpb=066e94c5382a761180c7d82fa24b31b66dbeaca4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts index 8cac2c12c..fd67be67b 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts @@ -1,37 +1,51 @@ -import { Component, OnInit } from '@angular/core' +import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { immutableAssign } from '@app/shared/misc/utils' +import { Location } from '@angular/common' import { NotificationsService } from 'angular2-notifications' import { AuthService } from '../../core/auth' import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { SortField } from '../../shared/video/sort-field.type' +import { VideoSortField } from '../../shared/video/sort-field.type' import { VideoService } from '../../shared/video/video.service' +import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' @Component({ selector: 'my-videos-local', styleUrls: [ '../../shared/video/abstract-video-list.scss' ], templateUrl: '../../shared/video/abstract-video-list.html' }) -export class VideoLocalComponent extends AbstractVideoList implements OnInit { +export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { titlePage = 'Local videos' currentRoute = '/videos/local' - sort = '-createdAt' as SortField + sort = '-createdAt' as VideoSortField + filter: VideoFilter = 'local' constructor (protected router: Router, protected route: ActivatedRoute, protected notificationsService: NotificationsService, protected authService: AuthService, + protected location: Location, private videoService: VideoService) { super() } ngOnInit () { super.ngOnInit() + + this.generateSyndicationList() + } + + ngOnDestroy () { + super.ngOnDestroy() } getVideosObservable (page: number) { const newPagination = immutableAssign(this.pagination, { currentPage: page }) - return this.videoService.getVideos(newPagination, this.sort, 'local') + return this.videoService.getVideos(newPagination, this.sort, this.filter) + } + + generateSyndicationList () { + this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter) } }