]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/videos/video-list/video-local.component.ts
category parma -> categoryOneOf (videos list)
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-local.component.ts
... / ...
CommitLineData
1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils'
4import { Location } from '@angular/common'
5import { NotificationsService } from 'angular2-notifications'
6import { AuthService } from '../../core/auth'
7import { AbstractVideoList } from '../../shared/video/abstract-video-list'
8import { VideoSortField } from '../../shared/video/sort-field.type'
9import { VideoService } from '../../shared/video/video.service'
10import { VideoFilter } from '../../../../../shared/models/videos/video-query.type'
11import { I18n } from '@ngx-translate/i18n-polyfill'
12import { ScreenService } from '@app/shared/misc/screen.service'
13
14@Component({
15 selector: 'my-videos-local',
16 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
17 templateUrl: '../../shared/video/abstract-video-list.html'
18})
19export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
20 titlePage: string
21 currentRoute = '/videos/local'
22 sort = '-publishedAt' as VideoSortField
23 filter: VideoFilter = 'local'
24
25 constructor (
26 protected router: Router,
27 protected route: ActivatedRoute,
28 protected notificationsService: NotificationsService,
29 protected authService: AuthService,
30 protected location: Location,
31 protected i18n: I18n,
32 protected screenService: ScreenService,
33 private videoService: VideoService
34 ) {
35 super()
36
37 this.titlePage = i18n('Local videos')
38 }
39
40 ngOnInit () {
41 super.ngOnInit()
42
43 this.generateSyndicationList()
44 }
45
46 ngOnDestroy () {
47 super.ngOnDestroy()
48 }
49
50 getVideosObservable (page: number) {
51 const newPagination = immutableAssign(this.pagination, { currentPage: page })
52
53 return this.videoService.getVideos(newPagination, this.sort, this.filter, this.categoryOneOf)
54 }
55
56 generateSyndicationList () {
57 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter, this.categoryOneOf)
58 }
59}