aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-edit/video-add.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-18 15:31:54 +0100
committerChocobozzz <me@florianbigard.com>2019-12-18 15:40:59 +0100
commitba430d7516bc5b1324b60571ba7594460969b7fb (patch)
treedf5c6952c82f49a94c0a884bbc97d4a0cbd9f867 /client/src/app/videos/+video-edit/video-add.component.ts
parent5dfb7c1dec8222b0bbccac5b56ad46da1438747e (diff)
downloadPeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.gz
PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.zst
PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.zip
Lazy load static objects
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.ts17
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 @@
1import { Component, HostListener, ViewChild } from '@angular/core' 1import { Component, HostListener, OnInit, 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 { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component' 3import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-add-components/video-import-url.component'
4import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component' 4import { VideoUploadComponent } from '@app/videos/+video-edit/video-add-components/video-upload.component'
5import { AuthService, ServerService } from '@app/core' 5import { AuthService, ServerService } from '@app/core'
6import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component' 6import { VideoImportTorrentComponent } from '@app/videos/+video-edit/video-add-components/video-import-torrent.component'
7import { 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})
13export class VideoAddComponent implements CanComponentDeactivate { 14export 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 () {