]>
Commit | Line | Data |
---|---|---|
df98563e | 1 | import { Component } from '@angular/core' |
11ac88de | 2 | |
df98563e | 3 | import { NotificationsService } from 'angular2-notifications' |
7ddd02c9 | 4 | |
df98563e | 5 | import { Utils, VideoAbuseService, VideoAbuse } from '../../../shared' |
11ac88de C |
6 | |
7 | @Component({ | |
df98563e C |
8 | selector: 'my-video-abuse-list', |
9 | templateUrl: './video-abuse-list.component.html' | |
11ac88de | 10 | }) |
28798b5d | 11 | export class VideoAbuseListComponent { |
df98563e | 12 | videoAbusesSource = null |
28798b5d C |
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 | } | |
df98563e | 57 | } |
11ac88de | 58 | |
df98563e | 59 | constructor ( |
7ddd02c9 C |
60 | private notificationsService: NotificationsService, |
61 | private videoAbuseService: VideoAbuseService | |
28798b5d | 62 | ) { |
df98563e C |
63 | this.videoAbusesSource = this.videoAbuseService.getDataSource() |
64 | } | |
11ac88de | 65 | |
df98563e | 66 | buildVideoLink (videoId: string) { |
28798b5d C |
67 | // TODO: transform to routerLink |
68 | // https://github.com/akveo/ng2-smart-table/issues/57 | |
df98563e | 69 | return `<a href="/videos/${videoId}" title="Go to the video">${videoId}</a>` |
11ac88de C |
70 | } |
71 | } |