diff options
Diffstat (limited to 'client/src/app/+search/search.component.ts')
-rw-r--r-- | client/src/app/+search/search.component.ts | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.ts index fcf6ebbec..b9ec6dbcc 100644 --- a/client/src/app/+search/search.component.ts +++ b/client/src/app/+search/search.component.ts | |||
@@ -47,10 +47,6 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
47 | private subActivatedRoute: Subscription | 47 | private subActivatedRoute: Subscription |
48 | private isInitialLoad = false // set to false to show the search filters on first arrival | 48 | private isInitialLoad = false // set to false to show the search filters on first arrival |
49 | 49 | ||
50 | private channelsPerPage = 2 | ||
51 | private playlistsPerPage = 2 | ||
52 | private videosPerPage = 10 | ||
53 | |||
54 | private hasMoreResults = true | 50 | private hasMoreResults = true |
55 | private isSearching = false | 51 | private isSearching = false |
56 | 52 | ||
@@ -247,7 +243,6 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
247 | private resetPagination () { | 243 | private resetPagination () { |
248 | this.pagination.currentPage = 1 | 244 | this.pagination.currentPage = 1 |
249 | this.pagination.totalItems = null | 245 | this.pagination.totalItems = null |
250 | this.channelsPerPage = 2 | ||
251 | 246 | ||
252 | this.results = [] | 247 | this.results = [] |
253 | } | 248 | } |
@@ -272,7 +267,7 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
272 | private getVideosObs () { | 267 | private getVideosObs () { |
273 | const params = { | 268 | const params = { |
274 | search: this.currentSearch, | 269 | search: this.currentSearch, |
275 | componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.videosPerPage }), | 270 | componentPagination: immutableAssign(this.pagination, { itemsPerPage: 10 }), |
276 | advancedSearch: this.advancedSearch | 271 | advancedSearch: this.advancedSearch |
277 | } | 272 | } |
278 | 273 | ||
@@ -288,7 +283,7 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
288 | private getVideoChannelObs () { | 283 | private getVideoChannelObs () { |
289 | const params = { | 284 | const params = { |
290 | search: this.currentSearch, | 285 | search: this.currentSearch, |
291 | componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.channelsPerPage }), | 286 | componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.buildChannelsPerPage() }), |
292 | advancedSearch: this.advancedSearch | 287 | advancedSearch: this.advancedSearch |
293 | } | 288 | } |
294 | 289 | ||
@@ -304,7 +299,7 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
304 | private getVideoPlaylistObs () { | 299 | private getVideoPlaylistObs () { |
305 | const params = { | 300 | const params = { |
306 | search: this.currentSearch, | 301 | search: this.currentSearch, |
307 | componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.playlistsPerPage }), | 302 | componentPagination: immutableAssign(this.pagination, { itemsPerPage: this.buildPlaylistsPerPage() }), |
308 | advancedSearch: this.advancedSearch | 303 | advancedSearch: this.advancedSearch |
309 | } | 304 | } |
310 | 305 | ||
@@ -334,4 +329,16 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
334 | 329 | ||
335 | return undefined | 330 | return undefined |
336 | } | 331 | } |
332 | |||
333 | private buildChannelsPerPage () { | ||
334 | if (this.advancedSearch.resultType === 'channels') return 10 | ||
335 | |||
336 | return 2 | ||
337 | } | ||
338 | |||
339 | private buildPlaylistsPerPage () { | ||
340 | if (this.advancedSearch.resultType === 'playlists') return 10 | ||
341 | |||
342 | return 2 | ||
343 | } | ||
337 | } | 344 | } |