aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts')
-rw-r--r--client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts18
1 files changed, 14 insertions, 4 deletions
diff --git a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts
index 143ec8406..00b0ac57e 100644
--- a/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts
+++ b/client/src/app/+admin/video-blacklist/video-blacklist-list/video-blacklist-list.component.ts
@@ -5,11 +5,12 @@ import { ConfirmService } from '../../../core'
5import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared' 5import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared'
6import { BlacklistedVideo } from '../../../../../../shared' 6import { BlacklistedVideo } from '../../../../../../shared'
7import { I18n } from '@ngx-translate/i18n-polyfill' 7import { I18n } from '@ngx-translate/i18n-polyfill'
8import { DropdownAction } from '@app/shared/buttons/action-dropdown.component'
8 9
9@Component({ 10@Component({
10 selector: 'my-video-blacklist-list', 11 selector: 'my-video-blacklist-list',
11 templateUrl: './video-blacklist-list.component.html', 12 templateUrl: './video-blacklist-list.component.html',
12 styleUrls: [] 13 styleUrls: [ './video-blacklist-list.component.scss' ]
13}) 14})
14export class VideoBlacklistListComponent extends RestTable implements OnInit { 15export class VideoBlacklistListComponent extends RestTable implements OnInit {
15 blacklist: BlacklistedVideo[] = [] 16 blacklist: BlacklistedVideo[] = []
@@ -18,6 +19,8 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit {
18 sort: SortMeta = { field: 'createdAt', order: 1 } 19 sort: SortMeta = { field: 'createdAt', order: 1 }
19 pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 20 pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
20 21
22 videoBlacklistActions: DropdownAction<BlacklistedVideo>[] = []
23
21 constructor ( 24 constructor (
22 private notificationsService: NotificationsService, 25 private notificationsService: NotificationsService,
23 private confirmService: ConfirmService, 26 private confirmService: ConfirmService,
@@ -25,6 +28,13 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit {
25 private i18n: I18n 28 private i18n: I18n
26 ) { 29 ) {
27 super() 30 super()
31
32 this.videoBlacklistActions = [
33 {
34 label: this.i18n('Unblacklist'),
35 handler: videoBlacklist => this.removeVideoFromBlacklist(videoBlacklist)
36 }
37 ]
28 } 38 }
29 39
30 ngOnInit () { 40 ngOnInit () {
@@ -33,17 +43,17 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit {
33 43
34 async removeVideoFromBlacklist (entry: BlacklistedVideo) { 44 async removeVideoFromBlacklist (entry: BlacklistedVideo) {
35 const confirmMessage = this.i18n( 45 const confirmMessage = this.i18n(
36 'Do you really want to remove this video from the blacklist ? It will be available again in the videos list.' 46 'Do you really want to remove this video from the blacklist? It will be available again in the videos list.'
37 ) 47 )
38 48
39 const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblacklist')) 49 const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblacklist'))
40 if (res === false) return 50 if (res === false) return
41 51
42 this.videoBlacklistService.removeVideoFromBlacklist(entry.videoId).subscribe( 52 this.videoBlacklistService.removeVideoFromBlacklist(entry.video.id).subscribe(
43 () => { 53 () => {
44 this.notificationsService.success( 54 this.notificationsService.success(
45 this.i18n('Success'), 55 this.i18n('Success'),
46 this.i18n('Video {{name}} removed from the blacklist.', { name: entry.name }) 56 this.i18n('Video {{name}} removed from the blacklist.', { name: entry.video.name })
47 ) 57 )
48 this.loadData() 58 this.loadData()
49 }, 59 },