]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
Merge branch 'feature/design' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / video-abuses / video-abuse-list / video-abuse-list.component.ts
CommitLineData
d592e0a9 1import { Component, OnInit } from '@angular/core'
11ac88de 2
df98563e 3import { NotificationsService } from 'angular2-notifications'
3523b64a 4import { SortMeta } from 'primeng/components/common/sortmeta'
7ddd02c9 5
d592e0a9
C
6import { RestTable, RestPagination, VideoAbuseService } from '../../../shared'
7import { VideoAbuse } from '../../../../../../shared'
11ac88de
C
8
9@Component({
df98563e 10 selector: 'my-video-abuse-list',
f595d394
C
11 templateUrl: './video-abuse-list.component.html',
12 styleUrls: [ './video-abuse-list.component.scss']
11ac88de 13})
d592e0a9
C
14export class VideoAbuseListComponent extends RestTable implements OnInit {
15 videoAbuses: VideoAbuse[] = []
16 totalRecords = 0
d5050d1e 17 rowsPerPage = 10
d592e0a9
C
18 sort: SortMeta = { field: 'id', order: 1 }
19 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
11ac88de 20
df98563e 21 constructor (
7ddd02c9
C
22 private notificationsService: NotificationsService,
23 private videoAbuseService: VideoAbuseService
28798b5d 24 ) {
d592e0a9
C
25 super()
26 }
27
28 ngOnInit () {
29 this.loadData()
df98563e 30 }
11ac88de 31
d592e0a9
C
32 getRouterVideoLink (videoId: number) {
33 return [ '/videos', videoId ]
34 }
35
36 protected loadData () {
37 return this.videoAbuseService.getVideoAbuses(this.pagination, this.sort)
38 .subscribe(
39 resultList => {
40 this.videoAbuses = resultList.data
41 this.totalRecords = resultList.total
42 },
43
bfb3a98f 44 err => this.notificationsService.error('Error', err.message)
d592e0a9 45 )
11ac88de
C
46 }
47}