import { Component, OnInit } from '@angular/core'
import { SortMeta } from 'primeng/components/common/sortmeta'
-import { NotificationsService } from 'angular2-notifications'
+import { Notifier } from '@app/core'
import { ConfirmService } from '../../../core'
import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared'
import { VideoBlacklist } from '../../../../../../shared'
import { I18n } from '@ngx-translate/i18n-polyfill'
import { DropdownAction } from '../../../shared/buttons/action-dropdown.component'
import { Video } from '../../../shared/video/video.model'
+import { MarkdownService } from '@app/shared/renderer'
@Component({
selector: 'my-video-blacklist-list',
videoBlacklistActions: DropdownAction<VideoBlacklist>[] = []
constructor (
- private notificationsService: NotificationsService,
+ private notifier: Notifier,
private confirmService: ConfirmService,
private videoBlacklistService: VideoBlacklistService,
+ private markdownRenderer: MarkdownService,
private i18n: I18n
) {
super()
}
ngOnInit () {
- this.loadSort()
+ this.initialize()
}
getVideoUrl (videoBlacklist: VideoBlacklist) {
return Video.buildClientUrl(videoBlacklist.video.uuid)
}
+ booleanToText (value: boolean) {
+ if (value === true) return this.i18n('yes')
+
+ return this.i18n('no')
+ }
+
+ toHtml (text: string) {
+ return this.markdownRenderer.textMarkdownToHTML(text)
+ }
+
async removeVideoFromBlacklist (entry: VideoBlacklist) {
const confirmMessage = this.i18n(
'Do you really want to remove this video from the blacklist? It will be available again in the videos list.'
this.videoBlacklistService.removeVideoFromBlacklist(entry.video.id).subscribe(
() => {
- this.notificationsService.success(
- this.i18n('Success'),
- this.i18n('Video {{name}} removed from the blacklist.', { name: entry.video.name })
- )
+ this.notifier.success(this.i18n('Video {{name}} removed from the blacklist.', { name: entry.video.name }))
this.loadData()
},
- err => this.notificationsService.error(this.i18n('Error'), err.message)
+ err => this.notifier.error(err.message)
)
}
this.totalRecords = resultList.total
},
- err => this.notificationsService.error(this.i18n('Error'), err.message)
+ err => this.notifier.error(err.message)
)
}
}