]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/videos/video-list/video-local.component.ts
Add ability to click on the account in watch page
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-local.component.ts
1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { immutableAssign } from '@app/shared/misc/utils'
4 import { NotificationsService } from 'angular2-notifications'
5 import { AuthService } from '../../core/auth'
6 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7 import { VideoSortField } from '../../shared/video/sort-field.type'
8 import { VideoService } from '../../shared/video/video.service'
9 import { VideoFilter } from '../../../../../shared/models/videos/video-query.type'
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 })
16 export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
17 titlePage = 'Local videos'
18 currentRoute = '/videos/local'
19 sort = '-createdAt' as VideoSortField
20 filter: VideoFilter = 'local'
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()
32
33 this.generateSyndicationList()
34 }
35
36 ngOnDestroy () {
37 super.ngOnDestroy()
38 }
39
40 getVideosObservable (page: number) {
41 const newPagination = immutableAssign(this.pagination, { currentPage: page })
42
43 return this.videoService.getVideos(newPagination, this.sort, this.filter)
44 }
45
46 generateSyndicationList () {
47 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter)
48 }
49 }