]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/+video-edit/video-add.component.ts
Correctly handle video import errors
[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'
1553e15d 5
dc8bc31b
C
6@Component({
7 selector: 'my-videos-add',
27e1a06c 8 templateUrl: './video-add.component.html',
fbad87b0 9 styleUrls: [ './video-add.component.scss' ]
dc8bc31b 10})
fbad87b0
C
11export class VideoAddComponent implements CanComponentDeactivate {
12 @ViewChild('videoUpload') videoUpload: VideoUploadComponent
13 @ViewChild('videoImport') videoImport: VideoImportComponent
bfb3a98f 14
fbad87b0
C
15 secondStepType: 'upload' | 'import'
16 videoName: string
bbe0f064 17
fbad87b0
C
18 onFirstStepDone (type: 'upload' | 'import', videoName: string) {
19 this.secondStepType = type
20 this.videoName = videoName
f6a043df
C
21 }
22
529479f9 23 canDeactivate () {
fbad87b0
C
24 if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
25 if (this.secondStepType === 'import') return this.videoImport.canDeactivate()
40e87e9e 26
fbad87b0 27 return { canDeactivate: true }
27e1a06c 28 }
dc8bc31b 29}