]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
Client: little refractoring
[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 })
11 export class VideoAbuseListComponent {
12 videoAbusesSource = null;
13 tableSettings = {
14 mode: 'external',
15 attr: {
16 class: 'table-hover'
17 },
18 hideSubHeader: true,
19 actions: {
20 position: 'right',
21 add: false,
22 edit: false,
23 delete: false
24 },
25 pager: {
26 display: true,
27 perPage: 10
28 },
29 columns: {
30 id: {
31 title: 'ID',
32 sortDirection: 'asc'
33 },
34 reason: {
35 title: 'Reason',
36 sort: false
37 },
38 reporterPodHost: {
39 title: 'Reporter pod host',
40 sort: false
41 },
42 reporterUsername: {
43 title: 'Reporter username',
44 sort: false
45 },
46 videoId: {
47 title: 'Video',
48 type: 'html',
49 sort: false,
50 valuePrepareFunction: this.buildVideoLink
51 },
52 createdAt: {
53 title: 'Created Date',
54 valuePrepareFunction: Utils.dateToHuman
55 }
56 }
57 };
58
59 constructor(
60 private notificationsService: NotificationsService,
61 private videoAbuseService: VideoAbuseService
62 ) {
63 this.videoAbusesSource = this.videoAbuseService.getDataSource();
64 }
65
66 buildVideoLink(videoId: string) {
67 // TODO: transform to routerLink
68 // https://github.com/akveo/ng2-smart-table/issues/57
69 return `<a href="/videos/${videoId}" title="Go to the video">${videoId}</a>`;
70 }
71 }