]>
Commit | Line | Data |
---|---|---|
d592e0a9 | 1 | import { Component, OnInit } from '@angular/core' |
11ac88de | 2 | |
df98563e | 3 | import { NotificationsService } from 'angular2-notifications' |
d592e0a9 | 4 | import { SortMeta } from 'primeng/primeng' |
7ddd02c9 | 5 | |
d592e0a9 C |
6 | import { RestTable, RestPagination, VideoAbuseService } from '../../../shared' |
7 | import { VideoAbuse } from '../../../../../../shared' | |
11ac88de C |
8 | |
9 | @Component({ | |
df98563e C |
10 | selector: 'my-video-abuse-list', |
11 | templateUrl: './video-abuse-list.component.html' | |
11ac88de | 12 | }) |
d592e0a9 C |
13 | export class VideoAbuseListComponent extends RestTable implements OnInit { |
14 | videoAbuses: VideoAbuse[] = [] | |
15 | totalRecords = 0 | |
d5050d1e | 16 | rowsPerPage = 10 |
d592e0a9 C |
17 | sort: SortMeta = { field: 'id', order: 1 } |
18 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | |
11ac88de | 19 | |
df98563e | 20 | constructor ( |
7ddd02c9 C |
21 | private notificationsService: NotificationsService, |
22 | private videoAbuseService: VideoAbuseService | |
28798b5d | 23 | ) { |
d592e0a9 C |
24 | super() |
25 | } | |
26 | ||
27 | ngOnInit () { | |
28 | this.loadData() | |
df98563e | 29 | } |
11ac88de | 30 | |
d592e0a9 C |
31 | getRouterVideoLink (videoId: number) { |
32 | return [ '/videos', videoId ] | |
33 | } | |
34 | ||
35 | protected loadData () { | |
36 | return this.videoAbuseService.getVideoAbuses(this.pagination, this.sort) | |
37 | .subscribe( | |
38 | resultList => { | |
39 | this.videoAbuses = resultList.data | |
40 | this.totalRecords = resultList.total | |
41 | }, | |
42 | ||
bfb3a98f | 43 | err => this.notificationsService.error('Error', err.message) |
d592e0a9 | 44 | ) |
11ac88de C |
45 | } |
46 | } |