]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
Client: better notifications for a beautiful world
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / video-abuses / video-abuse-list / video-abuse-list.component.ts
1 import { Component, OnInit } from '@angular/core';
2
3 import { NotificationsService } from 'angular2-notifications';
4
5 import { 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 implements OnInit {
13 videoAbuses: VideoAbuse[];
14
15 constructor(
16 private notificationsService: NotificationsService,
17 private videoAbuseService: VideoAbuseService
18 ) { }
19
20 ngOnInit() {
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
32 err => this.notificationsService.error('Error', err.text)
33 );
34 }
35 }