]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/videos/video-list/video-local.component.ts
90eb96afeb00ca1170cf5c019faf11736d8f351b
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-list / video-local.component.ts
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 { PopoverModule } from 'ngx-bootstrap/popover'
7 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
8 import { SortField } from '../../shared/video/sort-field.type'
9 import { VideoService } from '../../shared/video/video.service'
10 import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
11 import * as url from 'url'
12
13 @Component({
14 selector: 'my-videos-local',
15 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
16 templateUrl: '../../shared/video/abstract-video-list.html'
17 })
18 export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
19 titlePage = 'Local videos'
20 currentRoute = '/videos/local'
21 sort = '-createdAt' as SortField
22
23 constructor (protected router: Router,
24 protected route: ActivatedRoute,
25 protected notificationsService: NotificationsService,
26 protected authService: AuthService,
27 private videoService: VideoService) {
28 super()
29 }
30
31 ngOnInit () {
32 super.ngOnInit()
33
34 this.generateSyndicationList()
35 }
36
37 ngOnDestroy () {
38 super.ngOnDestroy()
39 }
40
41 getVideosObservable (page: number) {
42 const newPagination = immutableAssign(this.pagination, { currentPage: page })
43
44 return this.videoService.getVideos(newPagination, this.sort, 'local')
45 }
46
47 generateSyndicationList () {
48 this.syndicationItems = this.videoService.getVideoFeedUrls('local')
49 }
50 }