aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/video')
-rw-r--r--client/src/app/shared/video/abstract-video-list.ts4
-rw-r--r--client/src/app/shared/video/video-miniature.component.scss1
-rw-r--r--client/src/app/shared/video/video-pagination.model.ts5
-rw-r--r--client/src/app/shared/video/video.service.ts25
4 files changed, 13 insertions, 22 deletions
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts
index 2b6870a78..bfe46bcdd 100644
--- a/client/src/app/shared/video/abstract-video-list.ts
+++ b/client/src/app/shared/video/abstract-video-list.ts
@@ -3,12 +3,12 @@ import { ActivatedRoute, Router } from '@angular/router'
3import { NotificationsService } from 'angular2-notifications' 3import { NotificationsService } from 'angular2-notifications'
4import { Observable } from 'rxjs/Observable' 4import { Observable } from 'rxjs/Observable'
5import { AuthService } from '../../core/auth' 5import { AuthService } from '../../core/auth'
6import { ComponentPagination } from '../rest/component-pagination.model'
6import { SortField } from './sort-field.type' 7import { SortField } from './sort-field.type'
7import { VideoPagination } from './video-pagination.model'
8import { Video } from './video.model' 8import { Video } from './video.model'
9 9
10export abstract class AbstractVideoList implements OnInit { 10export abstract class AbstractVideoList implements OnInit {
11 pagination: VideoPagination = { 11 pagination: ComponentPagination = {
12 currentPage: 1, 12 currentPage: 1,
13 itemsPerPage: 25, 13 itemsPerPage: 25,
14 totalItems: null 14 totalItems: null
diff --git a/client/src/app/shared/video/video-miniature.component.scss b/client/src/app/shared/video/video-miniature.component.scss
index 49ba1e51c..f0888ad9f 100644
--- a/client/src/app/shared/video/video-miniature.component.scss
+++ b/client/src/app/shared/video/video-miniature.component.scss
@@ -18,7 +18,6 @@
18 overflow: hidden; 18 overflow: hidden;
19 text-overflow: ellipsis; 19 text-overflow: ellipsis;
20 white-space: nowrap; 20 white-space: nowrap;
21 font-weight: bold;
22 transition: color 0.2s; 21 transition: color 0.2s;
23 font-size: 16px; 22 font-size: 16px;
24 font-weight: $font-semibold; 23 font-weight: $font-semibold;
diff --git a/client/src/app/shared/video/video-pagination.model.ts b/client/src/app/shared/video/video-pagination.model.ts
deleted file mode 100644
index e9db61596..000000000
--- a/client/src/app/shared/video/video-pagination.model.ts
+++ /dev/null
@@ -1,5 +0,0 @@
1export interface VideoPagination {
2 currentPage: number
3 itemsPerPage: number
4 totalItems?: number
5}
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 91dd3977a..fc7505a51 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -10,13 +10,13 @@ import { UserVideoRate } from '../../../../../shared/models/videos/user-video-ra
10import { VideoRateType } from '../../../../../shared/models/videos/video-rate.type' 10import { VideoRateType } from '../../../../../shared/models/videos/video-rate.type'
11import { VideoUpdate } from '../../../../../shared/models/videos/video-update.model' 11import { VideoUpdate } from '../../../../../shared/models/videos/video-update.model'
12import { environment } from '../../../environments/environment' 12import { environment } from '../../../environments/environment'
13import { ComponentPagination } from '../rest/component-pagination.model'
13import { RestExtractor } from '../rest/rest-extractor.service' 14import { RestExtractor } from '../rest/rest-extractor.service'
14import { RestService } from '../rest/rest.service' 15import { RestService } from '../rest/rest.service'
15import { UserService } from '../users/user.service' 16import { UserService } from '../users/user.service'
16import { SortField } from './sort-field.type' 17import { SortField } from './sort-field.type'
17import { VideoDetails } from './video-details.model' 18import { VideoDetails } from './video-details.model'
18import { VideoEdit } from './video-edit.model' 19import { VideoEdit } from './video-edit.model'
19import { VideoPagination } from './video-pagination.model'
20import { Video } from './video.model' 20import { Video } from './video.model'
21 21
22@Injectable() 22@Injectable()
@@ -71,8 +71,8 @@ export class VideoService {
71 .catch(this.restExtractor.handleError) 71 .catch(this.restExtractor.handleError)
72 } 72 }
73 73
74 getMyVideos (videoPagination: VideoPagination, sort: SortField): Observable<{ videos: Video[], totalVideos: number}> { 74 getMyVideos (videoPagination: ComponentPagination, sort: SortField): Observable<{ videos: Video[], totalVideos: number}> {
75 const pagination = this.videoPaginationToRestPagination(videoPagination) 75 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
76 76
77 let params = new HttpParams() 77 let params = new HttpParams()
78 params = this.restService.addRestGetParams(params, pagination, sort) 78 params = this.restService.addRestGetParams(params, pagination, sort)
@@ -82,8 +82,8 @@ export class VideoService {
82 .catch((res) => this.restExtractor.handleError(res)) 82 .catch((res) => this.restExtractor.handleError(res))
83 } 83 }
84 84
85 getVideos (videoPagination: VideoPagination, sort: SortField): Observable<{ videos: Video[], totalVideos: number}> { 85 getVideos (videoPagination: ComponentPagination, sort: SortField): Observable<{ videos: Video[], totalVideos: number}> {
86 const pagination = this.videoPaginationToRestPagination(videoPagination) 86 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
87 87
88 let params = new HttpParams() 88 let params = new HttpParams()
89 params = this.restService.addRestGetParams(params, pagination, sort) 89 params = this.restService.addRestGetParams(params, pagination, sort)
@@ -94,10 +94,14 @@ export class VideoService {
94 .catch((res) => this.restExtractor.handleError(res)) 94 .catch((res) => this.restExtractor.handleError(res))
95 } 95 }
96 96
97 searchVideos (search: string, videoPagination: VideoPagination, sort: SortField): Observable<{ videos: Video[], totalVideos: number}> { 97 searchVideos (
98 search: string,
99 videoPagination: ComponentPagination,
100 sort: SortField
101 ): Observable<{ videos: Video[], totalVideos: number}> {
98 const url = VideoService.BASE_VIDEO_URL + 'search' 102 const url = VideoService.BASE_VIDEO_URL + 'search'
99 103
100 const pagination = this.videoPaginationToRestPagination(videoPagination) 104 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
101 105
102 let params = new HttpParams() 106 let params = new HttpParams()
103 params = this.restService.addRestGetParams(params, pagination, sort) 107 params = this.restService.addRestGetParams(params, pagination, sort)
@@ -139,13 +143,6 @@ export class VideoService {
139 .catch(res => this.restExtractor.handleError(res)) 143 .catch(res => this.restExtractor.handleError(res))
140 } 144 }
141 145
142 private videoPaginationToRestPagination (videoPagination: VideoPagination) {
143 const start: number = (videoPagination.currentPage - 1) * videoPagination.itemsPerPage
144 const count: number = videoPagination.itemsPerPage
145
146 return { start, count }
147 }
148
149 private setVideoRate (id: number, rateType: VideoRateType) { 146 private setVideoRate (id: number, rateType: VideoRateType) {
150 const url = VideoService.BASE_VIDEO_URL + id + '/rate' 147 const url = VideoService.BASE_VIDEO_URL + id + '/rate'
151 const body: UserVideoRateUpdate = { 148 const body: UserVideoRateUpdate = {