import { Component, HostListener, OnInit, ViewChild } from '@angular/core'
+import { ActivatedRoute, Router } from '@angular/router'
import { AuthService, AuthUser, CanComponentDeactivate, ServerService } from '@app/core'
-import { ServerConfig } from '@shared/models'
+import { HTMLServerConfig } from '@shared/models'
import { VideoEditType } from './shared/video-edit.type'
import { VideoGoLiveComponent } from './video-add-components/video-go-live.component'
import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component'
secondStepType: VideoEditType
videoName: string
- serverConfig: ServerConfig
+
+ activeNav: string
+
+ private serverConfig: HTMLServerConfig
constructor (
private auth: AuthService,
- private serverService: ServerService
+ private serverService: ServerService,
+ private route: ActivatedRoute,
+ private router: Router
) {}
get userInformationLoaded () {
ngOnInit () {
this.user = this.auth.getUser()
- this.serverConfig = this.serverService.getTmpConfig()
-
- this.serverService.getConfig()
- .subscribe(config => this.serverConfig = config)
+ this.serverConfig = this.serverService.getHTMLConfig()
this.user = this.auth.getUser()
+
+ if (this.route.snapshot.fragment) {
+ this.onNavChange(this.route.snapshot.fragment)
+ }
+ }
+
+ onNavChange (newActiveNav: string) {
+ this.activeNav = newActiveNav
+
+ this.router.navigate([], { fragment: this.activeNav })
}
onFirstStepDone (type: VideoEditType, videoName: string) {