]>
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' | |
2a2c19df | 4 | import { Location } from '@angular/common' |
066e94c5 C |
5 | import { NotificationsService } from 'angular2-notifications' |
6 | import { AuthService } from '../../core/auth' | |
7 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | |
7b87d2d5 | 8 | import { VideoSortField } from '../../shared/video/sort-field.type' |
066e94c5 | 9 | import { VideoService } from '../../shared/video/video.service' |
7b87d2d5 | 10 | import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' |
989e526a | 11 | import { I18n } from '@ngx-translate/i18n-polyfill' |
bbe0f064 | 12 | import { ScreenService } from '@app/shared/misc/screen.service' |
066e94c5 C |
13 | |
14 | @Component({ | |
15 | selector: 'my-videos-local', | |
16 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | |
17 | templateUrl: '../../shared/video/abstract-video-list.html' | |
18 | }) | |
9af61e84 | 19 | export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { |
989e526a | 20 | titlePage: string |
066e94c5 | 21 | currentRoute = '/videos/local' |
136cce4d | 22 | sort = '-publishedAt' as VideoSortField |
7b87d2d5 | 23 | filter: VideoFilter = 'local' |
066e94c5 | 24 | |
989e526a C |
25 | constructor ( |
26 | protected router: Router, | |
27 | protected route: ActivatedRoute, | |
28 | protected notificationsService: NotificationsService, | |
29 | protected authService: AuthService, | |
30 | protected location: Location, | |
b1d40cff | 31 | protected i18n: I18n, |
bbe0f064 | 32 | protected screenService: ScreenService, |
b1d40cff | 33 | private videoService: VideoService |
989e526a | 34 | ) { |
066e94c5 | 35 | super() |
989e526a C |
36 | |
37 | this.titlePage = i18n('Local videos') | |
066e94c5 C |
38 | } |
39 | ||
40 | ngOnInit () { | |
41 | super.ngOnInit() | |
cc1561f9 | 42 | |
244e76a5 | 43 | this.generateSyndicationList() |
066e94c5 C |
44 | } |
45 | ||
9af61e84 C |
46 | ngOnDestroy () { |
47 | super.ngOnDestroy() | |
48 | } | |
49 | ||
066e94c5 C |
50 | getVideosObservable (page: number) { |
51 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | |
52 | ||
d59cba29 | 53 | return this.videoService.getVideos(newPagination, this.sort, this.filter, this.categoryOneOf) |
066e94c5 | 54 | } |
244e76a5 RK |
55 | |
56 | generateSyndicationList () { | |
d59cba29 | 57 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter, this.categoryOneOf) |
244e76a5 | 58 | } |
066e94c5 | 59 | } |