2018-02-23 14:36:16 +01:00
|
|
|
import { Component, OnInit } from '@angular/core'
|
2017-11-15 10:10:41 +01:00
|
|
|
|
|
|
|
import { NotificationsService } from 'angular2-notifications'
|
|
|
|
import { SortMeta } from 'primeng/primeng'
|
2018-09-11 16:27:07 +02:00
|
|
|
import { ActorFollow } from '../../../../../../shared/models/actors/follow.model'
|
2017-11-15 11:00:25 +01:00
|
|
|
import { RestPagination, RestTable } from '../../../shared'
|
2017-11-15 10:10:41 +01:00
|
|
|
import { FollowService } from '../shared'
|
2018-06-04 16:21:17 +02:00
|
|
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
2017-11-15 10:10:41 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'my-followers-list',
|
|
|
|
templateUrl: './followers-list.component.html',
|
|
|
|
styleUrls: [ './followers-list.component.scss' ]
|
|
|
|
})
|
2018-02-23 14:36:16 +01:00
|
|
|
export class FollowersListComponent extends RestTable implements OnInit {
|
2018-09-11 16:27:07 +02:00
|
|
|
followers: ActorFollow[] = []
|
2017-11-15 10:10:41 +01:00
|
|
|
totalRecords = 0
|
|
|
|
rowsPerPage = 10
|
|
|
|
sort: SortMeta = { field: 'createdAt', order: 1 }
|
|
|
|
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
|
|
|
|
|
|
|
|
constructor (
|
|
|
|
private notificationsService: NotificationsService,
|
2018-06-04 16:21:17 +02:00
|
|
|
private followService: FollowService,
|
|
|
|
private i18n: I18n
|
2017-11-15 10:10:41 +01:00
|
|
|
) {
|
|
|
|
super()
|
|
|
|
}
|
|
|
|
|
2018-02-23 14:36:16 +01:00
|
|
|
ngOnInit () {
|
2018-10-08 15:51:38 +02:00
|
|
|
this.initialize()
|
2018-02-23 14:36:16 +01:00
|
|
|
}
|
|
|
|
|
2017-11-15 10:10:41 +01:00
|
|
|
protected loadData () {
|
|
|
|
this.followService.getFollowers(this.pagination, this.sort)
|
|
|
|
.subscribe(
|
|
|
|
resultList => {
|
|
|
|
this.followers = resultList.data
|
|
|
|
this.totalRecords = resultList.total
|
|
|
|
},
|
|
|
|
|
2018-06-04 16:21:17 +02:00
|
|
|
err => this.notificationsService.error(this.i18n('Error'), err.message)
|
2017-11-15 10:10:41 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|