]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-local.component.ts
Handle sort in rss
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-local.component.ts
CommitLineData
9af61e84 1import { Component, OnDestroy, OnInit } from '@angular/core'
066e94c5
C
2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils'
4import { NotificationsService } from 'angular2-notifications'
5import { AuthService } from '../../core/auth'
6import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7b87d2d5 7import { VideoSortField } from '../../shared/video/sort-field.type'
066e94c5 8import { VideoService } from '../../shared/video/video.service'
7b87d2d5 9import { VideoFilter } from '../../../../../shared/models/videos/video-query.type'
066e94c5
C
10
11@Component({
12 selector: 'my-videos-local',
13 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
14 templateUrl: '../../shared/video/abstract-video-list.html'
15})
9af61e84 16export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
066e94c5
C
17 titlePage = 'Local videos'
18 currentRoute = '/videos/local'
7b87d2d5
C
19 sort = '-createdAt' as VideoSortField
20 filter: VideoFilter = 'local'
066e94c5
C
21
22 constructor (protected router: Router,
23 protected route: ActivatedRoute,
24 protected notificationsService: NotificationsService,
25 protected authService: AuthService,
26 private videoService: VideoService) {
27 super()
28 }
29
30 ngOnInit () {
31 super.ngOnInit()
cc1561f9 32
244e76a5 33 this.generateSyndicationList()
066e94c5
C
34 }
35
9af61e84
C
36 ngOnDestroy () {
37 super.ngOnDestroy()
38 }
39
066e94c5
C
40 getVideosObservable (page: number) {
41 const newPagination = immutableAssign(this.pagination, { currentPage: page })
42
7b87d2d5 43 return this.videoService.getVideos(newPagination, this.sort, this.filter)
066e94c5 44 }
244e76a5
RK
45
46 generateSyndicationList () {
7b87d2d5 47 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter)
244e76a5 48 }
066e94c5 49}