]>
Commit | Line | Data |
---|---|---|
9af61e84 | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
066e94c5 C |
2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | |
4 | import { NotificationsService } from 'angular2-notifications' | |
5 | import { AuthService } from '../../core/auth' | |
6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | |
7b87d2d5 | 7 | import { VideoSortField } from '../../shared/video/sort-field.type' |
066e94c5 | 8 | import { VideoService } from '../../shared/video/video.service' |
7b87d2d5 | 9 | import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' |
066e94c5 C |
10 | |
11 | @Component({ | |
12 | selector: 'my-videos-local', | |
13 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | |
14 | templateUrl: '../../shared/video/abstract-video-list.html' | |
15 | }) | |
9af61e84 | 16 | export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { |
066e94c5 C |
17 | titlePage = 'Local videos' |
18 | currentRoute = '/videos/local' | |
7b87d2d5 C |
19 | sort = '-createdAt' as VideoSortField |
20 | filter: VideoFilter = 'local' | |
066e94c5 C |
21 | |
22 | constructor (protected router: Router, | |
23 | protected route: ActivatedRoute, | |
24 | protected notificationsService: NotificationsService, | |
25 | protected authService: AuthService, | |
26 | private videoService: VideoService) { | |
27 | super() | |
28 | } | |
29 | ||
30 | ngOnInit () { | |
31 | super.ngOnInit() | |
cc1561f9 | 32 | |
244e76a5 | 33 | this.generateSyndicationList() |
066e94c5 C |
34 | } |
35 | ||
9af61e84 C |
36 | ngOnDestroy () { |
37 | super.ngOnDestroy() | |
38 | } | |
39 | ||
066e94c5 C |
40 | getVideosObservable (page: number) { |
41 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | |
42 | ||
7b87d2d5 | 43 | return this.videoService.getVideos(newPagination, this.sort, this.filter) |
066e94c5 | 44 | } |
244e76a5 RK |
45 | |
46 | generateSyndicationList () { | |
7b87d2d5 | 47 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter) |
244e76a5 | 48 | } |
066e94c5 | 49 | } |