]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/video-list/video-recently-added.component.ts
Store webtorrent chunks in indexdb
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-recently-added.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'
202f6b6c 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-recently-added',
202f6b6c
C
13 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
14 templateUrl: '../../shared/video/abstract-video-list.html'
9bf9d2a5 15})
9af61e84 16export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
9bf9d2a5 17 titlePage = 'Recently added'
2bbb3412 18 currentRoute = '/videos/recently-added'
7b87d2d5 19 sort: VideoSortField = '-createdAt'
9bf9d2a5
C
20
21 constructor (protected router: Router,
22 protected route: ActivatedRoute,
2a2c19df 23 protected location: Location,
9bf9d2a5 24 protected notificationsService: NotificationsService,
b2731bff 25 protected authService: AuthService,
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
43 return this.videoService.getVideos(newPagination, this.sort)
9bf9d2a5 44 }
244e76a5
RK
45
46 generateSyndicationList () {
7b87d2d5 47 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort)
244e76a5 48 }
9bf9d2a5 49}