aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-edit/video-add.component.html2
-rw-r--r--client/src/app/videos/+video-edit/video-add.component.ts9
-rw-r--r--client/src/app/videos/+video-edit/video-import.component.ts4
3 files changed, 14 insertions, 1 deletions
diff --git a/client/src/app/videos/+video-edit/video-add.component.html b/client/src/app/videos/+video-edit/video-add.component.html
index ed8d91c11..1575007d2 100644
--- a/client/src/app/videos/+video-edit/video-add.component.html
+++ b/client/src/app/videos/+video-edit/video-add.component.html
@@ -10,7 +10,7 @@
10 <my-video-upload #videoUpload (firstStepDone)="onFirstStepDone('upload', $event)"></my-video-upload> 10 <my-video-upload #videoUpload (firstStepDone)="onFirstStepDone('upload', $event)"></my-video-upload>
11 </tab> 11 </tab>
12 12
13 <tab i18n-heading heading="Import your video"> 13 <tab *ngIf="isVideoImportEnabled()" i18n-heading heading="Import your video">
14 <my-video-import #videoImport (firstStepDone)="onFirstStepDone('import', $event)"></my-video-import> 14 <my-video-import #videoImport (firstStepDone)="onFirstStepDone('import', $event)"></my-video-import>
15 </tab> 15 </tab>
16 </tabset> 16 </tabset>
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..d38a53db9 100644
--- a/client/src/app/videos/+video-edit/video-add.component.ts
+++ b/client/src/app/videos/+video-edit/video-add.component.ts
@@ -2,6 +2,7 @@ import { Component, ViewChild } from '@angular/core'
2import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' 2import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
3import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component' 3import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component'
4import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component' 4import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component'
5import { ServerService } from '@app/core'
5 6
6@Component({ 7@Component({
7 selector: 'my-videos-add', 8 selector: 'my-videos-add',
@@ -15,6 +16,10 @@ export class VideoAddComponent implements CanComponentDeactivate {
15 secondStepType: 'upload' | 'import' 16 secondStepType: 'upload' | 'import'
16 videoName: string 17 videoName: string
17 18
19 constructor (
20 private serverService: ServerService
21 ) {}
22
18 onFirstStepDone (type: 'upload' | 'import', videoName: string) { 23 onFirstStepDone (type: 'upload' | 'import', videoName: string) {
19 this.secondStepType = type 24 this.secondStepType = type
20 this.videoName = videoName 25 this.videoName = videoName
@@ -26,4 +31,8 @@ export class VideoAddComponent implements CanComponentDeactivate {
26 31
27 return { canDeactivate: true } 32 return { canDeactivate: true }
28 } 33 }
34
35 isVideoImportEnabled () {
36 return this.serverService.getConfig().import.video.http.enabled
37 }
29} 38}
diff --git a/client/src/app/videos/+video-edit/video-import.component.ts b/client/src/app/videos/+video-edit/video-import.component.ts
index bd4482e17..b1e8e0205 100644
--- a/client/src/app/videos/+video-edit/video-import.component.ts
+++ b/client/src/app/videos/+video-edit/video-import.component.ts
@@ -97,8 +97,11 @@ export class VideoImportComponent extends FormReactive implements OnInit, CanCom
97 channelId: this.firstStepChannelId 97 channelId: this.firstStepChannelId
98 } 98 }
99 99
100 this.loadingBar.start()
101
100 this.videoImportService.importVideo(this.targetUrl, videoUpdate).subscribe( 102 this.videoImportService.importVideo(this.targetUrl, videoUpdate).subscribe(
101 res => { 103 res => {
104 this.loadingBar.complete()
102 this.firstStepDone.emit(res.video.name) 105 this.firstStepDone.emit(res.video.name)
103 this.isImportingVideo = false 106 this.isImportingVideo = false
104 this.hasImportedVideo = true 107 this.hasImportedVideo = true
@@ -113,6 +116,7 @@ export class VideoImportComponent extends FormReactive implements OnInit, CanCom
113 }, 116 },
114 117
115 err => { 118 err => {
119 this.loadingBar.complete()
116 this.isImportingVideo = false 120 this.isImportingVideo = false
117 this.notificationsService.error(this.i18n('Error'), err.message) 121 this.notificationsService.error(this.i18n('Error'), err.message)
118 } 122 }