1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { Location } from '@angular/common'
4 import { immutableAssign } from '@app/shared/misc/utils'
5 import { NotificationsService } from 'angular2-notifications'
6 import { AuthService } from '../../core/auth'
7 import { ConfirmService } from '../../core/confirm'
8 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
9 import { VideoService } from '../../shared/video/video.service'
10 import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
11 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
14 selector: 'my-video-channel-videos',
15 templateUrl: '../../shared/video/abstract-video-list.html',
17 '../../shared/video/abstract-video-list.scss',
18 './video-channel-videos.component.scss'
21 export class VideoChannelVideosComponent extends AbstractVideoList implements OnInit, OnDestroy {
22 titlePage = 'Published videos'
23 marginContent = false // Disable margin
24 currentRoute = '/video-channel/videos'
27 private videoChannel: VideoChannel
30 protected router: Router,
31 protected route: ActivatedRoute,
32 protected authService: AuthService,
33 protected notificationsService: NotificationsService,
34 protected confirmService: ConfirmService,
35 protected location: Location,
36 private videoChannelService: VideoChannelService,
37 private videoService: VideoService
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'
51 this.loadMoreVideos(this.pagination.currentPage)
52 this.generateSyndicationList()
60 getVideosObservable (page: number) {
61 const newPagination = immutableAssign(this.pagination, { currentPage: page })
63 return this.videoService.getVideoChannelVideos(this.videoChannel, newPagination, this.sort)
66 generateSyndicationList () {
67 this.syndicationItems = this.videoService.getVideoChannelFeedUrls(this.videoChannel.id)