aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/admin
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-23 22:16:48 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-23 22:18:53 +0100
commit11ac88de40215783835cf6e6259ff0f6cee258dd (patch)
tree9bdb69c0a4e3621b9b185d30a8a63f1ac6e8fbfa /client/src/app/admin
parent4f8c0eb0e9356ee2782ea6eb12a92e4dc5f66127 (diff)
downloadPeerTube-11ac88de40215783835cf6e6259ff0f6cee258dd.tar.gz
PeerTube-11ac88de40215783835cf6e6259ff0f6cee258dd.tar.zst
PeerTube-11ac88de40215783835cf6e6259ff0f6cee258dd.zip
Client: add basic support to report video abuses
Diffstat (limited to 'client/src/app/admin')
-rw-r--r--client/src/app/admin/admin-routing.module.ts4
-rw-r--r--client/src/app/admin/admin.module.ts4
-rw-r--r--client/src/app/admin/menu-admin.component.html5
-rw-r--r--client/src/app/admin/video-abuses/index.ts3
-rw-r--r--client/src/app/admin/video-abuses/video-abuse-list/index.ts1
-rw-r--r--client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.html27
-rw-r--r--client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.scss7
-rw-r--r--client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.ts31
-rw-r--r--client/src/app/admin/video-abuses/video-abuses.component.ts8
-rw-r--r--client/src/app/admin/video-abuses/video-abuses.routes.ts28
10 files changed, 117 insertions, 1 deletions
diff --git a/client/src/app/admin/admin-routing.module.ts b/client/src/app/admin/admin-routing.module.ts
index 6bff25033..cabc6df15 100644
--- a/client/src/app/admin/admin-routing.module.ts
+++ b/client/src/app/admin/admin-routing.module.ts
@@ -5,6 +5,7 @@ import { AdminComponent } from './admin.component';
5import { FriendsRoutes } from './friends'; 5import { FriendsRoutes } from './friends';
6import { RequestsRoutes } from './requests'; 6import { RequestsRoutes } from './requests';
7import { UsersRoutes } from './users'; 7import { UsersRoutes } from './users';
8import { VideoAbusesRoutes } from './video-abuses';
8 9
9const adminRoutes: Routes = [ 10const adminRoutes: Routes = [
10 { 11 {
@@ -18,7 +19,8 @@ const adminRoutes: Routes = [
18 }, 19 },
19 ...FriendsRoutes, 20 ...FriendsRoutes,
20 ...RequestsRoutes, 21 ...RequestsRoutes,
21 ...UsersRoutes 22 ...UsersRoutes,
23 ...VideoAbusesRoutes
22 ] 24 ]
23 } 25 }
24]; 26];
diff --git a/client/src/app/admin/admin.module.ts b/client/src/app/admin/admin.module.ts
index 63d99a3db..d3ada8ce8 100644
--- a/client/src/app/admin/admin.module.ts
+++ b/client/src/app/admin/admin.module.ts
@@ -5,6 +5,7 @@ import { AdminRoutingModule } from './admin-routing.module';
5import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendService } from './friends'; 5import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendService } from './friends';
6import { RequestsComponent, RequestStatsComponent, RequestService } from './requests'; 6import { RequestsComponent, RequestStatsComponent, RequestService } from './requests';
7import { UsersComponent, UserAddComponent, UserListComponent, UserService } from './users'; 7import { UsersComponent, UserAddComponent, UserListComponent, UserService } from './users';
8import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses';
8import { MenuAdminComponent } from './menu-admin.component'; 9import { MenuAdminComponent } from './menu-admin.component';
9import { SharedModule } from '../shared'; 10import { SharedModule } from '../shared';
10 11
@@ -28,6 +29,9 @@ import { SharedModule } from '../shared';
28 UserAddComponent, 29 UserAddComponent,
29 UserListComponent, 30 UserListComponent,
30 31
32 VideoAbusesComponent,
33 VideoAbuseListComponent,
34
31 MenuAdminComponent 35 MenuAdminComponent
32 ], 36 ],
33 37
diff --git a/client/src/app/admin/menu-admin.component.html b/client/src/app/admin/menu-admin.component.html
index e250615aa..ad7a7a1b4 100644
--- a/client/src/app/admin/menu-admin.component.html
+++ b/client/src/app/admin/menu-admin.component.html
@@ -15,6 +15,11 @@
15 <span class="hidden-xs glyphicon glyphicon-stats"></span> 15 <span class="hidden-xs glyphicon glyphicon-stats"></span>
16 <a [routerLink]="['/admin/requests/stats']">Request stats</a> 16 <a [routerLink]="['/admin/requests/stats']">Request stats</a>
17 </div> 17 </div>
18
19 <div id="panel-video-abuses" class="panel-button">
20 <span class="hidden-xs glyphicon glyphicon-alert"></span>
21 <a [routerLink]="['/admin/video-abuses/list']">Video abuses</a>
22 </div>
18 </div> 23 </div>
19 24
20 <div class="panel-block"> 25 <div class="panel-block">
diff --git a/client/src/app/admin/video-abuses/index.ts b/client/src/app/admin/video-abuses/index.ts
new file mode 100644
index 000000000..7f5e65f91
--- /dev/null
+++ b/client/src/app/admin/video-abuses/index.ts
@@ -0,0 +1,3 @@
1export * from './video-abuse-list';
2export * from './video-abuses.component';
3export * from './video-abuses.routes';
diff --git a/client/src/app/admin/video-abuses/video-abuse-list/index.ts b/client/src/app/admin/video-abuses/video-abuse-list/index.ts
new file mode 100644
index 000000000..3f2ed1714
--- /dev/null
+++ b/client/src/app/admin/video-abuses/video-abuse-list/index.ts
@@ -0,0 +1 @@
export * from './video-abuse-list.component';
diff --git a/client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.html b/client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.html
new file mode 100644
index 000000000..46043577c
--- /dev/null
+++ b/client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.html
@@ -0,0 +1,27 @@
1<h3>Video abuses list</h3>
2
3<table class="table table-hover">
4 <thead>
5 <tr>
6 <th class="cell-id">ID</th>
7 <th class="cell-reason">Reason</th>
8 <th>Reporter pod host</th>
9 <th>Reporter username</th>
10 <th>Video</th>
11 <th>Created at</th>
12 </tr>
13 </thead>
14
15 <tbody>
16 <tr *ngFor="let videoAbuse of videoAbuses">
17 <td>{{ videoAbuse.id }}</td>
18 <td>{{ videoAbuse.reason }}</td>
19 <td>{{ videoAbuse.reporterPodHost }}</td>
20 <td>{{ videoAbuse.reporterUsername }}</td>
21 <td>
22 <a [routerLink]="buildVideoLink(videoAbuse)" title="Go to video">{{ videoAbuse.videoId }}</a>
23 </td>
24 <td>{{ videoAbuse.createdAt | date: 'medium' }}</td>
25 </tr>
26 </tbody>
27</table>
diff --git a/client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.scss b/client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.scss
new file mode 100644
index 000000000..a094f74b8
--- /dev/null
+++ b/client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.scss
@@ -0,0 +1,7 @@
1.cell-id {
2 width: 40px;
3}
4
5.cell-reason {
6 width: 200px;
7}
diff --git a/client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.ts b/client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
new file mode 100644
index 000000000..de58bba3d
--- /dev/null
+++ b/client/src/app/admin/video-abuses/video-abuse-list/video-abuse-list.component.ts
@@ -0,0 +1,31 @@
1import { setInterval } from 'timers'
2import { Component, OnInit } from '@angular/core';
3
4import { VideoAbuseService, VideoAbuse} from '../../../shared';
5
6@Component({
7 selector: 'my-video-abuse-list',
8 templateUrl: './video-abuse-list.component.html',
9 styleUrls: [ './video-abuse-list.component.scss' ]
10})
11export class VideoAbuseListComponent implements OnInit {
12 videoAbuses: VideoAbuse[];
13
14 constructor(private videoAbuseService: VideoAbuseService) { }
15
16 ngOnInit() {
17 this.getVideoAbuses();
18 }
19
20 buildVideoLink(videoAbuse: VideoAbuse) {
21 return `/videos/${videoAbuse.videoId}`;
22 }
23
24 private getVideoAbuses() {
25 this.videoAbuseService.getVideoAbuses().subscribe(
26 res => this.videoAbuses = res.videoAbuses,
27
28 err => alert(err.text)
29 );
30 }
31}
diff --git a/client/src/app/admin/video-abuses/video-abuses.component.ts b/client/src/app/admin/video-abuses/video-abuses.component.ts
new file mode 100644
index 000000000..001f27e87
--- /dev/null
+++ b/client/src/app/admin/video-abuses/video-abuses.component.ts
@@ -0,0 +1,8 @@
1import { Component } from '@angular/core';
2
3@Component({
4 template: '<router-outlet></router-outlet>'
5})
6
7export class VideoAbusesComponent {
8}
diff --git a/client/src/app/admin/video-abuses/video-abuses.routes.ts b/client/src/app/admin/video-abuses/video-abuses.routes.ts
new file mode 100644
index 000000000..26a761887
--- /dev/null
+++ b/client/src/app/admin/video-abuses/video-abuses.routes.ts
@@ -0,0 +1,28 @@
1import { Routes } from '@angular/router';
2
3import { VideoAbusesComponent } from './video-abuses.component';
4import { VideoAbuseListComponent } from './video-abuse-list';
5
6export const VideoAbusesRoutes: Routes = [
7 {
8 path: 'video-abuses',
9 component: VideoAbusesComponent
10 ,
11 children: [
12 {
13 path: '',
14 redirectTo: 'list',
15 pathMatch: 'full'
16 },
17 {
18 path: 'list',
19 component: VideoAbuseListComponent,
20 data: {
21 meta: {
22 titleSuffix: ' - Video abuses list'
23 }
24 }
25 }
26 ]
27 }
28];