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