X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2F%2Bvideo-edit%2Fvideo-add.component.ts;h=1a9247dbea4a34b4497186d5588fedb6a1237141;hb=e63dbd426e67672b4014c2a3ac3a227fbe26e886;hp=64071b40c37753dc4f0dc9f3c4bf5dba418d5c3f;hpb=fbad87b0472f574409f7aa3ae7f8b54927d0cdd6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index 64071b40c..1a9247dbe 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts @@ -1,7 +1,9 @@ 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 { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component' +import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component' +import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component' +import { ServerService } from '@app/core' +import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component' @Component({ selector: 'my-videos-add', @@ -10,20 +12,34 @@ 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 + @ViewChild('videoImportTorrent') videoImportTorrent: VideoImportTorrentComponent - secondStepType: 'upload' | 'import' + secondStepType: 'upload' | 'import-url' | 'import-torrent' videoName: string - onFirstStepDone (type: 'upload' | 'import', videoName: string) { + constructor ( + private serverService: ServerService + ) {} + + onFirstStepDone (type: 'upload' | 'import-url' | 'import-torrent', 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() + if (this.secondStepType === 'import-torrent') return this.videoImportTorrent.canDeactivate() return { canDeactivate: true } } + + isVideoImportHttpEnabled () { + return this.serverService.getConfig().import.videos.http.enabled + } + + isVideoImportTorrentEnabled () { + return this.serverService.getConfig().import.videos.torrent.enabled + } }