X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bmy-account%2Fmy-account-video-playlists%2Fmy-account-video-playlists.component.ts;h=42e4782eb63887ef89e28089d868b18b50714231;hb=bf64ed4196938ba9002c887cadb01bd2a6e3127a;hp=76b13fe2b408bd8584734349658ee89106a7b4e2;hpb=f3628e694b8e378b25c34b66f8e1edb7d78afd5f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts index 76b13fe2b..42e4782eb 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts @@ -3,7 +3,7 @@ import { Notifier } from '@app/core' import { AuthService } from '../../core/auth' import { ConfirmService } from '../../core/confirm' import { User } from '@app/shared' -import { flatMap } from 'rxjs/operators' +import { flatMap, debounceTime } from 'rxjs/operators' import { I18n } from '@ngx-translate/i18n-polyfill' import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' import { ComponentPagination } from '@app/shared/rest/component-pagination.model' @@ -17,7 +17,9 @@ import { Subject } from 'rxjs' styleUrls: [ './my-account-video-playlists.component.scss' ] }) export class MyAccountVideoPlaylistsComponent implements OnInit { + videoPlaylistsSearch: string videoPlaylists: VideoPlaylist[] = [] + videoPlaylistSearchChanged = new Subject() pagination: ComponentPagination = { currentPage: 1, @@ -41,6 +43,13 @@ export class MyAccountVideoPlaylistsComponent implements OnInit { this.user = this.authService.getUser() this.loadVideoPlaylists() + + this.videoPlaylistSearchChanged + .pipe( + debounceTime(500)) + .subscribe(() => { + this.loadVideoPlaylists() + }) } async deleteVideoPlaylist (videoPlaylist: VideoPlaylist) { @@ -80,12 +89,17 @@ export class MyAccountVideoPlaylistsComponent implements OnInit { this.loadVideoPlaylists() } + onVideoPlaylistSearchChanged () { + this.videoPlaylistSearchChanged.next() + } + private loadVideoPlaylists () { this.authService.userInformationLoaded .pipe(flatMap(() => { - return this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt') + return this.videoPlaylistService.listAccountPlaylists(this.user.account, this.pagination, '-updatedAt', this.videoPlaylistsSearch) })) .subscribe(res => { + this.videoPlaylists = [] this.videoPlaylists = this.videoPlaylists.concat(res.data) this.pagination.totalItems = res.total