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