]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-trending.component.ts
(docker) making security settings of traefik on par with nginx
[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'
9bf9d2a5
C
10
11@Component({
12 selector: 'my-videos-trending',
202f6b6c
C
13 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
14 templateUrl: '../../shared/video/abstract-video-list.html'
9bf9d2a5 15})
9af61e84 16export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy {
9bf9d2a5 17 titlePage = 'Trending'
2bbb3412 18 currentRoute = '/videos/trending'
7b87d2d5 19 defaultSort: VideoSortField = '-views'
9bf9d2a5
C
20
21 constructor (protected router: Router,
22 protected route: ActivatedRoute,
23 protected notificationsService: NotificationsService,
b2731bff 24 protected authService: AuthService,
2a2c19df 25 protected location: Location,
9bf9d2a5
C
26 private videoService: VideoService) {
27 super()
28 }
29
30 ngOnInit () {
31 super.ngOnInit()
cc1561f9 32
244e76a5 33 this.generateSyndicationList()
9bf9d2a5
C
34 }
35
9af61e84
C
36 ngOnDestroy () {
37 super.ngOnDestroy()
38 }
39
0cd4344f
C
40 getVideosObservable (page: number) {
41 const newPagination = immutableAssign(this.pagination, { currentPage: page })
42 return this.videoService.getVideos(newPagination, this.sort)
9bf9d2a5 43 }
244e76a5
RK
44
45 generateSyndicationList () {
7b87d2d5 46 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort)
244e76a5 47 }
9bf9d2a5 48}