aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/menu/menu.component.html5
-rw-r--r--client/src/app/menu/menu.component.scss8
-rw-r--r--client/src/app/shared/video/video.service.ts11
-rw-r--r--client/src/app/videos/video-list/video-local.component.ts37
-rw-r--r--client/src/app/videos/videos-routing.module.ts10
-rw-r--r--client/src/app/videos/videos.module.ts2
6 files changed, 72 insertions, 1 deletions
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html
index d174c76ba..d827a4dd4 100644
--- a/client/src/app/menu/menu.component.html
+++ b/client/src/app/menu/menu.component.html
@@ -43,6 +43,11 @@
43 <span class="icon icon-videos-recently-added"></span> 43 <span class="icon icon-videos-recently-added"></span>
44 Recently added 44 Recently added
45 </a> 45 </a>
46
47 <a routerLink="/videos/local" routerLinkActive="active">
48 <span class="icon icon-videos-local"></span>
49 Local
50 </a>
46 </div> 51 </div>
47 52
48 <div class="panel-block"> 53 <div class="panel-block">
diff --git a/client/src/app/menu/menu.component.scss b/client/src/app/menu/menu.component.scss
index 1f3c889cf..da5a581a1 100644
--- a/client/src/app/menu/menu.component.scss
+++ b/client/src/app/menu/menu.component.scss
@@ -126,6 +126,14 @@ menu {
126 background-image: url('../../assets/images/menu/recently-added.svg'); 126 background-image: url('../../assets/images/menu/recently-added.svg');
127 } 127 }
128 128
129 &.icon-videos-local {
130 width: 23px;
131 height: 23px;
132 position: relative;
133 top: -1px;
134 background-image: url('../../assets/images/menu/home.svg');
135 }
136
129 &.icon-administration { 137 &.icon-administration {
130 width: 23px; 138 width: 23px;
131 height: 23px; 139 height: 23px;
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index a151a2983..0a8894fd9 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -7,6 +7,7 @@ import { Video as VideoServerModel, VideoDetails as VideoDetailsServerModel } fr
7import { ResultList } from '../../../../../shared/models/result-list.model' 7import { ResultList } from '../../../../../shared/models/result-list.model'
8import { UserVideoRateUpdate } from '../../../../../shared/models/videos/user-video-rate-update.model' 8import { UserVideoRateUpdate } from '../../../../../shared/models/videos/user-video-rate-update.model'
9import { UserVideoRate } from '../../../../../shared/models/videos/user-video-rate.model' 9import { UserVideoRate } from '../../../../../shared/models/videos/user-video-rate.model'
10import { VideoFilter } from '../../../../../shared/models/videos/video-query.type'
10import { VideoRateType } from '../../../../../shared/models/videos/video-rate.type' 11import { VideoRateType } from '../../../../../shared/models/videos/video-rate.type'
11import { VideoUpdate } from '../../../../../shared/models/videos/video-update.model' 12import { VideoUpdate } from '../../../../../shared/models/videos/video-update.model'
12import { environment } from '../../../environments/environment' 13import { environment } from '../../../environments/environment'
@@ -94,12 +95,20 @@ export class VideoService {
94 .catch((res) => this.restExtractor.handleError(res)) 95 .catch((res) => this.restExtractor.handleError(res))
95 } 96 }
96 97
97 getVideos (videoPagination: ComponentPagination, sort: SortField): Observable<{ videos: Video[], totalVideos: number}> { 98 getVideos (
99 videoPagination: ComponentPagination,
100 sort: SortField,
101 filter?: VideoFilter
102 ): Observable<{ videos: Video[], totalVideos: number}> {
98 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 103 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
99 104
100 let params = new HttpParams() 105 let params = new HttpParams()
101 params = this.restService.addRestGetParams(params, pagination, sort) 106 params = this.restService.addRestGetParams(params, pagination, sort)
102 107
108 if (filter) {
109 params = params.set('filter', filter)
110 }
111
103 return this.authHttp 112 return this.authHttp
104 .get(VideoService.BASE_VIDEO_URL, { params }) 113 .get(VideoService.BASE_VIDEO_URL, { params })
105 .map(this.extractVideos) 114 .map(this.extractVideos)
diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts
new file mode 100644
index 000000000..8cac2c12c
--- /dev/null
+++ b/client/src/app/videos/video-list/video-local.component.ts
@@ -0,0 +1,37 @@
1import { Component, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils'
4import { NotificationsService } from 'angular2-notifications'
5import { AuthService } from '../../core/auth'
6import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7import { SortField } from '../../shared/video/sort-field.type'
8import { VideoService } from '../../shared/video/video.service'
9
10@Component({
11 selector: 'my-videos-local',
12 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
13 templateUrl: '../../shared/video/abstract-video-list.html'
14})
15export class VideoLocalComponent extends AbstractVideoList implements OnInit {
16 titlePage = 'Local videos'
17 currentRoute = '/videos/local'
18 sort = '-createdAt' as SortField
19
20 constructor (protected router: Router,
21 protected route: ActivatedRoute,
22 protected notificationsService: NotificationsService,
23 protected authService: AuthService,
24 private videoService: VideoService) {
25 super()
26 }
27
28 ngOnInit () {
29 super.ngOnInit()
30 }
31
32 getVideosObservable (page: number) {
33 const newPagination = immutableAssign(this.pagination, { currentPage: page })
34
35 return this.videoService.getVideos(newPagination, this.sort, 'local')
36 }
37}
diff --git a/client/src/app/videos/videos-routing.module.ts b/client/src/app/videos/videos-routing.module.ts
index 29ec5fd4f..561137b70 100644
--- a/client/src/app/videos/videos-routing.module.ts
+++ b/client/src/app/videos/videos-routing.module.ts
@@ -1,5 +1,6 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { VideoLocalComponent } from '@app/videos/video-list/video-local.component'
3import { MetaGuard } from '@ngx-meta/core' 4import { MetaGuard } from '@ngx-meta/core'
4import { VideoSearchComponent } from './video-list' 5import { VideoSearchComponent } from './video-list'
5import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' 6import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component'
@@ -36,6 +37,15 @@ const videosRoutes: Routes = [
36 } 37 }
37 }, 38 },
38 { 39 {
40 path: 'local',
41 component: VideoLocalComponent,
42 data: {
43 meta: {
44 title: 'Local videos'
45 }
46 }
47 },
48 {
39 path: 'search', 49 path: 'search',
40 component: VideoSearchComponent, 50 component: VideoSearchComponent,
41 data: { 51 data: {
diff --git a/client/src/app/videos/videos.module.ts b/client/src/app/videos/videos.module.ts
index 4b14d1da8..7c3d457b3 100644
--- a/client/src/app/videos/videos.module.ts
+++ b/client/src/app/videos/videos.module.ts
@@ -1,4 +1,5 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { VideoLocalComponent } from '@app/videos/video-list/video-local.component'
2import { SharedModule } from '../shared' 3import { SharedModule } from '../shared'
3import { VideoSearchComponent } from './video-list' 4import { VideoSearchComponent } from './video-list'
4import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' 5import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component'
@@ -17,6 +18,7 @@ import { VideosComponent } from './videos.component'
17 18
18 VideoTrendingComponent, 19 VideoTrendingComponent,
19 VideoRecentlyAddedComponent, 20 VideoRecentlyAddedComponent,
21 VideoLocalComponent,
20 VideoSearchComponent 22 VideoSearchComponent
21 ], 23 ],
22 24