diff options
Diffstat (limited to 'client/src/app/+video-channels/video-channel-playlists')
-rw-r--r-- | client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.ts | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.ts b/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.ts index 14465bb8d..82af65026 100644 --- a/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.ts +++ b/client/src/app/+video-channels/video-channel-playlists/video-channel-playlists.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Subject, Subscription } from 'rxjs' | 1 | import { Subject, Subscription } from 'rxjs' |
2 | import { Component, OnDestroy, OnInit } from '@angular/core' | 2 | import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core' |
3 | import { ComponentPagination, hasMoreItems, ScreenService } from '@app/core' | 3 | import { ComponentPagination, hasMoreItems, HooksService, ScreenService } from '@app/core' |
4 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' | 4 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' |
5 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 5 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
6 | 6 | ||
@@ -9,7 +9,7 @@ import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-pl | |||
9 | templateUrl: './video-channel-playlists.component.html', | 9 | templateUrl: './video-channel-playlists.component.html', |
10 | styleUrls: [ './video-channel-playlists.component.scss' ] | 10 | styleUrls: [ './video-channel-playlists.component.scss' ] |
11 | }) | 11 | }) |
12 | export class VideoChannelPlaylistsComponent implements OnInit, OnDestroy { | 12 | export class VideoChannelPlaylistsComponent implements OnInit, AfterViewInit, OnDestroy { |
13 | videoPlaylists: VideoPlaylist[] = [] | 13 | videoPlaylists: VideoPlaylist[] = [] |
14 | 14 | ||
15 | pagination: ComponentPagination = { | 15 | pagination: ComponentPagination = { |
@@ -26,16 +26,24 @@ export class VideoChannelPlaylistsComponent implements OnInit, OnDestroy { | |||
26 | constructor ( | 26 | constructor ( |
27 | private videoPlaylistService: VideoPlaylistService, | 27 | private videoPlaylistService: VideoPlaylistService, |
28 | private videoChannelService: VideoChannelService, | 28 | private videoChannelService: VideoChannelService, |
29 | private screenService: ScreenService | 29 | private screenService: ScreenService, |
30 | private hooks: HooksService | ||
30 | ) {} | 31 | ) {} |
31 | 32 | ||
32 | ngOnInit () { | 33 | ngOnInit () { |
33 | // Parent get the video channel for us | 34 | // Parent get the video channel for us |
34 | this.videoChannelSub = this.videoChannelService.videoChannelLoaded | 35 | this.videoChannelSub = this.videoChannelService.videoChannelLoaded |
35 | .subscribe(videoChannel => { | 36 | .subscribe(videoChannel => { |
36 | this.videoChannel = videoChannel | 37 | this.videoChannel = videoChannel |
37 | this.loadVideoPlaylists() | 38 | |
38 | }) | 39 | this.hooks.runAction('action:video-channel-playlists.video-channel.loaded', 'video-channel', { videoChannel }) |
40 | |||
41 | this.loadVideoPlaylists() | ||
42 | }) | ||
43 | } | ||
44 | |||
45 | ngAfterViewInit () { | ||
46 | this.hooks.runAction('action:video-channel-playlists.init', 'video-channel') | ||
39 | } | 47 | } |
40 | 48 | ||
41 | ngOnDestroy () { | 49 | ngOnDestroy () { |
@@ -55,11 +63,13 @@ export class VideoChannelPlaylistsComponent implements OnInit, OnDestroy { | |||
55 | 63 | ||
56 | private loadVideoPlaylists () { | 64 | private loadVideoPlaylists () { |
57 | this.videoPlaylistService.listChannelPlaylists(this.videoChannel, this.pagination) | 65 | this.videoPlaylistService.listChannelPlaylists(this.videoChannel, this.pagination) |
58 | .subscribe(res => { | 66 | .subscribe(res => { |
59 | this.videoPlaylists = this.videoPlaylists.concat(res.data) | 67 | this.videoPlaylists = this.videoPlaylists.concat(res.data) |
60 | this.pagination.totalItems = res.total | 68 | this.pagination.totalItems = res.total |
69 | |||
70 | this.hooks.runAction('action:video-channel-playlists.playlists.loaded', 'video-channel', { playlists: this.videoPlaylists }) | ||
61 | 71 | ||
62 | this.onDataSubject.next(res.data) | 72 | this.onDataSubject.next(res.data) |
63 | }) | 73 | }) |
64 | } | 74 | } |
65 | } | 75 | } |