import { Component, OnInit } from '@angular/core'
-import { SortMeta } from 'primeng/components/common/sortmeta'
+import { SortMeta } from 'primeng/api'
import { Notifier, ServerService } from '@app/core'
import { ConfirmService } from '../../../core'
import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared'
export class VideoBlacklistListComponent extends RestTable implements OnInit {
blacklist: (VideoBlacklist & { reasonHtml?: string })[] = []
totalRecords = 0
- rowsPerPage = 10
- sort: SortMeta = { field: 'createdAt', order: 1 }
+ sort: SortMeta = { field: 'createdAt', order: -1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
listBlacklistTypeFilter: VideoBlacklistType = undefined
private i18n: I18n
) {
super()
+ }
- // don't filter if auto-blacklist not enabled as this will be only list
- if (this.serverService.getConfig().autoBlacklist.videos.ofUsers.enabled) {
- this.listBlacklistTypeFilter = VideoBlacklistType.MANUAL
- }
+ ngOnInit () {
+ this.serverService.getConfig()
+ .subscribe(config => {
+ // don't filter if auto-blacklist is not enabled as this will be the only list
+ if (config.autoBlacklist.videos.ofUsers.enabled) {
+ this.listBlacklistTypeFilter = VideoBlacklistType.MANUAL
+ }
+ })
+
+ this.initialize()
this.videoBlacklistActions = [
{
]
}
- ngOnInit () {
- this.initialize()
+ getIdentifier () {
+ return 'VideoBlacklistListComponent'
}
getVideoUrl (videoBlacklist: VideoBlacklist) {
}
protected loadData () {
- this.videoBlacklistService.listBlacklist(this.pagination, this.sort, this.listBlacklistTypeFilter)
+ this.videoBlacklistService.listBlacklist({
+ pagination: this.pagination,
+ sort: this.sort,
+ search: this.search,
+ type: this.listBlacklistTypeFilter
+ })
.subscribe(
async resultList => {
this.totalRecords = resultList.total