]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
2f22a4ab07998c2df85ea7d4ae929a5f3c6c48e1
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / video-abuses / video-abuse-list / video-abuse-list.component.ts
1 import { Component } from '@angular/core';
2
3 import { NotificationsService } from 'angular2-notifications';
4
5 import { Utils, VideoAbuseService, VideoAbuse} from '../../../shared';
6
7 @Component({
8 selector: 'my-video-abuse-list',
9 templateUrl: './video-abuse-list.component.html',
10 styleUrls: [ './video-abuse-list.component.scss' ]
11 })
12 export class VideoAbuseListComponent {
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 }
59
60 constructor(
61 private notificationsService: NotificationsService,
62 private videoAbuseService: VideoAbuseService
63 ) {
64 this.videoAbusesSource = this.videoAbuseService.getDataSource();
65 }
66
67 buildVideoLink(videoId: string) {
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>`;
71 }
72 }