aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/search/search.component.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts
index d3c0761d7..7ab0ed9d6 100644
--- a/client/src/app/search/search.component.ts
+++ b/client/src/app/search/search.component.ts
@@ -13,6 +13,7 @@ import { MetaService } from '@ngx-meta/core'
13import { I18n } from '@ngx-translate/i18n-polyfill' 13import { I18n } from '@ngx-translate/i18n-polyfill'
14import { ServerConfig } from '@shared/models' 14import { ServerConfig } from '@shared/models'
15import { UserService } from '@app/shared' 15import { UserService } from '@app/shared'
16import { SearchTargetType } from '@shared/models/search/search-target-query.model'
16 17
17@Component({ 18@Component({
18 selector: 'my-search', 19 selector: 'my-search',
@@ -40,6 +41,8 @@ export class SearchComponent implements OnInit, OnDestroy {
40 41
41 private channelsPerPage = 2 42 private channelsPerPage = 2
42 43
44 private lastSearchTarget: SearchTargetType
45
43 constructor ( 46 constructor (
44 private i18n: I18n, 47 private i18n: I18n,
45 private route: ActivatedRoute, 48 private route: ActivatedRoute,
@@ -63,9 +66,10 @@ export class SearchComponent implements OnInit, OnDestroy {
63 this.subActivatedRoute = this.route.queryParams.subscribe( 66 this.subActivatedRoute = this.route.queryParams.subscribe(
64 async queryParams => { 67 async queryParams => {
65 const querySearch = queryParams['search'] 68 const querySearch = queryParams['search']
69 const searchTarget = queryParams['searchTarget']
66 70
67 // Search updated, reset filters 71 // Search updated, reset filters
68 if (this.currentSearch !== querySearch) { 72 if (this.currentSearch !== querySearch || searchTarget !== this.advancedSearch.searchTarget) {
69 this.resetPagination() 73 this.resetPagination()
70 this.advancedSearch.reset() 74 this.advancedSearch.reset()
71 75
@@ -118,6 +122,7 @@ export class SearchComponent implements OnInit, OnDestroy {
118 .concat(videosResult.data) 122 .concat(videosResult.data)
119 123
120 this.pagination.totalItems = videosResult.total + videoChannelsResult.total 124 this.pagination.totalItems = videosResult.total + videoChannelsResult.total
125 this.lastSearchTarget = this.advancedSearch.searchTarget
121 126
122 // Focus on channels if there are no enough videos 127 // Focus on channels if there are no enough videos
123 if (this.firstSearch === true && videosResult.data.length < this.pagination.itemsPerPage) { 128 if (this.firstSearch === true && videosResult.data.length < this.pagination.itemsPerPage) {
@@ -182,7 +187,7 @@ export class SearchComponent implements OnInit, OnDestroy {
182 } 187 }
183 188
184 hideActions () { 189 hideActions () {
185 return this.advancedSearch.searchTarget === 'search-index' 190 return this.lastSearchTarget === 'search-index'
186 } 191 }
187 192
188 private resetPagination () { 193 private resetPagination () {