aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-15 11:55:51 +0200
committerChocobozzz <me@florianbigard.com>2018-05-16 09:42:54 +0200
commitdb400f447a9f7aae1c56fa25396e93069744483f (patch)
treef45af832a5d3f4eebafd2f885b7413d9f84fa374 /client/src/app/+admin
parent54c3a22faa04bf13eea37f39be9149fc5eb95737 (diff)
downloadPeerTube-db400f447a9f7aae1c56fa25396e93069744483f.tar.gz
PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.tar.zst
PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.zip
Upgrade to rxjs 6
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/config/shared/config.service.ts5
-rw-r--r--client/src/app/+admin/follows/shared/follow.service.ts34
-rw-r--r--client/src/app/+admin/jobs/shared/job.service.ts13
-rw-r--r--client/src/app/+admin/users/shared/user.service.ts31
-rw-r--r--client/src/app/+admin/users/user-edit/user-update.component.ts13
5 files changed, 53 insertions, 43 deletions
diff --git a/client/src/app/+admin/config/shared/config.service.ts b/client/src/app/+admin/config/shared/config.service.ts
index 2a39c7155..1565774b3 100644
--- a/client/src/app/+admin/config/shared/config.service.ts
+++ b/client/src/app/+admin/config/shared/config.service.ts
@@ -1,3 +1,4 @@
1import { catchError } from 'rxjs/operators'
1import { HttpClient } from '@angular/common/http' 2import { HttpClient } from '@angular/common/http'
2import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
3import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' 4import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model'
@@ -16,11 +17,11 @@ export class ConfigService {
16 17
17 getCustomConfig () { 18 getCustomConfig () {
18 return this.authHttp.get<CustomConfig>(ConfigService.BASE_APPLICATION_URL + '/custom') 19 return this.authHttp.get<CustomConfig>(ConfigService.BASE_APPLICATION_URL + '/custom')
19 .catch(res => this.restExtractor.handleError(res)) 20 .pipe(catchError(res => this.restExtractor.handleError(res)))
20 } 21 }
21 22
22 updateCustomConfig (data: CustomConfig) { 23 updateCustomConfig (data: CustomConfig) {
23 return this.authHttp.put<CustomConfig>(ConfigService.BASE_APPLICATION_URL + '/custom', data) 24 return this.authHttp.put<CustomConfig>(ConfigService.BASE_APPLICATION_URL + '/custom', data)
24 .catch(res => this.restExtractor.handleError(res)) 25 .pipe(catchError(res => this.restExtractor.handleError(res)))
25 } 26 }
26} 27}
diff --git a/client/src/app/+admin/follows/shared/follow.service.ts b/client/src/app/+admin/follows/shared/follow.service.ts
index 089be9d64..5897e64ca 100644
--- a/client/src/app/+admin/follows/shared/follow.service.ts
+++ b/client/src/app/+admin/follows/shared/follow.service.ts
@@ -1,9 +1,8 @@
1import { catchError, map } from 'rxjs/operators'
1import { HttpClient, HttpParams } from '@angular/common/http' 2import { HttpClient, HttpParams } from '@angular/common/http'
2import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
3import { SortMeta } from 'primeng/primeng' 4import { SortMeta } from 'primeng/primeng'
4import 'rxjs/add/operator/catch' 5import { Observable } from 'rxjs'
5import 'rxjs/add/operator/map'
6import { Observable } from 'rxjs/Observable'
7import { AccountFollow, ResultList } from '../../../../../../shared' 6import { AccountFollow, ResultList } from '../../../../../../shared'
8import { environment } from '../../../../environments/environment' 7import { environment } from '../../../../environments/environment'
9import { RestExtractor, RestPagination, RestService } from '../../../shared' 8import { RestExtractor, RestPagination, RestService } from '../../../shared'
@@ -16,24 +15,29 @@ export class FollowService {
16 private authHttp: HttpClient, 15 private authHttp: HttpClient,
17 private restService: RestService, 16 private restService: RestService,
18 private restExtractor: RestExtractor 17 private restExtractor: RestExtractor
19 ) {} 18 ) {
19 }
20 20
21 getFollowing (pagination: RestPagination, sort: SortMeta): Observable<ResultList<AccountFollow>> { 21 getFollowing (pagination: RestPagination, sort: SortMeta): Observable<ResultList<AccountFollow>> {
22 let params = new HttpParams() 22 let params = new HttpParams()
23 params = this.restService.addRestGetParams(params, pagination, sort) 23 params = this.restService.addRestGetParams(params, pagination, sort)
24 24
25 return this.authHttp.get<ResultList<Account>>(FollowService.BASE_APPLICATION_URL + '/following', { params }) 25 return this.authHttp.get<ResultList<Account>>(FollowService.BASE_APPLICATION_URL + '/following', { params })
26 .map(res => this.restExtractor.convertResultListDateToHuman(res)) 26 .pipe(
27 .catch(res => this.restExtractor.handleError(res)) 27 map(res => this.restExtractor.convertResultListDateToHuman(res)),
28 catchError(res => this.restExtractor.handleError(res))
29 )
28 } 30 }
29 31
30 getFollowers (pagination: RestPagination, sort: SortMeta): Observable<ResultList<AccountFollow>> { 32 getFollowers (pagination: RestPagination, sort: SortMeta): Observable<ResultList<AccountFollow>> {
31 let params = new HttpParams() 33 let params = new HttpParams()
32 params = this.restService.addRestGetParams(params, pagination, sort) 34 params = this.restService.addRestGetParams(params, pagination, sort)
33 35
34 return this.authHttp.get<ResultList<Account>>(FollowService.BASE_APPLICATION_URL + '/followers', { params }) 36 return this.authHttp.get<ResultList<AccountFollow>>(FollowService.BASE_APPLICATION_URL + '/followers', { params })
35 .map(res => this.restExtractor.convertResultListDateToHuman(res)) 37 .pipe(
36 .catch(res => this.restExtractor.handleError(res)) 38 map(res => this.restExtractor.convertResultListDateToHuman(res)),
39 catchError(res => this.restExtractor.handleError(res))
40 )
37 } 41 }
38 42
39 follow (notEmptyHosts: string[]) { 43 follow (notEmptyHosts: string[]) {
@@ -42,13 +46,17 @@ export class FollowService {
42 } 46 }
43 47
44 return this.authHttp.post(FollowService.BASE_APPLICATION_URL + '/following', body) 48 return this.authHttp.post(FollowService.BASE_APPLICATION_URL + '/following', body)
45 .map(this.restExtractor.extractDataBool) 49 .pipe(
46 .catch(res => this.restExtractor.handleError(res)) 50 map(this.restExtractor.extractDataBool),
51 catchError(res => this.restExtractor.handleError(res))
52 )
47 } 53 }
48 54
49 unfollow (follow: AccountFollow) { 55 unfollow (follow: AccountFollow) {
50 return this.authHttp.delete(FollowService.BASE_APPLICATION_URL + '/following/' + follow.following.host) 56 return this.authHttp.delete(FollowService.BASE_APPLICATION_URL + '/following/' + follow.following.host)
51 .map(this.restExtractor.extractDataBool) 57 .pipe(
52 .catch(res => this.restExtractor.handleError(res)) 58 map(this.restExtractor.extractDataBool),
59 catchError(res => this.restExtractor.handleError(res))
60 )
53 } 61 }
54} 62}
diff --git a/client/src/app/+admin/jobs/shared/job.service.ts b/client/src/app/+admin/jobs/shared/job.service.ts
index 98f29b742..6441eaac1 100644
--- a/client/src/app/+admin/jobs/shared/job.service.ts
+++ b/client/src/app/+admin/jobs/shared/job.service.ts
@@ -1,9 +1,8 @@
1import { catchError, map } from 'rxjs/operators'
1import { HttpClient, HttpParams } from '@angular/common/http' 2import { HttpClient, HttpParams } from '@angular/common/http'
2import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
3import { SortMeta } from 'primeng/primeng' 4import { SortMeta } from 'primeng/primeng'
4import 'rxjs/add/operator/catch' 5import { Observable } from 'rxjs'
5import 'rxjs/add/operator/map'
6import { Observable } from 'rxjs/Observable'
7import { ResultList } from '../../../../../../shared' 6import { ResultList } from '../../../../../../shared'
8import { JobState } from '../../../../../../shared/models' 7import { JobState } from '../../../../../../shared/models'
9import { Job } from '../../../../../../shared/models/server/job.model' 8import { Job } from '../../../../../../shared/models/server/job.model'
@@ -25,9 +24,11 @@ export class JobService {
25 params = this.restService.addRestGetParams(params, pagination, sort) 24 params = this.restService.addRestGetParams(params, pagination, sort)
26 25
27 return this.authHttp.get<ResultList<Job>>(JobService.BASE_JOB_URL + '/' + state, { params }) 26 return this.authHttp.get<ResultList<Job>>(JobService.BASE_JOB_URL + '/' + state, { params })
28 .map(res => this.restExtractor.convertResultListDateToHuman(res, [ 'createdAt', 'updatedAt' ])) 27 .pipe(
29 .map(res => this.restExtractor.applyToResultListData(res, this.prettyPrintData)) 28 map(res => this.restExtractor.convertResultListDateToHuman(res, [ 'createdAt', 'updatedAt' ])),
30 .catch(err => this.restExtractor.handleError(err)) 29 map(res => this.restExtractor.applyToResultListData(res, this.prettyPrintData)),
30 catchError(err => this.restExtractor.handleError(err))
31 )
31 } 32 }
32 33
33 private prettyPrintData (obj: Job) { 34 private prettyPrintData (obj: Job) {
diff --git a/client/src/app/+admin/users/shared/user.service.ts b/client/src/app/+admin/users/shared/user.service.ts
index 6536546fb..578cd98c3 100644
--- a/client/src/app/+admin/users/shared/user.service.ts
+++ b/client/src/app/+admin/users/shared/user.service.ts
@@ -1,10 +1,9 @@
1import { catchError, map } from 'rxjs/operators'
1import { HttpClient, HttpParams } from '@angular/common/http' 2import { HttpClient, HttpParams } from '@angular/common/http'
2import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
3import { BytesPipe } from 'ngx-pipes' 4import { BytesPipe } from 'ngx-pipes'
4import { SortMeta } from 'primeng/components/common/sortmeta' 5import { SortMeta } from 'primeng/components/common/sortmeta'
5import 'rxjs/add/operator/catch' 6import { Observable } from 'rxjs'
6import 'rxjs/add/operator/map'
7import { Observable } from 'rxjs/Observable'
8import { ResultList, UserCreate, UserUpdate } from '../../../../../../shared' 7import { ResultList, UserCreate, UserUpdate } from '../../../../../../shared'
9import { environment } from '../../../../environments/environment' 8import { environment } from '../../../../environments/environment'
10import { RestExtractor, RestPagination, RestService, User } from '../../../shared' 9import { RestExtractor, RestPagination, RestService, User } from '../../../shared'
@@ -18,23 +17,28 @@ export class UserService {
18 private authHttp: HttpClient, 17 private authHttp: HttpClient,
19 private restService: RestService, 18 private restService: RestService,
20 private restExtractor: RestExtractor 19 private restExtractor: RestExtractor
21 ) {} 20 ) {
21 }
22 22
23 addUser (userCreate: UserCreate) { 23 addUser (userCreate: UserCreate) {
24 return this.authHttp.post(UserService.BASE_USERS_URL, userCreate) 24 return this.authHttp.post(UserService.BASE_USERS_URL, userCreate)
25 .map(this.restExtractor.extractDataBool) 25 .pipe(
26 .catch(err => this.restExtractor.handleError(err)) 26 map(this.restExtractor.extractDataBool),
27 catchError(err => this.restExtractor.handleError(err))
28 )
27 } 29 }
28 30
29 updateUser (userId: number, userUpdate: UserUpdate) { 31 updateUser (userId: number, userUpdate: UserUpdate) {
30 return this.authHttp.put(UserService.BASE_USERS_URL + userId, userUpdate) 32 return this.authHttp.put(UserService.BASE_USERS_URL + userId, userUpdate)
31 .map(this.restExtractor.extractDataBool) 33 .pipe(
32 .catch(err => this.restExtractor.handleError(err)) 34 map(this.restExtractor.extractDataBool),
35 catchError(err => this.restExtractor.handleError(err))
36 )
33 } 37 }
34 38
35 getUser (userId: number) { 39 getUser (userId: number) {
36 return this.authHttp.get<User>(UserService.BASE_USERS_URL + userId) 40 return this.authHttp.get<User>(UserService.BASE_USERS_URL + userId)
37 .catch(err => this.restExtractor.handleError(err)) 41 .pipe(catchError(err => this.restExtractor.handleError(err)))
38 } 42 }
39 43
40 getUsers (pagination: RestPagination, sort: SortMeta): Observable<ResultList<User>> { 44 getUsers (pagination: RestPagination, sort: SortMeta): Observable<ResultList<User>> {
@@ -42,13 +46,16 @@ export class UserService {
42 params = this.restService.addRestGetParams(params, pagination, sort) 46 params = this.restService.addRestGetParams(params, pagination, sort)
43 47
44 return this.authHttp.get<ResultList<User>>(UserService.BASE_USERS_URL, { params }) 48 return this.authHttp.get<ResultList<User>>(UserService.BASE_USERS_URL, { params })
45 .map(res => this.restExtractor.convertResultListDateToHuman(res)) 49 .pipe(
46 .map(res => this.restExtractor.applyToResultListData(res, this.formatUser.bind(this))) 50 map(res => this.restExtractor.convertResultListDateToHuman(res)),
47 .catch(err => this.restExtractor.handleError(err)) 51 map(res => this.restExtractor.applyToResultListData(res, this.formatUser.bind(this))),
52 catchError(err => this.restExtractor.handleError(err))
53 )
48 } 54 }
49 55
50 removeUser (user: User) { 56 removeUser (user: User) {
51 return this.authHttp.delete(UserService.BASE_USERS_URL + user.id) 57 return this.authHttp.delete(UserService.BASE_USERS_URL + user.id)
58 .pipe(catchError(err => this.restExtractor.handleError(err)))
52 } 59 }
53 60
54 private formatUser (user: User) { 61 private formatUser (user: User) {
diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts
index 23e44ac1f..3cde07c65 100644
--- a/client/src/app/+admin/users/user-edit/user-update.component.ts
+++ b/client/src/app/+admin/users/user-edit/user-update.component.ts
@@ -1,20 +1,13 @@
1import { Component, OnDestroy, OnInit } from '@angular/core' 1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { FormBuilder, FormGroup } from '@angular/forms' 2import { FormBuilder, FormGroup } from '@angular/forms'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { Subscription } from 'rxjs/Subscription' 4import { Subscription } from 'rxjs'
5
6import { NotificationsService } from 'angular2-notifications' 5import { NotificationsService } from 'angular2-notifications'
7
8import { UserService } from '../shared' 6import { UserService } from '../shared'
9import { 7import { User, USER_EMAIL, USER_ROLE, USER_VIDEO_QUOTA } from '../../../shared'
10 USER_EMAIL,
11 USER_VIDEO_QUOTA,
12 USER_ROLE,
13 User
14} from '../../../shared'
15import { ServerService } from '../../../core' 8import { ServerService } from '../../../core'
16import { UserEdit } from './user-edit' 9import { UserEdit } from './user-edit'
17import { UserUpdate, UserRole } from '../../../../../../shared' 10import { UserUpdate } from '../../../../../../shared'
18 11
19@Component({ 12@Component({
20 selector: 'my-user-update', 13 selector: 'my-user-update',