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 'rxjs/add/observable/from'
7 import 'rxjs/add/operator/concatAll'
8 import { AuthService } from '../../core/auth'
9 import { ConfirmService } from '../../core/confirm'
10 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
11 import { VideoService } from '../../shared/video/video.service'
12 import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
13 import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
16 selector: 'my-video-channel-videos',
17 templateUrl: '../../shared/video/abstract-video-list.html',
19 '../../shared/video/abstract-video-list.scss',
20 './video-channel-videos.component.scss'
23 export class VideoChannelVideosComponent extends AbstractVideoList implements OnInit, OnDestroy {
24 titlePage = 'Published videos'
25 marginContent = false // Disable margin
26 currentRoute = '/video-channel/videos'
29 private videoChannel: VideoChannel
32 protected router: Router,
33 protected route: ActivatedRoute,
34 protected authService: AuthService,
35 protected notificationsService: NotificationsService,
36 protected confirmService: ConfirmService,
37 protected location: Location,
38 private videoChannelService: VideoChannelService,
39 private videoService: VideoService
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'
53 this.loadMoreVideos(this.pagination.currentPage)
54 this.generateSyndicationList()
62 getVideosObservable (page: number) {
63 const newPagination = immutableAssign(this.pagination, { currentPage: page })
65 return this.videoService.getVideoChannelVideos(this.videoChannel, newPagination, this.sort)
68 generateSyndicationList () {
69 this.syndicationItems = this.videoService.getVideoChannelFeedUrls(this.videoChannel.id)