X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-search%2Ffind-in-bulk.service.ts;h=125d5e2b868c5537509d7f63b9abb1dd5bbfb364;hb=52798aa5f277492d4dd2482bca9396d2e982fa19;hp=61dd2cbc56a3d6adafc0192735b4d635c877d36b;hpb=ff4de38385049bf8f6e1d76d8511854fcfabc71c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-search/find-in-bulk.service.ts b/client/src/app/shared/shared-search/find-in-bulk.service.ts index 61dd2cbc5..125d5e2b8 100644 --- a/client/src/app/shared/shared-search/find-in-bulk.service.ts +++ b/client/src/app/shared/shared-search/find-in-bulk.service.ts @@ -1,48 +1,52 @@ import * as debug from 'debug' -import { Observable, Subject, throwError } from 'rxjs' -import { first, map } from 'rxjs/operators' -import { Injectable, NgZone } from '@angular/core' +import { Observable, Subject } from 'rxjs' +import { filter, first, map } from 'rxjs/operators' +import { Injectable } from '@angular/core' import { buildBulkObservable } from '@app/helpers' import { ResultList } from '@shared/models/common' import { Video, VideoChannel } from '../shared-main' import { VideoPlaylist } from '../shared-video-playlist' import { SearchService } from './search.service' +import { AdvancedSearch } from './advanced-search.model' -const logger = debug('peertube:search:FindInBulkService') +const debugLogger = debug('peertube:search:FindInBulkService') type BulkObservables

= { notifier: Subject

- result: Observable + result: Observable<{ params: P[], response: R }> } @Injectable() export class FindInBulkService { + private advancedSearchForBulk: AdvancedSearch + private getVideoInBulk: BulkObservables> private getChannelInBulk: BulkObservables> private getPlaylistInBulk: BulkObservables> constructor ( - private searchService: SearchService, - private ngZone: NgZone + private searchService: SearchService ) { this.getVideoInBulk = this.buildBulkObservableObject(this.getVideosInBulk.bind(this)) this.getChannelInBulk = this.buildBulkObservableObject(this.getChannelsInBulk.bind(this)) this.getPlaylistInBulk = this.buildBulkObservableObject(this.getPlaylistsInBulk.bind(this)) + + this.advancedSearchForBulk = new AdvancedSearch({ searchTarget: 'local' }) } getVideo (uuid: string): Observable

(bulkGet: (params: P[]) => Observable) { + const notifier = new Subject

() return { notifier, @@ -115,7 +137,6 @@ export class FindInBulkService { result: buildBulkObservable({ time: 500, bulkGet, - ngZone: this.ngZone, notifierObservable: notifier.asObservable() }) }