]>
Commit | Line | Data |
---|---|---|
d592e0a9 | 1 | import { Component, OnInit } from '@angular/core' |
19a3b914 | 2 | import { Account } from '@app/shared/account/account.model' |
df98563e | 3 | import { NotificationsService } from 'angular2-notifications' |
3523b64a | 4 | import { SortMeta } from 'primeng/components/common/sortmeta' |
d592e0a9 | 5 | import { VideoAbuse } from '../../../../../../shared' |
11ac88de | 6 | |
19a3b914 C |
7 | import { RestPagination, RestTable, VideoAbuseService } from '../../../shared' |
8 | ||
11ac88de | 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 |
14 | export class VideoAbuseListComponent extends RestTable implements OnInit { |
15 | videoAbuses: VideoAbuse[] = [] | |
16 | totalRecords = 0 | |
d5050d1e | 17 | rowsPerPage = 10 |
ab998f7b | 18 | sort: SortMeta = { field: 'createdAt', order: 1 } |
d592e0a9 | 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 () { | |
ab998f7b | 29 | this.loadSort() |
df98563e | 30 | } |
11ac88de | 31 | |
19a3b914 C |
32 | createByString (account: Account) { |
33 | return Account.CREATE_BY_STRING(account.name, account.host) | |
d592e0a9 C |
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 | } |