1 import { Component, OnDestroy, OnInit } from '@angular/core'
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'
7 import { VideoSortField } from '../../shared/video/sort-field.type'
8 import { VideoService } from '../../shared/video/video.service'
9 import { VideoFilter } from '../../../../../shared/models/videos/video-query.type'
12 selector: 'my-videos-local',
13 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
14 templateUrl: '../../shared/video/abstract-video-list.html'
16 export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
17 titlePage = 'Local videos'
18 currentRoute = '/videos/local'
19 sort = '-createdAt' as VideoSortField
20 filter: VideoFilter = 'local'
22 constructor (protected router: Router,
23 protected route: ActivatedRoute,
24 protected notificationsService: NotificationsService,
25 protected authService: AuthService,
26 private videoService: VideoService) {
33 this.generateSyndicationList()
40 getVideosObservable (page: number) {
41 const newPagination = immutableAssign(this.pagination, { currentPage: page })
43 return this.videoService.getVideos(newPagination, this.sort, this.filter)
46 generateSyndicationList () {
47 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter)