]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/+video-edit/video-add.component.ts
Fix deleting not found remote actors
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-edit / video-add.component.ts
CommitLineData
fbad87b0 1import { Component, ViewChild } from '@angular/core'
f6a043df 2import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
78848714
C
3import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component'
4import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component'
5d08a6a7 5import { ServerService } from '@app/core'
ce33919c 6import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component'
1553e15d 7
dc8bc31b
C
8@Component({
9 selector: 'my-videos-add',
27e1a06c 10 templateUrl: './video-add.component.html',
fbad87b0 11 styleUrls: [ './video-add.component.scss' ]
dc8bc31b 12})
fbad87b0
C
13export class VideoAddComponent implements CanComponentDeactivate {
14 @ViewChild('videoUpload') videoUpload: VideoUploadComponent
047559af 15 @ViewChild('videoImportUrl') videoImportUrl: VideoImportUrlComponent
ce33919c 16 @ViewChild('videoImportTorrent') videoImportTorrent: VideoImportTorrentComponent
bfb3a98f 17
ce33919c 18 secondStepType: 'upload' | 'import-url' | 'import-torrent'
fbad87b0 19 videoName: string
bbe0f064 20
5d08a6a7
C
21 constructor (
22 private serverService: ServerService
23 ) {}
24
ce33919c 25 onFirstStepDone (type: 'upload' | 'import-url' | 'import-torrent', videoName: string) {
fbad87b0
C
26 this.secondStepType = type
27 this.videoName = videoName
f6a043df
C
28 }
29
7373507f
C
30 onError () {
31 this.videoName = undefined
32 this.secondStepType = undefined
33 }
34
529479f9 35 canDeactivate () {
fbad87b0 36 if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
047559af 37 if (this.secondStepType === 'import-url') return this.videoImportUrl.canDeactivate()
ce33919c 38 if (this.secondStepType === 'import-torrent') return this.videoImportTorrent.canDeactivate()
40e87e9e 39
fbad87b0 40 return { canDeactivate: true }
27e1a06c 41 }
5d08a6a7 42
ce33919c
C
43 isVideoImportHttpEnabled () {
44 return this.serverService.getConfig().import.videos.http.enabled
45 }
46
47 isVideoImportTorrentEnabled () {
a84b8fa5 48 return this.serverService.getConfig().import.videos.torrent.enabled
5d08a6a7 49 }
dc8bc31b 50}