]>
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' | |
244e76a5 | 6 | import { PopoverModule } from 'ngx-bootstrap/popover' |
066e94c5 C |
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' | |
244e76a5 RK |
10 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' |
11 | import * as url from 'url' | |
066e94c5 C |
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 | }) | |
9af61e84 | 18 | export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { |
066e94c5 C |
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() | |
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 | ||
43 | return this.videoService.getVideos(newPagination, this.sort, 'local') | |
44 | } | |
244e76a5 RK |
45 | |
46 | generateSyndicationList () { | |
47 | const feeds = this.videoService.getFeed('local') | |
48 | this.syndicationItems['rss 2.0'] = feeds[FeedFormat.RSS] | |
49 | this.syndicationItems['atom 1.0'] = feeds[FeedFormat.ATOM] | |
50 | this.syndicationItems['json 1.0'] = feeds[FeedFormat.JSON] | |
51 | } | |
066e94c5 | 52 | } |