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=0383d864805474461fda182c772e5b23dcee76e6;hpb=3da38d6e9f8d600476be276666ac7223aa5f172c;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 0383d8648..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 } from 'rxjs' -import { map } from 'rxjs/operators' -import { Injectable, NgZone } from '@angular/core' +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, @@ -110,7 +137,6 @@ export class FindInBulkService { result: buildBulkObservable({ time: 500, bulkGet, - ngZone: this.ngZone, notifierObservable: notifier.asObservable() }) }