aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/video-list/index.ts2
-rw-r--r--client/src/app/videos/video-list/video-search.component.ts77
-rw-r--r--client/src/app/videos/videos-routing.module.ts12
-rw-r--r--client/src/app/videos/videos.module.ts4
4 files changed, 3 insertions, 92 deletions
diff --git a/client/src/app/videos/video-list/index.ts b/client/src/app/videos/video-list/index.ts
index 5e7c7886c..5f7c8bd48 100644
--- a/client/src/app/videos/video-list/index.ts
+++ b/client/src/app/videos/video-list/index.ts
@@ -1,3 +1,3 @@
1export * from './video-local.component'
1export * from './video-recently-added.component' 2export * from './video-recently-added.component'
2export * from './video-trending.component' 3export * from './video-trending.component'
3export * from './video-search.component'
diff --git a/client/src/app/videos/video-list/video-search.component.ts b/client/src/app/videos/video-list/video-search.component.ts
deleted file mode 100644
index 33ed3f00e..000000000
--- a/client/src/app/videos/video-list/video-search.component.ts
+++ /dev/null
@@ -1,77 +0,0 @@
1import { Component, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router'
3import { Location } from '@angular/common'
4import { RedirectService } from '@app/core'
5import { immutableAssign } from '@app/shared/misc/utils'
6import { NotificationsService } from 'angular2-notifications'
7import { Subscription } from 'rxjs'
8import { AuthService } from '../../core/auth'
9import { AbstractVideoList } from '../../shared/video/abstract-video-list'
10import { VideoService } from '../../shared/video/video.service'
11import { I18n } from '@ngx-translate/i18n-polyfill'
12import { ScreenService } from '@app/shared/misc/screen.service'
13
14@Component({
15 selector: 'my-videos-search',
16 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
17 templateUrl: '../../shared/video/abstract-video-list.html'
18})
19export class VideoSearchComponent extends AbstractVideoList implements OnInit, OnDestroy {
20 titlePage: string
21 currentRoute = '/videos/search'
22 loadOnInit = false
23
24 protected otherRouteParams = {
25 search: ''
26 }
27 private subActivatedRoute: Subscription
28
29 constructor (
30 protected router: Router,
31 protected route: ActivatedRoute,
32 protected notificationsService: NotificationsService,
33 protected authService: AuthService,
34 protected location: Location,
35 protected i18n: I18n,
36 protected screenService: ScreenService,
37 private videoService: VideoService,
38 private redirectService: RedirectService
39 ) {
40 super()
41
42 this.titlePage = i18n('Search')
43 }
44
45 ngOnInit () {
46 super.ngOnInit()
47
48 this.subActivatedRoute = this.route.queryParams.subscribe(
49 queryParams => {
50 const querySearch = queryParams['search']
51
52 if (!querySearch) return this.redirectService.redirectToHomepage()
53 if (this.otherRouteParams.search === querySearch) return
54
55 this.otherRouteParams.search = querySearch
56 this.reloadVideos()
57 },
58
59 err => this.notificationsService.error('Error', err.text)
60 )
61 }
62
63 ngOnDestroy () {
64 super.ngOnDestroy()
65
66 if (this.subActivatedRoute) this.subActivatedRoute.unsubscribe()
67 }
68
69 getVideosObservable (page: number) {
70 const newPagination = immutableAssign(this.pagination, { currentPage: page })
71 return this.videoService.searchVideos(this.otherRouteParams.search, newPagination, this.sort)
72 }
73
74 generateSyndicationList () {
75 throw new Error('Search does not support syndication.')
76 }
77}
diff --git a/client/src/app/videos/videos-routing.module.ts b/client/src/app/videos/videos-routing.module.ts
index da786c0f9..538a43c6d 100644
--- a/client/src/app/videos/videos-routing.module.ts
+++ b/client/src/app/videos/videos-routing.module.ts
@@ -1,8 +1,7 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { RouterModule, Routes, UrlSegment } from '@angular/router' 2import { RouterModule, Routes } from '@angular/router'
3import { VideoLocalComponent } from '@app/videos/video-list/video-local.component' 3import { VideoLocalComponent } from '@app/videos/video-list/video-local.component'
4import { MetaGuard } from '@ngx-meta/core' 4import { MetaGuard } from '@ngx-meta/core'
5import { VideoSearchComponent } from './video-list'
6import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' 5import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component'
7import { VideoTrendingComponent } from './video-list/video-trending.component' 6import { VideoTrendingComponent } from './video-list/video-trending.component'
8import { VideosComponent } from './videos.component' 7import { VideosComponent } from './videos.component'
@@ -46,15 +45,6 @@ const videosRoutes: Routes = [
46 } 45 }
47 }, 46 },
48 { 47 {
49 path: 'search',
50 component: VideoSearchComponent,
51 data: {
52 meta: {
53 title: 'Search videos'
54 }
55 }
56 },
57 {
58 path: 'upload', 48 path: 'upload',
59 loadChildren: 'app/videos/+video-edit/video-add.module#VideoAddModule', 49 loadChildren: 'app/videos/+video-edit/video-add.module#VideoAddModule',
60 data: { 50 data: {
diff --git a/client/src/app/videos/videos.module.ts b/client/src/app/videos/videos.module.ts
index 7c3d457b3..c38257e08 100644
--- a/client/src/app/videos/videos.module.ts
+++ b/client/src/app/videos/videos.module.ts
@@ -1,7 +1,6 @@
1import { NgModule } from '@angular/core' 1import { NgModule } from '@angular/core'
2import { VideoLocalComponent } from '@app/videos/video-list/video-local.component' 2import { VideoLocalComponent } from '@app/videos/video-list/video-local.component'
3import { SharedModule } from '../shared' 3import { SharedModule } from '../shared'
4import { VideoSearchComponent } from './video-list'
5import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component' 4import { VideoRecentlyAddedComponent } from './video-list/video-recently-added.component'
6import { VideoTrendingComponent } from './video-list/video-trending.component' 5import { VideoTrendingComponent } from './video-list/video-trending.component'
7import { VideosRoutingModule } from './videos-routing.module' 6import { VideosRoutingModule } from './videos-routing.module'
@@ -18,8 +17,7 @@ import { VideosComponent } from './videos.component'
18 17
19 VideoTrendingComponent, 18 VideoTrendingComponent,
20 VideoRecentlyAddedComponent, 19 VideoRecentlyAddedComponent,
21 VideoLocalComponent, 20 VideoLocalComponent
22 VideoSearchComponent
23 ], 21 ],
24 22
25 exports: [ 23 exports: [