]>
Commit | Line | Data |
---|---|---|
28798b5d | 1 | import { Component } from '@angular/core'; |
11ac88de | 2 | |
7ddd02c9 C |
3 | import { NotificationsService } from 'angular2-notifications'; |
4 | ||
7af75da4 | 5 | import { Utils, VideoAbuseService, VideoAbuse } from '../../../shared'; |
11ac88de C |
6 | |
7 | @Component({ | |
8 | selector: 'my-video-abuse-list', | |
1f0215a9 | 9 | templateUrl: './video-abuse-list.component.html' |
11ac88de | 10 | }) |
28798b5d C |
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 | } | |
7af75da4 | 57 | }; |
11ac88de | 58 | |
7ddd02c9 C |
59 | constructor( |
60 | private notificationsService: NotificationsService, | |
61 | private videoAbuseService: VideoAbuseService | |
28798b5d C |
62 | ) { |
63 | this.videoAbusesSource = this.videoAbuseService.getDataSource(); | |
64 | } | |
11ac88de | 65 | |
28798b5d C |
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>`; | |
11ac88de C |
70 | } |
71 | } |