aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+admin/friends/friend-list/friend-list.component.ts2
-rw-r--r--client/src/app/+admin/friends/shared/friend.model.ts7
-rw-r--r--client/src/app/+admin/friends/shared/friend.service.ts1
-rw-r--r--client/src/app/+admin/requests/request-stats/request-stats.component.ts11
-rw-r--r--client/src/app/+admin/requests/shared/index.ts2
-rw-r--r--client/src/app/+admin/requests/shared/request-stats-attributes.model.ts (renamed from client/src/app/+admin/requests/shared/request-stats.model.ts)4
-rw-r--r--client/src/app/+admin/requests/shared/request.service.ts9
-rw-r--r--client/src/app/+admin/video-abuses/video-abuse-list/video-abuse-list.component.ts3
-rw-r--r--client/src/app/core/auth/auth.service.ts5
-rw-r--r--client/src/app/core/config/config.service.ts7
-rw-r--r--client/src/app/shared/video-abuse/video-abuse.model.ts8
-rw-r--r--client/src/app/shared/video-abuse/video-abuse.service.ts2
-rw-r--r--client/src/app/videos/shared/rate-type.type.ts1
-rw-r--r--client/src/app/videos/shared/video.service.ts6
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts10
15 files changed, 30 insertions, 48 deletions
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 7bf9d2c6b..9f0256d7f 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
@@ -5,7 +5,7 @@ import { 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 { FriendService } from '../shared'
9 9
10@Component({ 10@Component({
11 selector: 'my-friend-list', 11 selector: 'my-friend-list',
diff --git a/client/src/app/+admin/friends/shared/friend.model.ts b/client/src/app/+admin/friends/shared/friend.model.ts
deleted file mode 100644
index 6950405b9..000000000
--- a/client/src/app/+admin/friends/shared/friend.model.ts
+++ /dev/null
@@ -1,7 +0,0 @@
1export interface Friend {
2 id: string
3 host: string
4 score: number
5 email: string
6 createdAt: Date
7}
diff --git a/client/src/app/+admin/friends/shared/friend.service.ts b/client/src/app/+admin/friends/shared/friend.service.ts
index f4ecd36ad..79de4470e 100644
--- a/client/src/app/+admin/friends/shared/friend.service.ts
+++ b/client/src/app/+admin/friends/shared/friend.service.ts
@@ -5,7 +5,6 @@ import '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'
9import { AuthHttp, RestExtractor, RestDataSource, ResultList } from '../../../shared' 8import { AuthHttp, RestExtractor, RestDataSource, ResultList } from '../../../shared'
10 9
11@Injectable() 10@Injectable()
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 cca4926cf..140aaf47e 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
@@ -2,7 +2,8 @@ import { 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, RequestSchedulerStatsAttributes } from '../shared'
6import { RequestScheduler } from '../../../../../../shared'
6 7
7@Component({ 8@Component({
8 selector: 'my-request-stats', 9 selector: 'my-request-stats',
@@ -16,11 +17,7 @@ export class RequestStatsComponent implements OnInit, OnDestroy {
16 requestVideoQaduScheduler: 'Quick and dirty video updates request scheduler' 17 requestVideoQaduScheduler: 'Quick and dirty video updates request scheduler'
17 } 18 }
18 19
19 stats: { [ id: string ]: RequestStats } = { 20 stats: RequestScheduler
20 requestScheduler: null,
21 requestVideoEventScheduler: null,
22 requestVideoQaduScheduler: null
23 }
24 21
25 private intervals: { [ id: string ]: number } = { 22 private intervals: { [ id: string ]: number } = {
26 requestScheduler: null, 23 requestScheduler: null,
@@ -67,7 +64,7 @@ export class RequestStatsComponent implements OnInit, OnDestroy {
67 private runIntervals () { 64 private runIntervals () {
68 Object.keys(this.intervals).forEach(requestSchedulerName => { 65 Object.keys(this.intervals).forEach(requestSchedulerName => {
69 this.intervals[requestSchedulerName] = window.setInterval(() => { 66 this.intervals[requestSchedulerName] = window.setInterval(() => {
70 const stats = this.stats[requestSchedulerName] 67 const stats: RequestSchedulerStatsAttributes = this.stats[requestSchedulerName]
71 68
72 stats.remainingMilliSeconds -= 1000 69 stats.remainingMilliSeconds -= 1000
73 70
diff --git a/client/src/app/+admin/requests/shared/index.ts b/client/src/app/+admin/requests/shared/index.ts
index 2442e810a..857fe9d29 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-attributes.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-attributes.model.ts
index 31550b5c0..394acc73d 100644
--- a/client/src/app/+admin/requests/shared/request-stats.model.ts
+++ b/client/src/app/+admin/requests/shared/request-stats-attributes.model.ts
@@ -1,9 +1,11 @@
1import { RequestSchedulerAttributes as FormatedRequestSchedulerAttributes } from '../../../../../../shared'
2
1export interface Request { 3export interface Request {
2 request: any 4 request: any
3 to: any 5 to: any
4} 6}
5 7
6export class RequestStats { 8export class RequestSchedulerStatsAttributes implements FormatedRequestSchedulerAttributes {
7 requestsLimitPods: number 9 requestsLimitPods: number
8 requestsLimitPerPod: number 10 requestsLimitPerPod: number
9 milliSecondsInterval: number 11 milliSecondsInterval: number
diff --git a/client/src/app/+admin/requests/shared/request.service.ts b/client/src/app/+admin/requests/shared/request.service.ts
index faa6b9383..53682b111 100644
--- a/client/src/app/+admin/requests/shared/request.service.ts
+++ b/client/src/app/+admin/requests/shared/request.service.ts
@@ -3,8 +3,9 @@ import { 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 { RequestScheduler } from '../../../../../../shared'
7import { AuthHttp, RestExtractor } from '../../../shared' 7import { AuthHttp, RestExtractor } from '../../../shared'
8import { RequestSchedulerStatsAttributes } from './request-stats-attributes.model'
8 9
9@Injectable() 10@Injectable()
10export class RequestService { 11export class RequestService {
@@ -15,18 +16,18 @@ export class RequestService {
15 private restExtractor: RestExtractor 16 private restExtractor: RestExtractor
16 ) {} 17 ) {}
17 18
18 getStats (): Observable<{ [ id: string ]: RequestStats }> { 19 getStats (): Observable<RequestScheduler> {
19 return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats') 20 return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats')
20 .map(this.restExtractor.extractDataGet) 21 .map(this.restExtractor.extractDataGet)
21 .map(this.buildRequestObjects) 22 .map(this.buildRequestObjects)
22 .catch((res) => this.restExtractor.handleError(res)) 23 .catch((res) => this.restExtractor.handleError(res))
23 } 24 }
24 25
25 private buildRequestObjects (data: any) { 26 private buildRequestObjects (data: RequestScheduler) {
26 const requestSchedulers = {} 27 const requestSchedulers = {}
27 28
28 Object.keys(data).forEach(requestSchedulerName => { 29 Object.keys(data).forEach(requestSchedulerName => {
29 requestSchedulers[requestSchedulerName] = new RequestStats(data[requestSchedulerName]) 30 requestSchedulers[requestSchedulerName] = new RequestSchedulerStatsAttributes(data[requestSchedulerName])
30 }) 31 })
31 32
32 return requestSchedulers 33 return requestSchedulers
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 60eaebb44..7c838fbf0 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
@@ -2,7 +2,8 @@ import { 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 } from '../../../shared'
6import { VideoAbuse } from '../../../../../shared'
6 7
7@Component({ 8@Component({
8 selector: 'my-video-abuse-list', 9 selector: 'my-video-abuse-list',
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 32f7a5503..fcc6b9bb6 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -11,6 +11,7 @@ import { NotificationsService } from 'angular2-notifications'
11 11
12import { AuthStatus } from './auth-status.model' 12import { AuthStatus } from './auth-status.model'
13import { AuthUser } from './auth-user.model' 13import { AuthUser } from './auth-user.model'
14import { ClientLocal } from '../../../../../shared'
14// Do not use the barrel (dependency loop) 15// Do not use the barrel (dependency loop)
15import { RestExtractor } from '../../shared/rest' 16import { RestExtractor } from '../../shared/rest'
16 17
@@ -40,9 +41,9 @@ export class AuthService {
40 // FIXME: save in local storage? 41 // FIXME: save in local storage?
41 this.http.get(AuthService.BASE_CLIENT_URL) 42 this.http.get(AuthService.BASE_CLIENT_URL)
42 .map(this.restExtractor.extractDataGet) 43 .map(this.restExtractor.extractDataGet)
43 .catch((res) => this.restExtractor.handleError(res)) 44 .catch(res => this.restExtractor.handleError(res))
44 .subscribe( 45 .subscribe(
45 result => { 46 (result: ClientLocal) => {
46 this.clientId = result.client_id 47 this.clientId = result.client_id
47 this.clientSecret = result.client_secret 48 this.clientSecret = result.client_secret
48 console.log('Client credentials loaded.') 49 console.log('Client credentials loaded.')
diff --git a/client/src/app/core/config/config.service.ts b/client/src/app/core/config/config.service.ts
index a83ec61d2..b8cb15e84 100644
--- a/client/src/app/core/config/config.service.ts
+++ b/client/src/app/core/config/config.service.ts
@@ -2,16 +2,13 @@ import { Injectable } from '@angular/core'
2import { Http } from '@angular/http' 2import { Http } from '@angular/http'
3 3
4import { RestExtractor } from '../../shared/rest' 4import { RestExtractor } from '../../shared/rest'
5import { ServerConfig } from '../../../../../shared'
5 6
6@Injectable() 7@Injectable()
7export class ConfigService { 8export class ConfigService {
8 private static BASE_CONFIG_URL = API_URL + '/api/v1/config/' 9 private static BASE_CONFIG_URL = API_URL + '/api/v1/config/'
9 10
10 private config: { 11 private config: ServerConfig = {
11 signup: {
12 enabled: boolean
13 }
14 } = {
15 signup: { 12 signup: {
16 enabled: false 13 enabled: false
17 } 14 }
diff --git a/client/src/app/shared/video-abuse/video-abuse.model.ts b/client/src/app/shared/video-abuse/video-abuse.model.ts
deleted file mode 100644
index 49c87d6b8..000000000
--- a/client/src/app/shared/video-abuse/video-abuse.model.ts
+++ /dev/null
@@ -1,8 +0,0 @@
1export interface VideoAbuse {
2 id: string
3 reason: string
4 reporterPodHost: string
5 reporterUsername: string
6 videoId: string
7 createdAt: Date
8}
diff --git a/client/src/app/shared/video-abuse/video-abuse.service.ts b/client/src/app/shared/video-abuse/video-abuse.service.ts
index 4317f9353..32f13b430 100644
--- a/client/src/app/shared/video-abuse/video-abuse.service.ts
+++ b/client/src/app/shared/video-abuse/video-abuse.service.ts
@@ -7,7 +7,7 @@ import 'rxjs/add/operator/map'
7import { AuthService } from '../core' 7import { AuthService } from '../core'
8import { AuthHttp } from '../auth' 8import { AuthHttp } from '../auth'
9import { RestDataSource, RestExtractor, ResultList } from '../rest' 9import { RestDataSource, RestExtractor, ResultList } from '../rest'
10import { VideoAbuse } from './video-abuse.model' 10import { VideoAbuse } from '../../../../../shared'
11 11
12@Injectable() 12@Injectable()
13export class VideoAbuseService { 13export class VideoAbuseService {
diff --git a/client/src/app/videos/shared/rate-type.type.ts b/client/src/app/videos/shared/rate-type.type.ts
deleted file mode 100644
index 20eea3ae5..000000000
--- a/client/src/app/videos/shared/rate-type.type.ts
+++ /dev/null
@@ -1 +0,0 @@
1export type RateType = 'like' | 'dislike'
diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts
index a4e3d16df..977b82118 100644
--- a/client/src/app/videos/shared/video.service.ts
+++ b/client/src/app/videos/shared/video.service.ts
@@ -6,7 +6,6 @@ import 'rxjs/add/operator/map'
6 6
7import { Search } from '../../shared' 7import { Search } from '../../shared'
8import { SortField } from './sort-field.type' 8import { SortField } from './sort-field.type'
9import { RateType } from './rate-type.type'
10import { AuthService } from '../../core' 9import { AuthService } from '../../core'
11import { 10import {
12 AuthHttp, 11 AuthHttp,
@@ -17,6 +16,7 @@ import {
17 UserService 16 UserService
18} from '../../shared' 17} from '../../shared'
19import { Video } from './video.model' 18import { Video } from './video.model'
19import { VideoRateType } from '../../../../../shared'
20 20
21@Injectable() 21@Injectable()
22export class VideoService { 22export class VideoService {
@@ -145,7 +145,7 @@ export class VideoService {
145 return this.setVideoRate(id, 'dislike') 145 return this.setVideoRate(id, 'dislike')
146 } 146 }
147 147
148 getUserVideoRating (id: string) { 148 getUserVideoRating (id: string): Observable<VideoRateType> {
149 const url = UserService.BASE_USERS_URL + '/me/videos/' + id + '/rating' 149 const url = UserService.BASE_USERS_URL + '/me/videos/' + id + '/rating'
150 150
151 return this.authHttp.get(url) 151 return this.authHttp.get(url)
@@ -159,7 +159,7 @@ export class VideoService {
159 .catch((res) => this.restExtractor.handleError(res)) 159 .catch((res) => this.restExtractor.handleError(res))
160 } 160 }
161 161
162 private setVideoRate (id: string, rateType: RateType) { 162 private setVideoRate (id: string, rateType: VideoRateType) {
163 const url = VideoService.BASE_VIDEO_URL + id + '/rate' 163 const url = VideoService.BASE_VIDEO_URL + id + '/rate'
164 const body = { 164 const body = {
165 rating: rateType 165 rating: rateType
diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts
index 4a547f7e4..808e0eda9 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -11,15 +11,15 @@ import { AuthService, ConfirmService } from '../../core'
11import { VideoMagnetComponent } from './video-magnet.component' 11import { VideoMagnetComponent } from './video-magnet.component'
12import { VideoShareComponent } from './video-share.component' 12import { VideoShareComponent } from './video-share.component'
13import { VideoReportComponent } from './video-report.component' 13import { VideoReportComponent } from './video-report.component'
14import { RateType, Video, VideoService } from '../shared' 14import { Video, VideoService } from '../shared'
15import { WebTorrentService } from './webtorrent.service' 15import { WebTorrentService } from './webtorrent.service'
16import { UserVideoRateType, VideoRateType, UserVideoRate } from '../../../../../shared'
16 17
17@Component({ 18@Component({
18 selector: 'my-video-watch', 19 selector: 'my-video-watch',
19 templateUrl: './video-watch.component.html', 20 templateUrl: './video-watch.component.html',
20 styleUrls: [ './video-watch.component.scss' ] 21 styleUrls: [ './video-watch.component.scss' ]
21}) 22})
22
23export class VideoWatchComponent implements OnInit, OnDestroy { 23export class VideoWatchComponent implements OnInit, OnDestroy {
24 private static LOADTIME_TOO_LONG = 20000 24 private static LOADTIME_TOO_LONG = 20000
25 25
@@ -34,7 +34,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
34 player: videojs.Player 34 player: videojs.Player
35 playerElement: Element 35 playerElement: Element
36 uploadSpeed: number 36 uploadSpeed: number
37 userRating: RateType = null 37 userRating: UserVideoRateType = null
38 video: Video = null 38 video: Video = null
39 videoNotFound = false 39 videoNotFound = false
40 40
@@ -249,7 +249,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
249 249
250 this.videoService.getUserVideoRating(this.video.id) 250 this.videoService.getUserVideoRating(this.video.id)
251 .subscribe( 251 .subscribe(
252 ratingObject => { 252 (ratingObject: UserVideoRate) => {
253 if (ratingObject) { 253 if (ratingObject) {
254 this.userRating = ratingObject.rating 254 this.userRating = ratingObject.rating
255 } 255 }
@@ -282,7 +282,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
282 ) 282 )
283 } 283 }
284 284
285 private updateVideoRating (oldRating: RateType, newRating: RateType) { 285 private updateVideoRating (oldRating: UserVideoRateType, newRating: VideoRateType) {
286 let likesToIncrement = 0 286 let likesToIncrement = 0
287 let dislikesToIncrement = 0 287 let dislikesToIncrement = 0
288 288