diff options
Diffstat (limited to 'client/src/app/+search')
-rw-r--r-- | client/src/app/+search/search-filters.component.html | 25 | ||||
-rw-r--r-- | client/src/app/+search/search-filters.component.ts | 12 | ||||
-rw-r--r-- | client/src/app/+search/search.component.ts | 23 |
3 files changed, 40 insertions, 20 deletions
diff --git a/client/src/app/+search/search-filters.component.html b/client/src/app/+search/search-filters.component.html index 4b87a2102..c4861e8c4 100644 --- a/client/src/app/+search/search-filters.component.html +++ b/client/src/app/+search/search-filters.component.html | |||
@@ -182,6 +182,31 @@ | |||
182 | > | 182 | > |
183 | </div> | 183 | </div> |
184 | 184 | ||
185 | <div class="form-group"> | ||
186 | <div class="radio-label label-container"> | ||
187 | <label i18n>Result types</label> | ||
188 | <button i18n class="reset-button reset-button-small" (click)="resetField('resultType')" *ngIf="advancedSearch.resultType !== undefined"> | ||
189 | Reset | ||
190 | </button> | ||
191 | </div> | ||
192 | |||
193 | <div class="peertube-radio-container"> | ||
194 | <input type="radio" name="resultType" id="resultTypeVideos" value="videos" [(ngModel)]="advancedSearch.resultType"> | ||
195 | <label i18n for="resultTypeVideos" class="radio">Videos</label> | ||
196 | </div> | ||
197 | |||
198 | <div class="peertube-radio-container"> | ||
199 | <input type="radio" name="resultType" id="resultTypeChannels" value="channels" [(ngModel)]="advancedSearch.resultType"> | ||
200 | <label i18n for="resultTypeChannels" class="radio">Channels</label> | ||
201 | </div> | ||
202 | |||
203 | <div class="peertube-radio-container"> | ||
204 | <input type="radio" name="resultType" id="resultTypePlaylists" value="playlists" [(ngModel)]="advancedSearch.resultType"> | ||
205 | <label i18n for="resultTypePlaylists" class="radio">Playlists</label> | ||
206 | </div> | ||
207 | |||
208 | </div> | ||
209 | |||
185 | <div class="form-group" *ngIf="isSearchTargetEnabled()"> | 210 | <div class="form-group" *ngIf="isSearchTargetEnabled()"> |
186 | <div class="radio-label label-container"> | 211 | <div class="radio-label label-container"> |
187 | <label i18n>Search target</label> | 212 | <label i18n>Search target</label> |
diff --git a/client/src/app/+search/search-filters.component.ts b/client/src/app/+search/search-filters.component.ts index 5972ba553..aaa4ecc5a 100644 --- a/client/src/app/+search/search-filters.component.ts +++ b/client/src/app/+search/search-filters.component.ts | |||
@@ -22,7 +22,6 @@ export class SearchFiltersComponent implements OnInit { | |||
22 | publishedDateRanges: FormOption[] = [] | 22 | publishedDateRanges: FormOption[] = [] |
23 | sorts: FormOption[] = [] | 23 | sorts: FormOption[] = [] |
24 | durationRanges: FormOption[] = [] | 24 | durationRanges: FormOption[] = [] |
25 | videoType: FormOption[] = [] | ||
26 | 25 | ||
27 | publishedDateRange: string | 26 | publishedDateRange: string |
28 | durationRange: string | 27 | durationRange: string |
@@ -54,17 +53,6 @@ export class SearchFiltersComponent implements OnInit { | |||
54 | } | 53 | } |
55 | ] | 54 | ] |
56 | 55 | ||
57 | this.videoType = [ | ||
58 | { | ||
59 | id: 'vod', | ||
60 | label: $localize`VOD videos` | ||
61 | }, | ||
62 | { | ||
63 | id: 'live', | ||
64 | label: $localize`Live videos` | ||
65 | } | ||
66 | ] | ||
67 | |||
68 | this.durationRanges = [ | 56 | this.durationRanges = [ |
69 | { | 57 | { |
70 | id: 'short', | 58 | id: 'short', |
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 | } |