]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/+video-edit/video-add.component.ts
video-import -> video-import-url
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-edit / video-add.component.ts
index 64071b40c37753dc4f0dc9f3c4bf5dba418d5c3f..377ea5dd217f0a3907df9969d175e5f57bd567bd 100644 (file)
@@ -1,7 +1,8 @@
 import { Component, ViewChild } from '@angular/core'
 import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
-import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component'
+import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-import-url.component'
 import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component'
+import { ServerService } from '@app/core'
 
 @Component({
   selector: 'my-videos-add',
@@ -10,20 +11,28 @@ import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.compo
 })
 export class VideoAddComponent implements CanComponentDeactivate {
   @ViewChild('videoUpload') videoUpload: VideoUploadComponent
-  @ViewChild('videoImport') videoImport: VideoImportComponent
+  @ViewChild('videoImportUrl') videoImportUrl: VideoImportUrlComponent
 
-  secondStepType: 'upload' | 'import'
+  secondStepType: 'upload' | 'import-url'
   videoName: string
 
-  onFirstStepDone (type: 'upload' | 'import', videoName: string) {
+  constructor (
+    private serverService: ServerService
+  ) {}
+
+  onFirstStepDone (type: 'upload' | 'import-url', videoName: string) {
     this.secondStepType = type
     this.videoName = videoName
   }
 
   canDeactivate () {
     if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
-    if (this.secondStepType === 'import') return this.videoImport.canDeactivate()
+    if (this.secondStepType === 'import-url') return this.videoImportUrl.canDeactivate()
 
     return { canDeactivate: true }
   }
+
+  isVideoImportEnabled () {
+    return this.serverService.getConfig().import.videos.http.enabled
+  }
 }