diff options
Diffstat (limited to 'client/src/app/videos/+video-edit/video-add.component.ts')
-rw-r--r-- | client/src/app/videos/+video-edit/video-add.component.ts | 17 |
1 files changed, 13 insertions, 4 deletions
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 911bc884e..401d8a08f 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts | |||
@@ -1,28 +1,37 @@ | |||
1 | import { Component, HostListener, ViewChild } from '@angular/core' | 1 | import { Component, HostListener, OnInit, ViewChild } from '@angular/core' |
2 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' | 2 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' |
3 | import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component' | 3 | import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component' |
4 | import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component' | 4 | import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component' |
5 | import { AuthService, ServerService } from '@app/core' | 5 | import { AuthService, ServerService } from '@app/core' |
6 | import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component' | 6 | import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component' |
7 | import { ServerConfig } from '@shared/models' | ||
7 | 8 | ||
8 | @Component({ | 9 | @Component({ |
9 | selector: 'my-videos-add', | 10 | selector: 'my-videos-add', |
10 | templateUrl: './video-add.component.html', | 11 | templateUrl: './video-add.component.html', |
11 | styleUrls: [ './video-add.component.scss' ] | 12 | styleUrls: [ './video-add.component.scss' ] |
12 | }) | 13 | }) |
13 | export class VideoAddComponent implements CanComponentDeactivate { | 14 | export class VideoAddComponent implements OnInit, CanComponentDeactivate { |
14 | @ViewChild('videoUpload', { static: false }) videoUpload: VideoUploadComponent | 15 | @ViewChild('videoUpload', { static: false }) videoUpload: VideoUploadComponent |
15 | @ViewChild('videoImportUrl', { static: false }) videoImportUrl: VideoImportUrlComponent | 16 | @ViewChild('videoImportUrl', { static: false }) videoImportUrl: VideoImportUrlComponent |
16 | @ViewChild('videoImportTorrent', { static: false }) videoImportTorrent: VideoImportTorrentComponent | 17 | @ViewChild('videoImportTorrent', { static: false }) videoImportTorrent: VideoImportTorrentComponent |
17 | 18 | ||
18 | secondStepType: 'upload' | 'import-url' | 'import-torrent' | 19 | secondStepType: 'upload' | 'import-url' | 'import-torrent' |
19 | videoName: string | 20 | videoName: string |
21 | serverConfig: ServerConfig | ||
20 | 22 | ||
21 | constructor ( | 23 | constructor ( |
22 | private auth: AuthService, | 24 | private auth: AuthService, |
23 | private serverService: ServerService | 25 | private serverService: ServerService |
24 | ) {} | 26 | ) {} |
25 | 27 | ||
28 | ngOnInit () { | ||
29 | this.serverConfig = this.serverService.getTmpConfig() | ||
30 | |||
31 | this.serverService.getConfig() | ||
32 | .subscribe(config => this.serverConfig = config) | ||
33 | } | ||
34 | |||
26 | onFirstStepDone (type: 'upload' | 'import-url' | 'import-torrent', videoName: string) { | 35 | onFirstStepDone (type: 'upload' | 'import-url' | 'import-torrent', videoName: string) { |
27 | this.secondStepType = type | 36 | this.secondStepType = type |
28 | this.videoName = videoName | 37 | this.videoName = videoName |
@@ -52,11 +61,11 @@ export class VideoAddComponent implements CanComponentDeactivate { | |||
52 | } | 61 | } |
53 | 62 | ||
54 | isVideoImportHttpEnabled () { | 63 | isVideoImportHttpEnabled () { |
55 | return this.serverService.getConfig().import.videos.http.enabled | 64 | return this.serverConfig.import.videos.http.enabled |
56 | } | 65 | } |
57 | 66 | ||
58 | isVideoImportTorrentEnabled () { | 67 | isVideoImportTorrentEnabled () { |
59 | return this.serverService.getConfig().import.videos.torrent.enabled | 68 | return this.serverConfig.import.videos.torrent.enabled |
60 | } | 69 | } |
61 | 70 | ||
62 | isInSecondStep () { | 71 | isInSecondStep () { |