]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-local.component.ts
Add ability for uploaders to schedule video update
[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'
2a2c19df 4import { Location } from '@angular/common'
066e94c5
C
5import { NotificationsService } from 'angular2-notifications'
6import { AuthService } from '../../core/auth'
7import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7b87d2d5 8import { VideoSortField } from '../../shared/video/sort-field.type'
066e94c5 9import { VideoService } from '../../shared/video/video.service'
7b87d2d5 10import { VideoFilter } from '../../../../../shared/models/videos/video-query.type'
989e526a 11import { I18n } from '@ngx-translate/i18n-polyfill'
066e94c5
C
12
13@Component({
14 selector: 'my-videos-local',
15 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
16 templateUrl: '../../shared/video/abstract-video-list.html'
17})
9af61e84 18export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
989e526a 19 titlePage: string
066e94c5 20 currentRoute = '/videos/local'
136cce4d 21 sort = '-publishedAt' as VideoSortField
7b87d2d5 22 filter: VideoFilter = 'local'
066e94c5 23
989e526a
C
24 constructor (
25 protected router: Router,
26 protected route: ActivatedRoute,
27 protected notificationsService: NotificationsService,
28 protected authService: AuthService,
29 protected location: Location,
b1d40cff
C
30 protected i18n: I18n,
31 private videoService: VideoService
989e526a 32 ) {
066e94c5 33 super()
989e526a
C
34
35 this.titlePage = i18n('Local videos')
066e94c5
C
36 }
37
38 ngOnInit () {
39 super.ngOnInit()
cc1561f9 40
244e76a5 41 this.generateSyndicationList()
066e94c5
C
42 }
43
9af61e84
C
44 ngOnDestroy () {
45 super.ngOnDestroy()
46 }
47
066e94c5
C
48 getVideosObservable (page: number) {
49 const newPagination = immutableAssign(this.pagination, { currentPage: page })
50
7b87d2d5 51 return this.videoService.getVideos(newPagination, this.sort, this.filter)
066e94c5 52 }
244e76a5
RK
53
54 generateSyndicationList () {
7b87d2d5 55 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter)
244e76a5 56 }
066e94c5 57}