diff options
Diffstat (limited to 'client/src/app/+my-library/my-videos/my-videos.component.ts')
-rw-r--r-- | client/src/app/+my-library/my-videos/my-videos.component.ts | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/client/src/app/+my-library/my-videos/my-videos.component.ts b/client/src/app/+my-library/my-videos/my-videos.component.ts index f9c1b32b0..1e4a4406d 100644 --- a/client/src/app/+my-library/my-videos/my-videos.component.ts +++ b/client/src/app/+my-library/my-videos/my-videos.component.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import { concat, Observable } from 'rxjs' | 1 | import { concat, Observable } from 'rxjs' |
2 | import { tap, toArray } from 'rxjs/operators' | 2 | import { tap, toArray } from 'rxjs/operators' |
3 | import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core' | 3 | import { Component, OnInit, ViewChild } from '@angular/core' |
4 | import { ActivatedRoute, Router } from '@angular/router' | 4 | import { ActivatedRoute, Router } from '@angular/router' |
5 | import { AuthService, ComponentPagination, ConfirmService, Notifier, RouteFilter, ScreenService, ServerService, User } from '@app/core' | 5 | import { AuthService, ComponentPagination, ConfirmService, Notifier, ScreenService, ServerService, User } from '@app/core' |
6 | import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' | 6 | import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' |
7 | import { immutableAssign } from '@app/helpers' | 7 | import { immutableAssign } from '@app/helpers' |
8 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | 8 | import { AdvancedInputFilter } from '@app/shared/shared-forms' |
@@ -16,7 +16,7 @@ import { VideoChangeOwnershipComponent } from './modals/video-change-ownership.c | |||
16 | templateUrl: './my-videos.component.html', | 16 | templateUrl: './my-videos.component.html', |
17 | styleUrls: [ './my-videos.component.scss' ] | 17 | styleUrls: [ './my-videos.component.scss' ] |
18 | }) | 18 | }) |
19 | export class MyVideosComponent extends RouteFilter implements OnInit, AfterViewInit, DisableForReuseHook { | 19 | export class MyVideosComponent implements OnInit, DisableForReuseHook { |
20 | @ViewChild('videosSelection', { static: true }) videosSelection: VideosSelectionComponent | 20 | @ViewChild('videosSelection', { static: true }) videosSelection: VideosSelectionComponent |
21 | @ViewChild('videoChangeOwnershipModal', { static: true }) videoChangeOwnershipModal: VideoChangeOwnershipComponent | 21 | @ViewChild('videoChangeOwnershipModal', { static: true }) videoChangeOwnershipModal: VideoChangeOwnershipComponent |
22 | @ViewChild('liveStreamInformationModal', { static: true }) liveStreamInformationModal: LiveStreamInformationComponent | 22 | @ViewChild('liveStreamInformationModal', { static: true }) liveStreamInformationModal: LiveStreamInformationComponent |
@@ -42,6 +42,7 @@ export class MyVideosComponent extends RouteFilter implements OnInit, AfterViewI | |||
42 | 42 | ||
43 | videos: Video[] = [] | 43 | videos: Video[] = [] |
44 | getVideosObservableFunction = this.getVideosObservable.bind(this) | 44 | getVideosObservableFunction = this.getVideosObservable.bind(this) |
45 | |||
45 | sort: VideoSortField = '-publishedAt' | 46 | sort: VideoSortField = '-publishedAt' |
46 | 47 | ||
47 | user: User | 48 | user: User |
@@ -53,6 +54,8 @@ export class MyVideosComponent extends RouteFilter implements OnInit, AfterViewI | |||
53 | } | 54 | } |
54 | ] | 55 | ] |
55 | 56 | ||
57 | private search: string | ||
58 | |||
56 | constructor ( | 59 | constructor ( |
57 | protected router: Router, | 60 | protected router: Router, |
58 | protected serverService: ServerService, | 61 | protected serverService: ServerService, |
@@ -63,8 +66,6 @@ export class MyVideosComponent extends RouteFilter implements OnInit, AfterViewI | |||
63 | private confirmService: ConfirmService, | 66 | private confirmService: ConfirmService, |
64 | private videoService: VideoService | 67 | private videoService: VideoService |
65 | ) { | 68 | ) { |
66 | super() | ||
67 | |||
68 | this.titlePage = $localize`My videos` | 69 | this.titlePage = $localize`My videos` |
69 | } | 70 | } |
70 | 71 | ||
@@ -72,16 +73,14 @@ export class MyVideosComponent extends RouteFilter implements OnInit, AfterViewI | |||
72 | this.buildActions() | 73 | this.buildActions() |
73 | 74 | ||
74 | this.user = this.authService.getUser() | 75 | this.user = this.authService.getUser() |
75 | |||
76 | this.initSearch() | ||
77 | this.listenToSearchChange() | ||
78 | } | 76 | } |
79 | 77 | ||
80 | ngAfterViewInit () { | 78 | onSearch (search: string) { |
81 | if (this.search) this.setTableFilter(this.search, false) | 79 | this.search = search |
80 | this.reloadData() | ||
82 | } | 81 | } |
83 | 82 | ||
84 | loadData () { | 83 | reloadData () { |
85 | this.videosSelection.reloadVideos() | 84 | this.videosSelection.reloadVideos() |
86 | } | 85 | } |
87 | 86 | ||