aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts')
-rw-r--r--client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts75
1 files changed, 56 insertions, 19 deletions
diff --git a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
index cfd9151b0..2f22a4ab0 100644
--- a/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
+++ b/client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
@@ -1,35 +1,72 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component } from '@angular/core';
2 2
3import { NotificationsService } from 'angular2-notifications'; 3import { NotificationsService } from 'angular2-notifications';
4 4
5import { VideoAbuseService, VideoAbuse} from '../../../shared'; 5import { Utils, VideoAbuseService, VideoAbuse} from '../../../shared';
6 6
7@Component({ 7@Component({
8 selector: 'my-video-abuse-list', 8 selector: 'my-video-abuse-list',
9 templateUrl: './video-abuse-list.component.html', 9 templateUrl: './video-abuse-list.component.html',
10 styleUrls: [ './video-abuse-list.component.scss' ] 10 styleUrls: [ './video-abuse-list.component.scss' ]
11}) 11})
12export class VideoAbuseListComponent implements OnInit { 12export class VideoAbuseListComponent {
13 videoAbuses: VideoAbuse[]; 13 videoAbusesSource = null;
14 tableSettings = {
15 mode: 'external',
16 attr: {
17 class: 'table-hover'
18 },
19 hideSubHeader: true,
20 actions: {
21 position: 'right',
22 add: false,
23 edit: false,
24 delete: false
25 },
26 pager: {
27 display: true,
28 perPage: 10
29 },
30 columns: {
31 id: {
32 title: 'ID',
33 sortDirection: 'asc'
34 },
35 reason: {
36 title: 'Reason',
37 sort: false
38 },
39 reporterPodHost: {
40 title: 'Reporter pod host',
41 sort: false
42 },
43 reporterUsername: {
44 title: 'Reporter username',
45 sort: false
46 },
47 videoId: {
48 title: 'Video',
49 type: 'html',
50 sort: false,
51 valuePrepareFunction: this.buildVideoLink
52 },
53 createdAt: {
54 title: 'Created Date',
55 valuePrepareFunction: Utils.dateToHuman
56 }
57 }
58 }
14 59
15 constructor( 60 constructor(
16 private notificationsService: NotificationsService, 61 private notificationsService: NotificationsService,
17 private videoAbuseService: VideoAbuseService 62 private videoAbuseService: VideoAbuseService
18 ) { } 63 ) {
19 64 this.videoAbusesSource = this.videoAbuseService.getDataSource();
20 ngOnInit() { 65 }
21 this.getVideoAbuses();
22 }
23
24 buildVideoLink(videoAbuse: VideoAbuse) {
25 return `/videos/${videoAbuse.videoId}`;
26 }
27
28 private getVideoAbuses() {
29 this.videoAbuseService.getVideoAbuses().subscribe(
30 res => this.videoAbuses = res.videoAbuses,
31 66
32 err => this.notificationsService.error('Error', err.text) 67 buildVideoLink(videoId: string) {
33 ); 68 // TODO: transform to routerLink
69 // https://github.com/akveo/ng2-smart-table/issues/57
70 return `<a href="/videos/${videoId}" title="Go to the video">${videoId}</a>`;
34 } 71 }
35} 72}