diff options
Diffstat (limited to 'client/src/app/+my-account/my-account-videos/my-account-videos.component.ts')
-rw-r--r-- | client/src/app/+my-account/my-account-videos/my-account-videos.component.ts | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts index 2c86a3c56..dd4b25d08 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { concat, Observable } from 'rxjs' | 1 | import { concat, Observable, Subject } from 'rxjs' |
2 | import { tap, toArray } from 'rxjs/operators' | 2 | import { tap, toArray, debounceTime } from 'rxjs/operators' |
3 | import { Component, ViewChild } from '@angular/core' | 3 | import { Component, ViewChild, OnInit } from '@angular/core' |
4 | import { ActivatedRoute, Router } from '@angular/router' | 4 | import { ActivatedRoute, Router } from '@angular/router' |
5 | import { immutableAssign } from '@app/shared/misc/utils' | 5 | import { immutableAssign } from '@app/shared/misc/utils' |
6 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 6 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
@@ -22,7 +22,7 @@ import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' | |||
22 | templateUrl: './my-account-videos.component.html', | 22 | templateUrl: './my-account-videos.component.html', |
23 | styleUrls: [ './my-account-videos.component.scss' ] | 23 | styleUrls: [ './my-account-videos.component.scss' ] |
24 | }) | 24 | }) |
25 | export class MyAccountVideosComponent implements DisableForReuseHook { | 25 | export class MyAccountVideosComponent implements OnInit, DisableForReuseHook { |
26 | @ViewChild('videosSelection', { static: true }) videosSelection: VideosSelectionComponent | 26 | @ViewChild('videosSelection', { static: true }) videosSelection: VideosSelectionComponent |
27 | @ViewChild('videoChangeOwnershipModal', { static: true }) videoChangeOwnershipModal: VideoChangeOwnershipComponent | 27 | @ViewChild('videoChangeOwnershipModal', { static: true }) videoChangeOwnershipModal: VideoChangeOwnershipComponent |
28 | 28 | ||
@@ -43,6 +43,8 @@ export class MyAccountVideosComponent implements DisableForReuseHook { | |||
43 | blacklistInfo: true | 43 | blacklistInfo: true |
44 | } | 44 | } |
45 | videos: Video[] = [] | 45 | videos: Video[] = [] |
46 | videosSearch: string | ||
47 | videosSearchChanged = new Subject<string>() | ||
46 | getVideosObservableFunction = this.getVideosObservable.bind(this) | 48 | getVideosObservableFunction = this.getVideosObservable.bind(this) |
47 | 49 | ||
48 | constructor ( | 50 | constructor ( |
@@ -59,6 +61,19 @@ export class MyAccountVideosComponent implements DisableForReuseHook { | |||
59 | this.titlePage = this.i18n('My videos') | 61 | this.titlePage = this.i18n('My videos') |
60 | } | 62 | } |
61 | 63 | ||
64 | ngOnInit () { | ||
65 | this.videosSearchChanged | ||
66 | .pipe( | ||
67 | debounceTime(500)) | ||
68 | .subscribe(() => { | ||
69 | this.videosSelection.reloadVideos() | ||
70 | }) | ||
71 | } | ||
72 | |||
73 | onVideosSearchChanged () { | ||
74 | this.videosSearchChanged.next() | ||
75 | } | ||
76 | |||
62 | disableForReuse () { | 77 | disableForReuse () { |
63 | this.videosSelection.disableForReuse() | 78 | this.videosSelection.disableForReuse() |
64 | } | 79 | } |
@@ -70,7 +85,7 @@ export class MyAccountVideosComponent implements DisableForReuseHook { | |||
70 | getVideosObservable (page: number, sort: VideoSortField) { | 85 | getVideosObservable (page: number, sort: VideoSortField) { |
71 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 86 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
72 | 87 | ||
73 | return this.videoService.getMyVideos(newPagination, sort) | 88 | return this.videoService.getMyVideos(newPagination, sort, this.videosSearch) |
74 | } | 89 | } |
75 | 90 | ||
76 | async deleteSelectedVideos () { | 91 | async deleteSelectedVideos () { |