]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/+video-edit/video-add.component.ts
Merge branch 'release/beta-10' into develop
[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'
fbad87b0
C
3import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component'
4import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component'
5d08a6a7 5import { ServerService } from '@app/core'
1553e15d 6
dc8bc31b
C
7@Component({
8 selector: 'my-videos-add',
27e1a06c 9 templateUrl: './video-add.component.html',
fbad87b0 10 styleUrls: [ './video-add.component.scss' ]
dc8bc31b 11})
fbad87b0
C
12export class VideoAddComponent implements CanComponentDeactivate {
13 @ViewChild('videoUpload') videoUpload: VideoUploadComponent
14 @ViewChild('videoImport') videoImport: VideoImportComponent
bfb3a98f 15
fbad87b0
C
16 secondStepType: 'upload' | 'import'
17 videoName: string
bbe0f064 18
5d08a6a7
C
19 constructor (
20 private serverService: ServerService
21 ) {}
22
fbad87b0
C
23 onFirstStepDone (type: 'upload' | 'import', videoName: string) {
24 this.secondStepType = type
25 this.videoName = videoName
f6a043df
C
26 }
27
529479f9 28 canDeactivate () {
fbad87b0
C
29 if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
30 if (this.secondStepType === 'import') return this.videoImport.canDeactivate()
40e87e9e 31
fbad87b0 32 return { canDeactivate: true }
27e1a06c 33 }
5d08a6a7
C
34
35 isVideoImportEnabled () {
b2977eec 36 return this.serverService.getConfig().import.videos.http.enabled
5d08a6a7 37 }
dc8bc31b 38}