aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/search
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/search')
-rw-r--r--client/src/app/search/search.component.html2
-rw-r--r--client/src/app/search/search.component.ts14
2 files changed, 13 insertions, 3 deletions
diff --git a/client/src/app/search/search.component.html b/client/src/app/search/search.component.html
index 128cc52f5..83d014987 100644
--- a/client/src/app/search/search.component.html
+++ b/client/src/app/search/search.component.html
@@ -1,4 +1,4 @@
1<div myInfiniteScroller [autoLoading]="true" (nearOfBottom)="onNearOfBottom()" class="search-result"> 1<div myInfiniteScroller [autoInit]="true" (nearOfBottom)="onNearOfBottom()" class="search-result">
2 <div class="results-header"> 2 <div class="results-header">
3 <div class="first-line"> 3 <div class="first-line">
4 <div class="results-counter" *ngIf="pagination.totalItems"> 4 <div class="results-counter" *ngIf="pagination.totalItems">
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts
index f88df6391..ed84e24d9 100644
--- a/client/src/app/search/search.component.ts
+++ b/client/src/app/search/search.component.ts
@@ -87,9 +87,17 @@ export class SearchComponent implements OnInit, OnDestroy {
87 .subscribe( 87 .subscribe(
88 ([ videosResult, videoChannelsResult ]) => { 88 ([ videosResult, videoChannelsResult ]) => {
89 this.videos = this.videos.concat(videosResult.videos) 89 this.videos = this.videos.concat(videosResult.videos)
90 this.pagination.totalItems = videosResult.totalVideos 90 this.pagination.totalItems = videosResult.totalVideos + videoChannelsResult.total
91 91
92 this.videoChannels = videoChannelsResult.data 92 this.videoChannels = this.videoChannels.concat(videoChannelsResult.data)
93
94 // Focus on channels
95 if (this.channelsPerPage !== 10 && this.videos.length < this.pagination.itemsPerPage) {
96 this.resetPagination()
97
98 this.channelsPerPage = 10
99 this.search()
100 }
93 }, 101 },
94 102
95 error => { 103 error => {
@@ -116,8 +124,10 @@ export class SearchComponent implements OnInit, OnDestroy {
116 private resetPagination () { 124 private resetPagination () {
117 this.pagination.currentPage = 1 125 this.pagination.currentPage = 1
118 this.pagination.totalItems = null 126 this.pagination.totalItems = null
127 this.channelsPerPage = 2
119 128
120 this.videos = [] 129 this.videos = []
130 this.videoChannels = []
121 } 131 }
122 132
123 private updateTitle () { 133 private updateTitle () {