]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts
Add context menu to player
[github/Chocobozzz/PeerTube.git] / client / src / app / +video-channels / video-channel-videos / video-channel-videos.component.ts
CommitLineData
0626e7af
C
1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router'
3import { Location } from '@angular/common'
4import { immutableAssign } from '@app/shared/misc/utils'
5import { NotificationsService } from 'angular2-notifications'
0626e7af
C
6import { AuthService } from '../../core/auth'
7import { ConfirmService } from '../../core/confirm'
8import { AbstractVideoList } from '../../shared/video/abstract-video-list'
9import { VideoService } from '../../shared/video/video.service'
170726f5
C
10import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
11import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
0626e7af
C
12
13@Component({
170726f5 14 selector: 'my-video-channel-videos',
0626e7af
C
15 templateUrl: '../../shared/video/abstract-video-list.html',
16 styleUrls: [
17 '../../shared/video/abstract-video-list.scss',
170726f5 18 './video-channel-videos.component.scss'
0626e7af
C
19 ]
20})
170726f5 21export class VideoChannelVideosComponent extends AbstractVideoList implements OnInit, OnDestroy {
0626e7af
C
22 titlePage = 'Published videos'
23 marginContent = false // Disable margin
170726f5 24 currentRoute = '/video-channel/videos'
0626e7af
C
25 loadOnInit = false
26
170726f5 27 private videoChannel: VideoChannel
0626e7af
C
28
29 constructor (
30 protected router: Router,
31 protected route: ActivatedRoute,
32 protected authService: AuthService,
33 protected notificationsService: NotificationsService,
34 protected confirmService: ConfirmService,
35 protected location: Location,
170726f5 36 private videoChannelService: VideoChannelService,
0626e7af
C
37 private videoService: VideoService
38 ) {
39 super()
40 }
41
42 ngOnInit () {
43 super.ngOnInit()
44
170726f5
C
45 // Parent get the video channel for us
46 this.videoChannelService.videoChannelLoaded
47 .subscribe(videoChannel => {
48 this.videoChannel = videoChannel
49 this.currentRoute = '/video-channel/' + this.videoChannel.uuid + '/videos'
0626e7af
C
50
51 this.loadMoreVideos(this.pagination.currentPage)
52 this.generateSyndicationList()
53 })
54 }
55
56 ngOnDestroy () {
57 super.ngOnDestroy()
58 }
59
60 getVideosObservable (page: number) {
61 const newPagination = immutableAssign(this.pagination, { currentPage: page })
62
170726f5 63 return this.videoService.getVideoChannelVideos(this.videoChannel, newPagination, this.sort)
0626e7af
C
64 }
65
66 generateSyndicationList () {
170726f5 67 this.syndicationItems = this.videoService.getVideoChannelFeedUrls(this.videoChannel.id)
0626e7af
C
68 }
69}