aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts
diff options
context:
space:
mode:
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.ts38
1 files changed, 34 insertions, 4 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 46a02a41a..7a3019239 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
@@ -5,10 +5,11 @@ import { ActivatedRoute, Router } from '@angular/router'
5import { AuthService, ComponentPagination, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core' 5import { AuthService, ComponentPagination, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core'
6import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' 6import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook'
7import { immutableAssign } from '@app/helpers' 7import { immutableAssign } from '@app/helpers'
8import { Video, VideoService } from '@app/shared/shared-main' 8import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
9import { MiniatureDisplayOptions, OwnerDisplayType, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature' 9import { MiniatureDisplayOptions, OwnerDisplayType, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature'
10import { VideoSortField } from '@shared/models' 10import { VideoSortField } from '@shared/models'
11import { VideoChangeOwnershipComponent } from './video-change-ownership/video-change-ownership.component' 11import { VideoChangeOwnershipComponent } from './modals/video-change-ownership.component'
12import { LiveStreamInformationComponent } from './modals/live-stream-information.component'
12 13
13@Component({ 14@Component({
14 selector: 'my-account-videos', 15 selector: 'my-account-videos',
@@ -18,6 +19,7 @@ import { VideoChangeOwnershipComponent } from './video-change-ownership/video-ch
18export class MyAccountVideosComponent implements OnInit, DisableForReuseHook { 19export class MyAccountVideosComponent implements OnInit, DisableForReuseHook {
19 @ViewChild('videosSelection', { static: true }) videosSelection: VideosSelectionComponent 20 @ViewChild('videosSelection', { static: true }) videosSelection: VideosSelectionComponent
20 @ViewChild('videoChangeOwnershipModal', { static: true }) videoChangeOwnershipModal: VideoChangeOwnershipComponent 21 @ViewChild('videoChangeOwnershipModal', { static: true }) videoChangeOwnershipModal: VideoChangeOwnershipComponent
22 @ViewChild('liveStreamInformationModal', { static: true }) liveStreamInformationModal: LiveStreamInformationComponent
21 23
22 titlePage: string 24 titlePage: string
23 selection: SelectionType = {} 25 selection: SelectionType = {}
@@ -37,6 +39,8 @@ export class MyAccountVideosComponent implements OnInit, DisableForReuseHook {
37 } 39 }
38 ownerDisplayType: OwnerDisplayType = 'videoChannel' 40 ownerDisplayType: OwnerDisplayType = 'videoChannel'
39 41
42 videoActions: DropdownAction<{ video: Video }>[] = []
43
40 videos: Video[] = [] 44 videos: Video[] = []
41 videosSearch: string 45 videosSearch: string
42 videosSearchChanged = new Subject<string>() 46 videosSearchChanged = new Subject<string>()
@@ -56,6 +60,8 @@ export class MyAccountVideosComponent implements OnInit, DisableForReuseHook {
56 } 60 }
57 61
58 ngOnInit () { 62 ngOnInit () {
63 this.buildActions()
64
59 this.videosSearchChanged 65 this.videosSearchChanged
60 .pipe(debounceTime(500)) 66 .pipe(debounceTime(500))
61 .subscribe(() => { 67 .subscribe(() => {
@@ -138,12 +144,36 @@ export class MyAccountVideosComponent implements OnInit, DisableForReuseHook {
138 ) 144 )
139 } 145 }
140 146
141 changeOwnership (event: Event, video: Video) { 147 changeOwnership (video: Video) {
142 event.preventDefault()
143 this.videoChangeOwnershipModal.show(video) 148 this.videoChangeOwnershipModal.show(video)
144 } 149 }
145 150
151 displayLiveInformation (video: Video) {
152 this.liveStreamInformationModal.show(video)
153 }
154
146 private removeVideoFromArray (id: number) { 155 private removeVideoFromArray (id: number) {
147 this.videos = this.videos.filter(v => v.id !== id) 156 this.videos = this.videos.filter(v => v.id !== id)
148 } 157 }
158
159 private buildActions () {
160 this.videoActions = [
161 {
162 label: $localize`Display live information`,
163 handler: ({ video }) => this.displayLiveInformation(video),
164 isDisplayed: ({ video }) => video.isLive,
165 iconName: 'live'
166 },
167 {
168 label: $localize`Change ownership`,
169 handler: ({ video }) => this.changeOwnership(video),
170 iconName: 'ownership-change'
171 },
172 {
173 label: $localize`Delete`,
174 handler: ({ video }) => this.deleteVideo(video),
175 iconName: 'delete'
176 }
177 ]
178 }
149} 179}