]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+admin/follows/followers-list/followers-list.component.ts
Fix followers search
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / follows / followers-list / followers-list.component.ts
1 import { Component, OnInit } from '@angular/core'
2
3 import { NotificationsService } from 'angular2-notifications'
4 import { SortMeta } from 'primeng/primeng'
5 import { ActorFollow } from '../../../../../../shared/models/actors/follow.model'
6 import { RestPagination, RestTable } from '../../../shared'
7 import { FollowService } from '../shared'
8 import { I18n } from '@ngx-translate/i18n-polyfill'
9
10 @Component({
11 selector: 'my-followers-list',
12 templateUrl: './followers-list.component.html',
13 styleUrls: [ './followers-list.component.scss' ]
14 })
15 export class FollowersListComponent extends RestTable implements OnInit {
16 followers: ActorFollow[] = []
17 totalRecords = 0
18 rowsPerPage = 10
19 sort: SortMeta = { field: 'createdAt', order: 1 }
20 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
21
22 constructor (
23 private notificationsService: NotificationsService,
24 private followService: FollowService,
25 private i18n: I18n
26 ) {
27 super()
28 }
29
30 ngOnInit () {
31 this.initialize()
32 }
33
34 protected loadData () {
35 this.followService.getFollowers(this.pagination, this.sort, this.search)
36 .subscribe(
37 resultList => {
38 this.followers = resultList.data
39 this.totalRecords = resultList.total
40 },
41
42 err => this.notificationsService.error(this.i18n('Error'), err.message)
43 )
44 }
45 }