aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-video-miniature
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-video-miniature')
-rw-r--r--client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts38
1 files changed, 35 insertions, 3 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
index 82c084791..2ab9f4739 100644
--- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
+++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
@@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@a
2import { AuthService, ConfirmService, Notifier, ScreenService } from '@app/core' 2import { AuthService, ConfirmService, Notifier, ScreenService } from '@app/core'
3import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation' 3import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation'
4import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' 4import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
5import { UserRight, VideoCaption } from '@shared/models' 5import { UserRight, VideoCaption, VideoState } from '@shared/models'
6import { 6import {
7 Actor, 7 Actor,
8 DropdownAction, 8 DropdownAction,
@@ -28,6 +28,7 @@ export type VideoActionsDisplayType = {
28 mute?: boolean 28 mute?: boolean
29 liveInfo?: boolean 29 liveInfo?: boolean
30 removeFiles?: boolean 30 removeFiles?: boolean
31 transcoding?: boolean
31} 32}
32 33
33@Component({ 34@Component({
@@ -56,7 +57,9 @@ export class VideoActionsDropdownComponent implements OnChanges {
56 report: true, 57 report: true,
57 duplicate: true, 58 duplicate: true,
58 mute: true, 59 mute: true,
59 liveInfo: false 60 liveInfo: false,
61 removeFiles: false,
62 transcoding: false
60 } 63 }
61 @Input() placement = 'left' 64 @Input() placement = 'left'
62 65
@@ -71,6 +74,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
71 @Output() videoUnblocked = new EventEmitter() 74 @Output() videoUnblocked = new EventEmitter()
72 @Output() videoBlocked = new EventEmitter() 75 @Output() videoBlocked = new EventEmitter()
73 @Output() videoAccountMuted = new EventEmitter() 76 @Output() videoAccountMuted = new EventEmitter()
77 @Output() transcodingCreated = new EventEmitter()
74 @Output() modalOpened = new EventEmitter() 78 @Output() modalOpened = new EventEmitter()
75 79
76 videoActions: DropdownAction<{ video: Video }>[][] = [] 80 videoActions: DropdownAction<{ video: Video }>[][] = []
@@ -177,7 +181,11 @@ export class VideoActionsDropdownComponent implements OnChanges {
177 } 181 }
178 182
179 canRemoveVideoFiles () { 183 canRemoveVideoFiles () {
180 return this.user.hasRight(UserRight.MANAGE_VIDEO_FILES) && this.video.hasHLS() && this.video.hasWebTorrent() 184 return this.video.canRemoveFiles(this.user)
185 }
186
187 canRunTranscoding () {
188 return this.video.canRunTranscoding(this.user)
181 } 189 }
182 190
183 /* Action handlers */ 191 /* Action handlers */
@@ -268,6 +276,18 @@ export class VideoActionsDropdownComponent implements OnChanges {
268 }) 276 })
269 } 277 }
270 278
279 runTranscoding (video: Video, type: 'hls' | 'webtorrent') {
280 this.videoService.runTranscoding([ video.id ], type)
281 .subscribe({
282 next: () => {
283 this.notifier.success($localize`Transcoding jobs created for ${video.name}.`)
284 this.transcodingCreated.emit()
285 },
286
287 error: err => this.notifier.error(err.message)
288 })
289 }
290
271 onVideoBlocked () { 291 onVideoBlocked () {
272 this.videoBlocked.emit() 292 this.videoBlocked.emit()
273 } 293 }
@@ -342,6 +362,18 @@ export class VideoActionsDropdownComponent implements OnChanges {
342 ], 362 ],
343 [ 363 [
344 { 364 {
365 label: $localize`Run HLS transcoding`,
366 handler: ({ video }) => this.runTranscoding(video, 'hls'),
367 isDisplayed: () => this.displayOptions.transcoding && this.canRunTranscoding(),
368 iconName: 'cog'
369 },
370 {
371 label: $localize`Run WebTorrent transcoding`,
372 handler: ({ video }) => this.runTranscoding(video, 'webtorrent'),
373 isDisplayed: () => this.displayOptions.transcoding && this.canRunTranscoding(),
374 iconName: 'cog'
375 },
376 {
345 label: $localize`Delete HLS files`, 377 label: $localize`Delete HLS files`,
346 handler: ({ video }) => this.removeVideoFiles(video, 'hls'), 378 handler: ({ video }) => this.removeVideoFiles(video, 'hls'),
347 isDisplayed: () => this.displayOptions.removeFiles && this.canRemoveVideoFiles(), 379 isDisplayed: () => this.displayOptions.removeFiles && this.canRemoveVideoFiles(),