]>
Commit | Line | Data |
---|---|---|
fbad87b0 | 1 | import { Component, ViewChild } from '@angular/core' |
f6a043df | 2 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' |
fbad87b0 C |
3 | import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component' |
4 | import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component' | |
5d08a6a7 | 5 | import { 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 |
12 | export 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 () { | |
36 | return this.serverService.getConfig().import.video.http.enabled | |
37 | } | |
dc8bc31b | 38 | } |