aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-16 14:32:15 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-16 14:32:15 +0200
commitdf98563e2104b82b119c00a3cd83cd0dc1242d25 (patch)
treea9720bf01bac9ad5646bd3d3c9bc7653617afdad /client/src/app/+admin
parent46757b477c1adb5f98060d15998a3852e18902a6 (diff)
downloadPeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.tar.gz
PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.tar.zst
PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.zip
Use typescript standard and lint all files
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/admin-routing.module.ts16
-rw-r--r--client/src/app/+admin/admin.component.ts2
-rw-r--r--client/src/app/+admin/admin.module.ts18
-rw-r--r--client/src/app/+admin/friends/friend-add/friend-add.component.ts108
-rw-r--r--client/src/app/+admin/friends/friend-add/index.ts2
-rw-r--r--client/src/app/+admin/friends/friend-list/friend-list.component.ts38
-rw-r--r--client/src/app/+admin/friends/friend-list/index.ts2
-rw-r--r--client/src/app/+admin/friends/friends.component.ts5
-rw-r--r--client/src/app/+admin/friends/friends.routes.ts60
-rw-r--r--client/src/app/+admin/friends/index.ts10
-rw-r--r--client/src/app/+admin/friends/shared/friend.model.ts10
-rw-r--r--client/src/app/+admin/friends/shared/friend.service.ts30
-rw-r--r--client/src/app/+admin/friends/shared/index.ts4
-rw-r--r--client/src/app/+admin/index.ts12
-rw-r--r--client/src/app/+admin/requests/index.ts8
-rw-r--r--client/src/app/+admin/requests/request-stats/index.ts2
-rw-r--r--client/src/app/+admin/requests/request-stats/request-stats.component.ts55
-rw-r--r--client/src/app/+admin/requests/requests.component.ts5
-rw-r--r--client/src/app/+admin/requests/requests.routes.ts42
-rw-r--r--client/src/app/+admin/requests/shared/index.ts4
-rw-r--r--client/src/app/+admin/requests/shared/request-stats.model.ts36
-rw-r--r--client/src/app/+admin/requests/shared/request.service.ts28
-rw-r--r--client/src/app/+admin/users/index.ts10
-rw-r--r--client/src/app/+admin/users/shared/index.ts2
-rw-r--r--client/src/app/+admin/users/shared/user.service.ts26
-rw-r--r--client/src/app/+admin/users/user-add/index.ts2
-rw-r--r--client/src/app/+admin/users/user-add/user-add.component.ts50
-rw-r--r--client/src/app/+admin/users/user-list/index.ts2
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.ts36
-rw-r--r--client/src/app/+admin/users/users.component.ts5
-rw-r--r--client/src/app/+admin/users/users.routes.ts10
-rw-r--r--client/src/app/+admin/video-abuses/index.ts6
-rw-r--r--client/src/app/+admin/video-abuses/video-abuse-list/index.ts2
-rw-r--r--client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts24
-rw-r--r--client/src/app/+admin/video-abuses/video-abuses.component.ts2
-rw-r--r--client/src/app/+admin/video-abuses/video-abuses.routes.ts8
36 files changed, 338 insertions, 344 deletions
diff --git a/client/src/app/+admin/admin-routing.module.ts b/client/src/app/+admin/admin-routing.module.ts
index d3adf3f3b..839913135 100644
--- a/client/src/app/+admin/admin-routing.module.ts
+++ b/client/src/app/+admin/admin-routing.module.ts
@@ -1,11 +1,11 @@
1import { NgModule } from '@angular/core'; 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router'; 2import { RouterModule, Routes } from '@angular/router'
3 3
4import { AdminComponent } from './admin.component'; 4import { 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'; 8import { VideoAbusesRoutes } from './video-abuses'
9 9
10const adminRoutes: Routes = [ 10const adminRoutes: Routes = [
11 { 11 {
@@ -23,7 +23,7 @@ const adminRoutes: Routes = [
23 ...VideoAbusesRoutes 23 ...VideoAbusesRoutes
24 ] 24 ]
25 } 25 }
26]; 26]
27 27
28@NgModule({ 28@NgModule({
29 imports: [ RouterModule.forChild(adminRoutes) ], 29 imports: [ RouterModule.forChild(adminRoutes) ],
diff --git a/client/src/app/+admin/admin.component.ts b/client/src/app/+admin/admin.component.ts
index 64a7400e7..93ec216bf 100644
--- a/client/src/app/+admin/admin.component.ts
+++ b/client/src/app/+admin/admin.component.ts
@@ -1,4 +1,4 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core'
2 2
3@Component({ 3@Component({
4 template: '<router-outlet></router-outlet>' 4 template: '<router-outlet></router-outlet>'
diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts
index db1ce2d7f..9ecce5dc3 100644
--- a/client/src/app/+admin/admin.module.ts
+++ b/client/src/app/+admin/admin.module.ts
@@ -1,12 +1,12 @@
1import { NgModule } from '@angular/core'; 1import { NgModule } from '@angular/core'
2 2
3import { AdminComponent } from './admin.component'; 3import { AdminComponent } from './admin.component'
4import { AdminRoutingModule } from './admin-routing.module'; 4import { 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 { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses'
9import { SharedModule } from '../shared'; 9import { SharedModule } from '../shared'
10 10
11@NgModule({ 11@NgModule({
12 imports: [ 12 imports: [
diff --git a/client/src/app/+admin/friends/friend-add/friend-add.component.ts b/client/src/app/+admin/friends/friend-add/friend-add.component.ts
index 12c46e5cd..35cf4a1f7 100644
--- a/client/src/app/+admin/friends/friend-add/friend-add.component.ts
+++ b/client/src/app/+admin/friends/friend-add/friend-add.component.ts
@@ -1,12 +1,12 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core'
2import { FormControl, FormGroup } from '@angular/forms'; 2import { FormControl, FormGroup } from '@angular/forms'
3import { Router } from '@angular/router'; 3import { Router } from '@angular/router'
4 4
5import { NotificationsService } from 'angular2-notifications'; 5import { NotificationsService } from 'angular2-notifications'
6 6
7import { ConfirmService } from '../../../core'; 7import { ConfirmService } from '../../../core'
8import { validateHost } from '../../../shared'; 8import { validateHost } from '../../../shared'
9import { FriendService } from '../shared'; 9import { FriendService } from '../shared'
10 10
11@Component({ 11@Component({
12 selector: 'my-friend-add', 12 selector: 'my-friend-add',
@@ -14,107 +14,107 @@ import { FriendService } from '../shared';
14 styleUrls: [ './friend-add.component.scss' ] 14 styleUrls: [ './friend-add.component.scss' ]
15}) 15})
16export class FriendAddComponent implements OnInit { 16export class FriendAddComponent implements OnInit {
17 form: FormGroup; 17 form: FormGroup
18 hosts = [ ]; 18 hosts = [ ]
19 error: string = null; 19 error: string = null
20 20
21 constructor( 21 constructor (
22 private router: Router, 22 private router: Router,
23 private notificationsService: NotificationsService, 23 private notificationsService: NotificationsService,
24 private confirmService: ConfirmService, 24 private confirmService: ConfirmService,
25 private friendService: FriendService 25 private friendService: FriendService
26 ) {} 26 ) {}
27 27
28 ngOnInit() { 28 ngOnInit () {
29 this.form = new FormGroup({}); 29 this.form = new FormGroup({})
30 this.addField(); 30 this.addField()
31 } 31 }
32 32
33 addField() { 33 addField () {
34 this.form.addControl(`host-${this.hosts.length}`, new FormControl('', [ validateHost ])); 34 this.form.addControl(`host-${this.hosts.length}`, new FormControl('', [ validateHost ]))
35 this.hosts.push(''); 35 this.hosts.push('')
36 } 36 }
37 37
38 canMakeFriends() { 38 canMakeFriends () {
39 return window.location.protocol === 'https:'; 39 return window.location.protocol === 'https:'
40 } 40 }
41 41
42 customTrackBy(index: number, obj: any): any { 42 customTrackBy (index: number, obj: any): any {
43 return index; 43 return index
44 } 44 }
45 45
46 displayAddField(index: number) { 46 displayAddField (index: number) {
47 return index === (this.hosts.length - 1); 47 return index === (this.hosts.length - 1)
48 } 48 }
49 49
50 displayRemoveField(index: number) { 50 displayRemoveField (index: number) {
51 return (index !== 0 || this.hosts.length > 1) && index !== (this.hosts.length - 1); 51 return (index !== 0 || this.hosts.length > 1) && index !== (this.hosts.length - 1)
52 } 52 }
53 53
54 isFormValid() { 54 isFormValid () {
55 // Do not check the last input 55 // Do not check the last input
56 for (let i = 0; i < this.hosts.length - 1; i++) { 56 for (let i = 0; i < this.hosts.length - 1; i++) {
57 if (!this.form.controls[`host-${i}`].valid) return false; 57 if (!this.form.controls[`host-${i}`].valid) return false
58 } 58 }
59 59
60 const lastIndex = this.hosts.length - 1; 60 const lastIndex = this.hosts.length - 1
61 // If the last input (which is not the first) is empty, it's ok 61 // If the last input (which is not the first) is empty, it's ok
62 if (this.hosts[lastIndex] === '' && lastIndex !== 0) { 62 if (this.hosts[lastIndex] === '' && lastIndex !== 0) {
63 return true; 63 return true
64 } else { 64 } else {
65 return this.form.controls[`host-${lastIndex}`].valid; 65 return this.form.controls[`host-${lastIndex}`].valid
66 } 66 }
67 } 67 }
68 68
69 removeField(index: number) { 69 removeField (index: number) {
70 // Remove the last control 70 // Remove the last control
71 this.form.removeControl(`host-${this.hosts.length - 1}`); 71 this.form.removeControl(`host-${this.hosts.length - 1}`)
72 this.hosts.splice(index, 1); 72 this.hosts.splice(index, 1)
73 } 73 }
74 74
75 makeFriends() { 75 makeFriends () {
76 this.error = ''; 76 this.error = ''
77 77
78 const notEmptyHosts = this.getNotEmptyHosts(); 78 const notEmptyHosts = this.getNotEmptyHosts()
79 if (notEmptyHosts.length === 0) { 79 if (notEmptyHosts.length === 0) {
80 this.error = 'You need to specify at least 1 host.'; 80 this.error = 'You need to specify at least 1 host.'
81 return; 81 return
82 } 82 }
83 83
84 if (!this.isHostsUnique(notEmptyHosts)) { 84 if (!this.isHostsUnique(notEmptyHosts)) {
85 this.error = 'Hosts need to be unique.'; 85 this.error = 'Hosts need to be unique.'
86 return; 86 return
87 } 87 }
88 88
89 const confirmMessage = 'Are you sure to make friends with:<br /> - ' + notEmptyHosts.join('<br /> - '); 89 const confirmMessage = 'Are you sure to make friends with:<br /> - ' + notEmptyHosts.join('<br /> - ')
90 this.confirmService.confirm(confirmMessage, 'Make friends').subscribe( 90 this.confirmService.confirm(confirmMessage, 'Make friends').subscribe(
91 res => { 91 res => {
92 if (res === false) return; 92 if (res === false) return
93 93
94 this.friendService.makeFriends(notEmptyHosts).subscribe( 94 this.friendService.makeFriends(notEmptyHosts).subscribe(
95 status => { 95 status => {
96 this.notificationsService.success('Sucess', 'Make friends request sent!'); 96 this.notificationsService.success('Sucess', 'Make friends request sent!')
97 this.router.navigate([ '/admin/friends/list' ]); 97 this.router.navigate([ '/admin/friends/list' ])
98 }, 98 },
99 99
100 err => this.notificationsService.error('Error', err.text) 100 err => this.notificationsService.error('Error', err.text)
101 ); 101 )
102 } 102 }
103 ); 103 )
104 } 104 }
105 105
106 private getNotEmptyHosts() { 106 private getNotEmptyHosts () {
107 const notEmptyHosts = []; 107 const notEmptyHosts = []
108 108
109 Object.keys(this.form.value).forEach((hostKey) => { 109 Object.keys(this.form.value).forEach((hostKey) => {
110 const host = this.form.value[hostKey]; 110 const host = this.form.value[hostKey]
111 if (host !== '') notEmptyHosts.push(host); 111 if (host !== '') notEmptyHosts.push(host)
112 }); 112 })
113 113
114 return notEmptyHosts; 114 return notEmptyHosts
115 } 115 }
116 116
117 private isHostsUnique(hosts: string[]) { 117 private isHostsUnique (hosts: string[]) {
118 return hosts.every(host => hosts.indexOf(host) === hosts.lastIndexOf(host)); 118 return hosts.every(host => hosts.indexOf(host) === hosts.lastIndexOf(host))
119 } 119 }
120} 120}
diff --git a/client/src/app/+admin/friends/friend-add/index.ts b/client/src/app/+admin/friends/friend-add/index.ts
index a101b3be5..978ab3d46 100644
--- a/client/src/app/+admin/friends/friend-add/index.ts
+++ b/client/src/app/+admin/friends/friend-add/index.ts
@@ -1 +1 @@
export * from './friend-add.component'; export * from './friend-add.component'
diff --git a/client/src/app/+admin/friends/friend-list/friend-list.component.ts b/client/src/app/+admin/friends/friend-list/friend-list.component.ts
index 525a9fbc3..7bf9d2c6b 100644
--- a/client/src/app/+admin/friends/friend-list/friend-list.component.ts
+++ b/client/src/app/+admin/friends/friend-list/friend-list.component.ts
@@ -1,11 +1,11 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core'
2 2
3import { NotificationsService } from 'angular2-notifications'; 3import { NotificationsService } from 'angular2-notifications'
4import { ServerDataSource } from 'ng2-smart-table'; 4import { ServerDataSource } from 'ng2-smart-table'
5 5
6import { ConfirmService } from '../../../core'; 6import { ConfirmService } from '../../../core'
7import { Utils } from '../../../shared'; 7import { Utils } from '../../../shared'
8import { Friend, FriendService } from '../shared'; 8import { Friend, FriendService } from '../shared'
9 9
10@Component({ 10@Component({
11 selector: 'my-friend-list', 11 selector: 'my-friend-list',
@@ -13,7 +13,7 @@ import { Friend, FriendService } from '../shared';
13 styleUrls: [ './friend-list.component.scss' ] 13 styleUrls: [ './friend-list.component.scss' ]
14}) 14})
15export class FriendListComponent { 15export class FriendListComponent {
16 friendsSource = null; 16 friendsSource = null
17 tableSettings = { 17 tableSettings = {
18 attr: { 18 attr: {
19 class: 'table-hover' 19 class: 'table-hover'
@@ -49,36 +49,36 @@ export class FriendListComponent {
49 valuePrepareFunction: Utils.dateToHuman 49 valuePrepareFunction: Utils.dateToHuman
50 } 50 }
51 } 51 }
52 }; 52 }
53 53
54 constructor( 54 constructor (
55 private notificationsService: NotificationsService, 55 private notificationsService: NotificationsService,
56 private confirmService: ConfirmService, 56 private confirmService: ConfirmService,
57 private friendService: FriendService 57 private friendService: FriendService
58 ) { 58 ) {
59 this.friendsSource = this.friendService.getDataSource(); 59 this.friendsSource = this.friendService.getDataSource()
60 } 60 }
61 61
62 hasFriends() { 62 hasFriends () {
63 return this.friendsSource.count() !== 0; 63 return this.friendsSource.count() !== 0
64 } 64 }
65 65
66 quitFriends() { 66 quitFriends () {
67 const confirmMessage = 'Do you really want to quit your friends? All their videos will be deleted.'; 67 const confirmMessage = 'Do you really want to quit your friends? All their videos will be deleted.'
68 this.confirmService.confirm(confirmMessage, 'Quit friends').subscribe( 68 this.confirmService.confirm(confirmMessage, 'Quit friends').subscribe(
69 res => { 69 res => {
70 if (res === false) return; 70 if (res === false) return
71 71
72 this.friendService.quitFriends().subscribe( 72 this.friendService.quitFriends().subscribe(
73 status => { 73 status => {
74 this.notificationsService.success('Sucess', 'Friends left!'); 74 this.notificationsService.success('Sucess', 'Friends left!')
75 75
76 this.friendsSource.refresh(); 76 this.friendsSource.refresh()
77 }, 77 },
78 78
79 err => this.notificationsService.error('Error', err.text) 79 err => this.notificationsService.error('Error', err.text)
80 ); 80 )
81 } 81 }
82 ); 82 )
83 } 83 }
84} 84}
diff --git a/client/src/app/+admin/friends/friend-list/index.ts b/client/src/app/+admin/friends/friend-list/index.ts
index 354c978a4..c9cbd2800 100644
--- a/client/src/app/+admin/friends/friend-list/index.ts
+++ b/client/src/app/+admin/friends/friend-list/index.ts
@@ -1 +1 @@
export * from './friend-list.component'; export * from './friend-list.component'
diff --git a/client/src/app/+admin/friends/friends.component.ts b/client/src/app/+admin/friends/friends.component.ts
index 5ca29111c..5ef0aaa03 100644
--- a/client/src/app/+admin/friends/friends.component.ts
+++ b/client/src/app/+admin/friends/friends.component.ts
@@ -1,8 +1,7 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core'
2 2
3@Component({ 3@Component({
4 template: '<router-outlet></router-outlet>' 4 template: '<router-outlet></router-outlet>'
5}) 5})
6
7export class FriendsComponent { 6export class FriendsComponent {
8} 7}
diff --git a/client/src/app/+admin/friends/friends.routes.ts b/client/src/app/+admin/friends/friends.routes.ts
index 747066d1f..615b6f4f7 100644
--- a/client/src/app/+admin/friends/friends.routes.ts
+++ b/client/src/app/+admin/friends/friends.routes.ts
@@ -1,37 +1,37 @@
1import { Routes } from '@angular/router'; 1import { Routes } from '@angular/router'
2 2
3import { FriendsComponent } from './friends.component'; 3import { FriendsComponent } from './friends.component'
4import { FriendAddComponent } from './friend-add'; 4import { FriendAddComponent } from './friend-add'
5import { FriendListComponent } from './friend-list'; 5import { FriendListComponent } from './friend-list'
6 6
7export const FriendsRoutes: Routes = [ 7export const FriendsRoutes: Routes = [
8 { 8 {
9 path: 'friends', 9 path: 'friends',
10 component: FriendsComponent, 10 component: FriendsComponent,
11 children: [ 11 children: [
12 { 12 {
13 path: '', 13 path: '',
14 redirectTo: 'list', 14 redirectTo: 'list',
15 pathMatch: 'full' 15 pathMatch: 'full'
16 }, 16 },
17 { 17 {
18 path: 'list', 18 path: 'list',
19 component: FriendListComponent, 19 component: FriendListComponent,
20 data: { 20 data: {
21 meta: { 21 meta: {
22 title: 'Friends list' 22 title: 'Friends list'
23 }
24 } 23 }
25 }, 24 }
26 { 25 },
27 path: 'add', 26 {
28 component: FriendAddComponent, 27 path: 'add',
29 data: { 28 component: FriendAddComponent,
30 meta: { 29 data: {
31 title: 'Add friends' 30 meta: {
32 } 31 title: 'Add friends'
33 } 32 }
34 } 33 }
35 ] 34 }
36 } 35 ]
37]; 36 }
37]
diff --git a/client/src/app/+admin/friends/index.ts b/client/src/app/+admin/friends/index.ts
index dd4df2538..356dee8e9 100644
--- a/client/src/app/+admin/friends/index.ts
+++ b/client/src/app/+admin/friends/index.ts
@@ -1,5 +1,5 @@
1export * from './friend-add'; 1export * from './friend-add'
2export * from './friend-list'; 2export * from './friend-list'
3export * from './shared'; 3export * from './shared'
4export * from './friends.component'; 4export * from './friends.component'
5export * from './friends.routes'; 5export * from './friends.routes'
diff --git a/client/src/app/+admin/friends/shared/friend.model.ts b/client/src/app/+admin/friends/shared/friend.model.ts
index f72156d05..6950405b9 100644
--- a/client/src/app/+admin/friends/shared/friend.model.ts
+++ b/client/src/app/+admin/friends/shared/friend.model.ts
@@ -1,7 +1,7 @@
1export interface Friend { 1export interface Friend {
2 id: string; 2 id: string
3 host: string; 3 host: string
4 score: number; 4 score: number
5 email: string; 5 email: string
6 createdAt: Date; 6 createdAt: Date
7} 7}
diff --git a/client/src/app/+admin/friends/shared/friend.service.ts b/client/src/app/+admin/friends/shared/friend.service.ts
index 6e51c954f..f4ecd36ad 100644
--- a/client/src/app/+admin/friends/shared/friend.service.ts
+++ b/client/src/app/+admin/friends/shared/friend.service.ts
@@ -1,39 +1,39 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core'
2import { Observable } from 'rxjs/Observable'; 2import { Observable } from 'rxjs/Observable'
3import 'rxjs/add/operator/catch'; 3import 'rxjs/add/operator/catch'
4import 'rxjs/add/operator/map'; 4import 'rxjs/add/operator/map'
5 5
6import { ServerDataSource } from 'ng2-smart-table'; 6import { ServerDataSource } from 'ng2-smart-table'
7 7
8import { Friend } from './friend.model'; 8import { Friend } from './friend.model'
9import { AuthHttp, RestExtractor, RestDataSource, ResultList } from '../../../shared'; 9import { AuthHttp, RestExtractor, RestDataSource, ResultList } from '../../../shared'
10 10
11@Injectable() 11@Injectable()
12export class FriendService { 12export class FriendService {
13 private static BASE_FRIEND_URL = API_URL + '/api/v1/pods/'; 13 private static BASE_FRIEND_URL = API_URL + '/api/v1/pods/'
14 14
15 constructor ( 15 constructor (
16 private authHttp: AuthHttp, 16 private authHttp: AuthHttp,
17 private restExtractor: RestExtractor 17 private restExtractor: RestExtractor
18 ) {} 18 ) {}
19 19
20 getDataSource() { 20 getDataSource () {
21 return new RestDataSource(this.authHttp, FriendService.BASE_FRIEND_URL); 21 return new RestDataSource(this.authHttp, FriendService.BASE_FRIEND_URL)
22 } 22 }
23 23
24 makeFriends(notEmptyHosts) { 24 makeFriends (notEmptyHosts) {
25 const body = { 25 const body = {
26 hosts: notEmptyHosts 26 hosts: notEmptyHosts
27 }; 27 }
28 28
29 return this.authHttp.post(FriendService.BASE_FRIEND_URL + 'makefriends', body) 29 return this.authHttp.post(FriendService.BASE_FRIEND_URL + 'makefriends', body)
30 .map(this.restExtractor.extractDataBool) 30 .map(this.restExtractor.extractDataBool)
31 .catch((res) => this.restExtractor.handleError(res)); 31 .catch((res) => this.restExtractor.handleError(res))
32 } 32 }
33 33
34 quitFriends() { 34 quitFriends () {
35 return this.authHttp.get(FriendService.BASE_FRIEND_URL + 'quitfriends') 35 return this.authHttp.get(FriendService.BASE_FRIEND_URL + 'quitfriends')
36 .map(res => res.status) 36 .map(res => res.status)
37 .catch((res) => this.restExtractor.handleError(res)); 37 .catch((res) => this.restExtractor.handleError(res))
38 } 38 }
39} 39}
diff --git a/client/src/app/+admin/friends/shared/index.ts b/client/src/app/+admin/friends/shared/index.ts
index 0d671637d..41aa6edd6 100644
--- a/client/src/app/+admin/friends/shared/index.ts
+++ b/client/src/app/+admin/friends/shared/index.ts
@@ -1,2 +1,2 @@
1export * from './friend.model'; 1export * from './friend.model'
2export * from './friend.service'; 2export * from './friend.service'
diff --git a/client/src/app/+admin/index.ts b/client/src/app/+admin/index.ts
index 2f47a3cc3..11e2587c0 100644
--- a/client/src/app/+admin/index.ts
+++ b/client/src/app/+admin/index.ts
@@ -1,6 +1,6 @@
1export * from './friends'; 1export * from './friends'
2export * from './requests'; 2export * from './requests'
3export * from './users'; 3export * from './users'
4export * from './admin-routing.module'; 4export * from './admin-routing.module'
5export * from './admin.module'; 5export * from './admin.module'
6export * from './admin.component'; 6export * from './admin.component'
diff --git a/client/src/app/+admin/requests/index.ts b/client/src/app/+admin/requests/index.ts
index 236a9ee8f..d96a893c3 100644
--- a/client/src/app/+admin/requests/index.ts
+++ b/client/src/app/+admin/requests/index.ts
@@ -1,4 +1,4 @@
1export * from './request-stats'; 1export * from './request-stats'
2export * from './shared'; 2export * from './shared'
3export * from './requests.component'; 3export * from './requests.component'
4export * from './requests.routes'; 4export * from './requests.routes'
diff --git a/client/src/app/+admin/requests/request-stats/index.ts b/client/src/app/+admin/requests/request-stats/index.ts
index be3a66f77..740c401bb 100644
--- a/client/src/app/+admin/requests/request-stats/index.ts
+++ b/client/src/app/+admin/requests/request-stats/index.ts
@@ -1 +1 @@
export * from './request-stats.component'; export * from './request-stats.component'
diff --git a/client/src/app/+admin/requests/request-stats/request-stats.component.ts b/client/src/app/+admin/requests/request-stats/request-stats.component.ts
index 85dd7e492..cca4926cf 100644
--- a/client/src/app/+admin/requests/request-stats/request-stats.component.ts
+++ b/client/src/app/+admin/requests/request-stats/request-stats.component.ts
@@ -1,12 +1,12 @@
1import { Component, OnInit, OnDestroy } from '@angular/core'; 1import { Component, OnInit, OnDestroy } from '@angular/core'
2 2
3import { NotificationsService } from 'angular2-notifications'; 3import { NotificationsService } from 'angular2-notifications'
4 4
5import { RequestService, RequestStats } from '../shared'; 5import { RequestService, RequestStats } from '../shared'
6 6
7@Component({ 7@Component({
8 selector: 'my-request-stats', 8 selector: 'my-request-stats',
9 templateUrl: './request-stats.component.html', 9 templateUrl: './request-stats.component.html',
10 styleUrls: [ './request-stats.component.scss' ] 10 styleUrls: [ './request-stats.component.scss' ]
11}) 11})
12export class RequestStatsComponent implements OnInit, OnDestroy { 12export class RequestStatsComponent implements OnInit, OnDestroy {
@@ -14,70 +14,67 @@ export class RequestStatsComponent implements OnInit, OnDestroy {
14 requestScheduler: 'Basic request scheduler', 14 requestScheduler: 'Basic request scheduler',
15 requestVideoEventScheduler: 'Video events request scheduler', 15 requestVideoEventScheduler: 'Video events request scheduler',
16 requestVideoQaduScheduler: 'Quick and dirty video updates request scheduler' 16 requestVideoQaduScheduler: 'Quick and dirty video updates request scheduler'
17 }; 17 }
18 18
19 stats: { [ id: string ]: RequestStats } = { 19 stats: { [ id: string ]: RequestStats } = {
20 requestScheduler: null, 20 requestScheduler: null,
21 requestVideoEventScheduler: null, 21 requestVideoEventScheduler: null,
22 requestVideoQaduScheduler: null 22 requestVideoQaduScheduler: null
23 }; 23 }
24 24
25 private intervals: { [ id: string ]: number } = { 25 private intervals: { [ id: string ]: number } = {
26 requestScheduler: null, 26 requestScheduler: null,
27 requestVideoEventScheduler: null, 27 requestVideoEventScheduler: null,
28 requestVideoQaduScheduler: null 28 requestVideoQaduScheduler: null
29 }; 29 }
30 30
31 private timeouts: { [ id: string ]: number } = { 31 private timeouts: { [ id: string ]: number } = {
32 requestScheduler: null, 32 requestScheduler: null,
33 requestVideoEventScheduler: null, 33 requestVideoEventScheduler: null,
34 requestVideoQaduScheduler: null 34 requestVideoQaduScheduler: null
35 }; 35 }
36
37 36
38 constructor( 37 constructor (
39 private notificationsService: NotificationsService, 38 private notificationsService: NotificationsService,
40 private requestService: RequestService 39 private requestService: RequestService
41 ) { } 40 ) { }
42 41
43 ngOnInit() { 42 ngOnInit () {
44 this.getStats(); 43 this.getStats()
45 this.runIntervals(); 44 this.runIntervals()
46 } 45 }
47 46
48 ngOnDestroy() { 47 ngOnDestroy () {
49 Object.keys(this.stats).forEach(requestSchedulerName => { 48 Object.keys(this.stats).forEach(requestSchedulerName => {
50 if (this.intervals[requestSchedulerName] !== null) { 49 if (this.intervals[requestSchedulerName] !== null) {
51 window.clearInterval(this.intervals[requestSchedulerName]); 50 window.clearInterval(this.intervals[requestSchedulerName])
52 } 51 }
53 52
54 if (this.timeouts[requestSchedulerName] !== null) { 53 if (this.timeouts[requestSchedulerName] !== null) {
55 window.clearTimeout(this.timeouts[requestSchedulerName]); 54 window.clearTimeout(this.timeouts[requestSchedulerName])
56 } 55 }
57 }); 56 })
58 } 57 }
59 58
60 getStats() { 59 getStats () {
61 this.requestService.getStats().subscribe( 60 this.requestService.getStats().subscribe(
62 stats => this.stats = stats, 61 stats => this.stats = stats,
63 62
64 err => this.notificationsService.error('Error', err.text) 63 err => this.notificationsService.error('Error', err.text)
65 ); 64 )
66 } 65 }
67 66
68 private runIntervals() { 67 private runIntervals () {
69 Object.keys(this.intervals).forEach(requestSchedulerName => { 68 Object.keys(this.intervals).forEach(requestSchedulerName => {
70 this.intervals[requestSchedulerName] = window.setInterval(() => { 69 this.intervals[requestSchedulerName] = window.setInterval(() => {
71 const stats = this.stats[requestSchedulerName]; 70 const stats = this.stats[requestSchedulerName]
72 71
73 stats.remainingMilliSeconds -= 1000; 72 stats.remainingMilliSeconds -= 1000
74 73
75 if (stats.remainingMilliSeconds <= 0) { 74 if (stats.remainingMilliSeconds <= 0) {
76 this.timeouts[requestSchedulerName] = window.setTimeout(() => this.getStats(), stats.remainingMilliSeconds + 100); 75 this.timeouts[requestSchedulerName] = window.setTimeout(() => this.getStats(), stats.remainingMilliSeconds + 100)
77 } 76 }
78 }, 1000); 77 }, 1000)
79 }); 78 })
80 } 79 }
81
82
83} 80}
diff --git a/client/src/app/+admin/requests/requests.component.ts b/client/src/app/+admin/requests/requests.component.ts
index 471112b45..88a90fa4e 100644
--- a/client/src/app/+admin/requests/requests.component.ts
+++ b/client/src/app/+admin/requests/requests.component.ts
@@ -1,8 +1,7 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core'
2 2
3@Component({ 3@Component({
4 template: '<router-outlet></router-outlet>' 4 template: '<router-outlet></router-outlet>'
5}) 5})
6
7export class RequestsComponent { 6export class RequestsComponent {
8} 7}
diff --git a/client/src/app/+admin/requests/requests.routes.ts b/client/src/app/+admin/requests/requests.routes.ts
index 251dd0da8..84db3fea8 100644
--- a/client/src/app/+admin/requests/requests.routes.ts
+++ b/client/src/app/+admin/requests/requests.routes.ts
@@ -1,27 +1,27 @@
1import { Routes } from '@angular/router'; 1import { Routes } from '@angular/router'
2 2
3import { RequestsComponent } from './requests.component'; 3import { RequestsComponent } from './requests.component'
4import { RequestStatsComponent } from './request-stats'; 4import { RequestStatsComponent } from './request-stats'
5 5
6export const RequestsRoutes: Routes = [ 6export const RequestsRoutes: Routes = [
7 { 7 {
8 path: 'requests', 8 path: 'requests',
9 component: RequestsComponent, 9 component: RequestsComponent,
10 children: [ 10 children: [
11 { 11 {
12 path: '', 12 path: '',
13 redirectTo: 'stats', 13 redirectTo: 'stats',
14 pathMatch: 'full' 14 pathMatch: 'full'
15 }, 15 },
16 { 16 {
17 path: 'stats', 17 path: 'stats',
18 component: RequestStatsComponent, 18 component: RequestStatsComponent,
19 data: { 19 data: {
20 meta: { 20 meta: {
21 title: 'Request stats' 21 title: 'Request stats'
22 }
23 } 22 }
24 } 23 }
25 ] 24 }
26 } 25 ]
27]; 26 }
27]
diff --git a/client/src/app/+admin/requests/shared/index.ts b/client/src/app/+admin/requests/shared/index.ts
index 32ab5767b..2442e810a 100644
--- a/client/src/app/+admin/requests/shared/index.ts
+++ b/client/src/app/+admin/requests/shared/index.ts
@@ -1,2 +1,2 @@
1export * from './request-stats.model'; 1export * from './request-stats.model'
2export * from './request.service'; 2export * from './request.service'
diff --git a/client/src/app/+admin/requests/shared/request-stats.model.ts b/client/src/app/+admin/requests/shared/request-stats.model.ts
index f658c4682..31550b5c0 100644
--- a/client/src/app/+admin/requests/shared/request-stats.model.ts
+++ b/client/src/app/+admin/requests/shared/request-stats.model.ts
@@ -1,35 +1,35 @@
1export interface Request { 1export interface Request {
2 request: any; 2 request: any
3 to: any; 3 to: any
4} 4}
5 5
6export class RequestStats { 6export class RequestStats {
7 requestsLimitPods: number; 7 requestsLimitPods: number
8 requestsLimitPerPod: number; 8 requestsLimitPerPod: number
9 milliSecondsInterval: number; 9 milliSecondsInterval: number
10 remainingMilliSeconds: number; 10 remainingMilliSeconds: number
11 totalRequests: number; 11 totalRequests: number
12 12
13 constructor(hash: { 13 constructor (hash: {
14 requestsLimitPods: number, 14 requestsLimitPods: number,
15 requestsLimitPerPod: number, 15 requestsLimitPerPod: number,
16 milliSecondsInterval: number, 16 milliSecondsInterval: number,
17 remainingMilliSeconds: number, 17 remainingMilliSeconds: number,
18 totalRequests: number; 18 totalRequests: number
19 }) { 19 }) {
20 this.requestsLimitPods = hash.requestsLimitPods; 20 this.requestsLimitPods = hash.requestsLimitPods
21 this.requestsLimitPerPod = hash.requestsLimitPerPod; 21 this.requestsLimitPerPod = hash.requestsLimitPerPod
22 this.milliSecondsInterval = hash.milliSecondsInterval; 22 this.milliSecondsInterval = hash.milliSecondsInterval
23 this.remainingMilliSeconds = hash.remainingMilliSeconds; 23 this.remainingMilliSeconds = hash.remainingMilliSeconds
24 this.totalRequests = hash.totalRequests; 24 this.totalRequests = hash.totalRequests
25 } 25 }
26 26
27 get remainingSeconds() { 27 get remainingSeconds () {
28 return Math.floor(this.remainingMilliSeconds / 1000); 28 return Math.floor(this.remainingMilliSeconds / 1000)
29 } 29 }
30 30
31 get secondsInterval() { 31 get secondsInterva () {
32 return Math.floor(this.milliSecondsInterval / 1000); 32 return Math.floor(this.milliSecondsInterval / 1000)
33 } 33 }
34 34
35} 35}
diff --git a/client/src/app/+admin/requests/shared/request.service.ts b/client/src/app/+admin/requests/shared/request.service.ts
index 0872ba0b8..faa6b9383 100644
--- a/client/src/app/+admin/requests/shared/request.service.ts
+++ b/client/src/app/+admin/requests/shared/request.service.ts
@@ -1,34 +1,34 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core'
2import { Observable } from 'rxjs/Observable'; 2import { Observable } from 'rxjs/Observable'
3import 'rxjs/add/operator/catch'; 3import 'rxjs/add/operator/catch'
4import 'rxjs/add/operator/map'; 4import 'rxjs/add/operator/map'
5 5
6import { RequestStats } from './request-stats.model'; 6import { RequestStats } from './request-stats.model'
7import { AuthHttp, RestExtractor } from '../../../shared'; 7import { AuthHttp, RestExtractor } from '../../../shared'
8 8
9@Injectable() 9@Injectable()
10export class RequestService { 10export class RequestService {
11 private static BASE_REQUEST_URL = API_URL + '/api/v1/requests/'; 11 private static BASE_REQUEST_URL = API_URL + '/api/v1/requests/'
12 12
13 constructor ( 13 constructor (
14 private authHttp: AuthHttp, 14 private authHttp: AuthHttp,
15 private restExtractor: RestExtractor 15 private restExtractor: RestExtractor
16 ) {} 16 ) {}
17 17
18 getStats(): Observable<{ [ id: string ]: RequestStats }> { 18 getStats (): Observable<{ [ id: string ]: RequestStats }> {
19 return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats') 19 return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats')
20 .map(this.restExtractor.extractDataGet) 20 .map(this.restExtractor.extractDataGet)
21 .map(this.buildRequestObjects) 21 .map(this.buildRequestObjects)
22 .catch((res) => this.restExtractor.handleError(res)); 22 .catch((res) => this.restExtractor.handleError(res))
23 } 23 }
24 24
25 private buildRequestObjects(data: any) { 25 private buildRequestObjects (data: any) {
26 const requestSchedulers = {}; 26 const requestSchedulers = {}
27 27
28 Object.keys(data).forEach(requestSchedulerName => { 28 Object.keys(data).forEach(requestSchedulerName => {
29 requestSchedulers[requestSchedulerName] = new RequestStats(data[requestSchedulerName]); 29 requestSchedulers[requestSchedulerName] = new RequestStats(data[requestSchedulerName])
30 }); 30 })
31 31
32 return requestSchedulers; 32 return requestSchedulers
33 } 33 }
34} 34}
diff --git a/client/src/app/+admin/users/index.ts b/client/src/app/+admin/users/index.ts
index e98a81f62..cef2c282c 100644
--- a/client/src/app/+admin/users/index.ts
+++ b/client/src/app/+admin/users/index.ts
@@ -1,5 +1,5 @@
1export * from './shared'; 1export * from './shared'
2export * from './user-add'; 2export * from './user-add'
3export * from './user-list'; 3export * from './user-list'
4export * from './users.component'; 4export * from './users.component'
5export * from './users.routes'; 5export * from './users.routes'
diff --git a/client/src/app/+admin/users/shared/index.ts b/client/src/app/+admin/users/shared/index.ts
index e17ee5c7a..1f1302dc5 100644
--- a/client/src/app/+admin/users/shared/index.ts
+++ b/client/src/app/+admin/users/shared/index.ts
@@ -1 +1 @@
export * from './user.service'; export * from './user.service'
diff --git a/client/src/app/+admin/users/shared/user.service.ts b/client/src/app/+admin/users/shared/user.service.ts
index 9c7176d39..d52993a29 100644
--- a/client/src/app/+admin/users/shared/user.service.ts
+++ b/client/src/app/+admin/users/shared/user.service.ts
@@ -1,35 +1,35 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core'
2import 'rxjs/add/operator/catch'; 2import 'rxjs/add/operator/catch'
3import 'rxjs/add/operator/map'; 3import 'rxjs/add/operator/map'
4 4
5import { AuthHttp, RestExtractor, RestDataSource, User } from '../../../shared'; 5import { AuthHttp, RestExtractor, RestDataSource, User } from '../../../shared'
6 6
7@Injectable() 7@Injectable()
8export class UserService { 8export class UserService {
9 private static BASE_USERS_URL = API_URL + '/api/v1/users/'; 9 private static BASE_USERS_URL = API_URL + '/api/v1/users/'
10 10
11 constructor( 11 constructor (
12 private authHttp: AuthHttp, 12 private authHttp: AuthHttp,
13 private restExtractor: RestExtractor 13 private restExtractor: RestExtractor
14 ) {} 14 ) {}
15 15
16 addUser(username: string, password: string, email: string) { 16 addUser (username: string, password: string, email: string) {
17 const body = { 17 const body = {
18 username, 18 username,
19 email, 19 email,
20 password 20 password
21 }; 21 }
22 22
23 return this.authHttp.post(UserService.BASE_USERS_URL, body) 23 return this.authHttp.post(UserService.BASE_USERS_URL, body)
24 .map(this.restExtractor.extractDataBool) 24 .map(this.restExtractor.extractDataBool)
25 .catch(this.restExtractor.handleError); 25 .catch(this.restExtractor.handleError)
26 } 26 }
27 27
28 getDataSource() { 28 getDataSource () {
29 return new RestDataSource(this.authHttp, UserService.BASE_USERS_URL); 29 return new RestDataSource(this.authHttp, UserService.BASE_USERS_URL)
30 } 30 }
31 31
32 removeUser(user: User) { 32 removeUser (user: User) {
33 return this.authHttp.delete(UserService.BASE_USERS_URL + user.id); 33 return this.authHttp.delete(UserService.BASE_USERS_URL + user.id)
34 } 34 }
35} 35}
diff --git a/client/src/app/+admin/users/user-add/index.ts b/client/src/app/+admin/users/user-add/index.ts
index 66d5ca04f..3a4654101 100644
--- a/client/src/app/+admin/users/user-add/index.ts
+++ b/client/src/app/+admin/users/user-add/index.ts
@@ -1 +1 @@
export * from './user-add.component'; export * from './user-add.component'
diff --git a/client/src/app/+admin/users/user-add/user-add.component.ts b/client/src/app/+admin/users/user-add/user-add.component.ts
index f1d2fde80..2d25ab469 100644
--- a/client/src/app/+admin/users/user-add/user-add.component.ts
+++ b/client/src/app/+admin/users/user-add/user-add.component.ts
@@ -1,71 +1,71 @@
1import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core'
2import { FormBuilder, FormGroup } from '@angular/forms'; 2import { FormBuilder, FormGroup } from '@angular/forms'
3import { Router } from '@angular/router'; 3import { Router } from '@angular/router'
4 4
5import { NotificationsService } from 'angular2-notifications'; 5import { NotificationsService } from 'angular2-notifications'
6 6
7import { UserService } from '../shared'; 7import { UserService } from '../shared'
8import { 8import {
9 FormReactive, 9 FormReactive,
10 USER_USERNAME, 10 USER_USERNAME,
11 USER_EMAIL, 11 USER_EMAIL,
12 USER_PASSWORD 12 USER_PASSWORD
13} from '../../../shared'; 13} from '../../../shared'
14 14
15@Component({ 15@Component({
16 selector: 'my-user-add', 16 selector: 'my-user-add',
17 templateUrl: './user-add.component.html' 17 templateUrl: './user-add.component.html'
18}) 18})
19export class UserAddComponent extends FormReactive implements OnInit { 19export class UserAddComponent extends FormReactive implements OnInit {
20 error: string = null; 20 error: string = null
21 21
22 form: FormGroup; 22 form: FormGroup
23 formErrors = { 23 formErrors = {
24 'username': '', 24 'username': '',
25 'email': '', 25 'email': '',
26 'password': '' 26 'password': ''
27 }; 27 }
28 validationMessages = { 28 validationMessages = {
29 'username': USER_USERNAME.MESSAGES, 29 'username': USER_USERNAME.MESSAGES,
30 'email': USER_EMAIL.MESSAGES, 30 'email': USER_EMAIL.MESSAGES,
31 'password': USER_PASSWORD.MESSAGES, 31 'password': USER_PASSWORD.MESSAGES
32 }; 32 }
33 33
34 constructor( 34 constructor (
35 private formBuilder: FormBuilder, 35 private formBuilder: FormBuilder,
36 private router: Router, 36 private router: Router,
37 private notificationsService: NotificationsService, 37 private notificationsService: NotificationsService,
38 private userService: UserService 38 private userService: UserService
39 ) { 39 ) {
40 super(); 40 super()
41 } 41 }
42 42
43 buildForm() { 43 buildForm () {
44 this.form = this.formBuilder.group({ 44 this.form = this.formBuilder.group({
45 username: [ '', USER_USERNAME.VALIDATORS ], 45 username: [ '', USER_USERNAME.VALIDATORS ],
46 email: [ '', USER_EMAIL.VALIDATORS ], 46 email: [ '', USER_EMAIL.VALIDATORS ],
47 password: [ '', USER_PASSWORD.VALIDATORS ], 47 password: [ '', USER_PASSWORD.VALIDATORS ]
48 }); 48 })
49 49
50 this.form.valueChanges.subscribe(data => this.onValueChanged(data)); 50 this.form.valueChanges.subscribe(data => this.onValueChanged(data))
51 } 51 }
52 52
53 ngOnInit() { 53 ngOnInit () {
54 this.buildForm(); 54 this.buildForm()
55 } 55 }
56 56
57 addUser() { 57 addUser () {
58 this.error = null; 58 this.error = null
59 59
60 const { username, password, email } = this.form.value; 60 const { username, password, email } = this.form.value
61 61
62 this.userService.addUser(username, password, email).subscribe( 62 this.userService.addUser(username, password, email).subscribe(
63 () => { 63 () => {
64 this.notificationsService.success('Success', `User ${username} created.`); 64 this.notificationsService.success('Success', `User ${username} created.`)
65 this.router.navigate([ '/admin/users/list' ]); 65 this.router.navigate([ '/admin/users/list' ])
66 }, 66 },
67 67
68 err => this.error = err.text 68 err => this.error = err.text
69 ); 69 )
70 } 70 }
71} 71}
diff --git a/client/src/app/+admin/users/user-list/index.ts b/client/src/app/+admin/users/user-list/index.ts
index 51fbefa80..1826a4abe 100644
--- a/client/src/app/+admin/users/user-list/index.ts
+++ b/client/src/app/+admin/users/user-list/index.ts
@@ -1 +1 @@
export * from './user-list.component'; export * from './user-list.component'
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts
index 69ae4353d..b6fb0ed99 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/users/user-list/user-list.component.ts
@@ -1,10 +1,10 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core'
2 2
3import { NotificationsService } from 'angular2-notifications'; 3import { NotificationsService } from 'angular2-notifications'
4 4
5import { ConfirmService } from '../../../core'; 5import { ConfirmService } from '../../../core'
6import { User, Utils } from '../../../shared'; 6import { User, Utils } from '../../../shared'
7import { UserService } from '../shared'; 7import { UserService } from '../shared'
8 8
9@Component({ 9@Component({
10 selector: 'my-user-list', 10 selector: 'my-user-list',
@@ -12,7 +12,7 @@ import { UserService } from '../shared';
12 styleUrls: [ './user-list.component.scss' ] 12 styleUrls: [ './user-list.component.scss' ]
13}) 13})
14export class UserListComponent { 14export class UserListComponent {
15 usersSource = null; 15 usersSource = null
16 tableSettings = { 16 tableSettings = {
17 mode: 'external', 17 mode: 'external',
18 attr: { 18 attr: {
@@ -52,37 +52,37 @@ export class UserListComponent {
52 valuePrepareFunction: Utils.dateToHuman 52 valuePrepareFunction: Utils.dateToHuman
53 } 53 }
54 } 54 }
55 }; 55 }
56 56
57 constructor( 57 constructor (
58 private notificationsService: NotificationsService, 58 private notificationsService: NotificationsService,
59 private confirmService: ConfirmService, 59 private confirmService: ConfirmService,
60 private userService: UserService 60 private userService: UserService
61 ) { 61 ) {
62 this.usersSource = this.userService.getDataSource(); 62 this.usersSource = this.userService.getDataSource()
63 } 63 }
64 64
65 removeUser({ data }) { 65 removeUser ({ data }) {
66 const user: User = data; 66 const user: User = data
67 67
68 if (user.username === 'root') { 68 if (user.username === 'root') {
69 this.notificationsService.error('Error', 'You cannot delete root.'); 69 this.notificationsService.error('Error', 'You cannot delete root.')
70 return; 70 return
71 } 71 }
72 72
73 this.confirmService.confirm('Do you really want to delete this user?', 'Delete').subscribe( 73 this.confirmService.confirm('Do you really want to delete this user?', 'Delete').subscribe(
74 res => { 74 res => {
75 if (res === false) return; 75 if (res === false) return
76 76
77 this.userService.removeUser(user).subscribe( 77 this.userService.removeUser(user).subscribe(
78 () => { 78 () => {
79 this.notificationsService.success('Success', `User ${user.username} deleted.`); 79 this.notificationsService.success('Success', `User ${user.username} deleted.`)
80 this.usersSource.refresh(); 80 this.usersSource.refresh()
81 }, 81 },
82 82
83 err => this.notificationsService.error('Error', err.text) 83 err => this.notificationsService.error('Error', err.text)
84 ); 84 )
85 } 85 }
86 ); 86 )
87 } 87 }
88} 88}
diff --git a/client/src/app/+admin/users/users.component.ts b/client/src/app/+admin/users/users.component.ts
index 91af6c320..e9c8f6b0d 100644
--- a/client/src/app/+admin/users/users.component.ts
+++ b/client/src/app/+admin/users/users.component.ts
@@ -1,8 +1,7 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core'
2 2
3@Component({ 3@Component({
4 template: '<router-outlet></router-outlet>' 4 template: '<router-outlet></router-outlet>'
5}) 5})
6
7export class UsersComponent { 6export class UsersComponent {
8} 7}
diff --git a/client/src/app/+admin/users/users.routes.ts b/client/src/app/+admin/users/users.routes.ts
index 21fb192e0..723c5715d 100644
--- a/client/src/app/+admin/users/users.routes.ts
+++ b/client/src/app/+admin/users/users.routes.ts
@@ -1,8 +1,8 @@
1import { Routes } from '@angular/router'; 1import { Routes } from '@angular/router'
2 2
3import { UsersComponent } from './users.component'; 3import { UsersComponent } from './users.component'
4import { UserAddComponent } from './user-add'; 4import { UserAddComponent } from './user-add'
5import { UserListComponent } from './user-list'; 5import { UserListComponent } from './user-list'
6 6
7export const UsersRoutes: Routes = [ 7export const UsersRoutes: Routes = [
8 { 8 {
@@ -34,4 +34,4 @@ export const UsersRoutes: Routes = [
34 } 34 }
35 ] 35 ]
36 } 36 }
37]; 37]
diff --git a/client/src/app/+admin/video-abuses/index.ts b/client/src/app/+admin/video-abuses/index.ts
index 7f5e65f91..395fac2e7 100644
--- a/client/src/app/+admin/video-abuses/index.ts
+++ b/client/src/app/+admin/video-abuses/index.ts
@@ -1,3 +1,3 @@
1export * from './video-abuse-list'; 1export * from './video-abuse-list'
2export * from './video-abuses.component'; 2export * from './video-abuses.component'
3export * from './video-abuses.routes'; 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
index 3f2ed1714..01c24d860 100644
--- a/client/src/app/+admin/video-abuses/video-abuse-list/index.ts
+++ b/client/src/app/+admin/video-abuses/video-abuse-list/index.ts
@@ -1 +1 @@
export * from './video-abuse-list.component'; export * from './video-abuse-list.component'
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
index 55d82f790..60eaebb44 100644
--- 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
@@ -1,15 +1,15 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core'
2 2
3import { NotificationsService } from 'angular2-notifications'; 3import { NotificationsService } from 'angular2-notifications'
4 4
5import { Utils, VideoAbuseService, VideoAbuse } from '../../../shared'; 5import { Utils, VideoAbuseService, VideoAbuse } from '../../../shared'
6 6
7@Component({ 7@Component({
8 selector: 'my-video-abuse-list', 8 selector: 'my-video-abuse-list',
9 templateUrl: './video-abuse-list.component.html' 9 templateUrl: './video-abuse-list.component.html'
10}) 10})
11export class VideoAbuseListComponent { 11export class VideoAbuseListComponent {
12 videoAbusesSource = null; 12 videoAbusesSource = null
13 tableSettings = { 13 tableSettings = {
14 mode: 'external', 14 mode: 'external',
15 attr: { 15 attr: {
@@ -54,18 +54,18 @@ export class VideoAbuseListComponent {
54 valuePrepareFunction: Utils.dateToHuman 54 valuePrepareFunction: Utils.dateToHuman
55 } 55 }
56 } 56 }
57 }; 57 }
58 58
59 constructor( 59 constructor (
60 private notificationsService: NotificationsService, 60 private notificationsService: NotificationsService,
61 private videoAbuseService: VideoAbuseService 61 private videoAbuseService: VideoAbuseService
62 ) { 62 ) {
63 this.videoAbusesSource = this.videoAbuseService.getDataSource(); 63 this.videoAbusesSource = this.videoAbuseService.getDataSource()
64 } 64 }
65 65
66 buildVideoLink(videoId: string) { 66 buildVideoLink (videoId: string) {
67 // TODO: transform to routerLink 67 // TODO: transform to routerLink
68 // https://github.com/akveo/ng2-smart-table/issues/57 68 // https://github.com/akveo/ng2-smart-table/issues/57
69 return `<a href="/videos/${videoId}" title="Go to the video">${videoId}</a>`; 69 return `<a href="/videos/${videoId}" title="Go to the video">${videoId}</a>`
70 } 70 }
71} 71}
diff --git a/client/src/app/+admin/video-abuses/video-abuses.component.ts b/client/src/app/+admin/video-abuses/video-abuses.component.ts
index 001f27e87..9dae5c0b6 100644
--- a/client/src/app/+admin/video-abuses/video-abuses.component.ts
+++ b/client/src/app/+admin/video-abuses/video-abuses.component.ts
@@ -1,4 +1,4 @@
1import { Component } from '@angular/core'; 1import { Component } from '@angular/core'
2 2
3@Component({ 3@Component({
4 template: '<router-outlet></router-outlet>' 4 template: '<router-outlet></router-outlet>'
diff --git a/client/src/app/+admin/video-abuses/video-abuses.routes.ts b/client/src/app/+admin/video-abuses/video-abuses.routes.ts
index 1f19d7885..a8c1561cd 100644
--- a/client/src/app/+admin/video-abuses/video-abuses.routes.ts
+++ b/client/src/app/+admin/video-abuses/video-abuses.routes.ts
@@ -1,7 +1,7 @@
1import { Routes } from '@angular/router'; 1import { Routes } from '@angular/router'
2 2
3import { VideoAbusesComponent } from './video-abuses.component'; 3import { VideoAbusesComponent } from './video-abuses.component'
4import { VideoAbuseListComponent } from './video-abuse-list'; 4import { VideoAbuseListComponent } from './video-abuse-list'
5 5
6export const VideoAbusesRoutes: Routes = [ 6export const VideoAbusesRoutes: Routes = [
7 { 7 {
@@ -25,4 +25,4 @@ export const VideoAbusesRoutes: Routes = [
25 } 25 }
26 ] 26 ]
27 } 27 }
28]; 28]