import { forkJoin } from 'rxjs'
import { pairwise } from 'rxjs/operators'
+import { SelectOptionsItem } from 'src/types/select-options-item.model'
import { ViewportScroller } from '@angular/common'
import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core'
+import { ActivatedRoute, Router } from '@angular/router'
import { ConfigService } from '@app/+admin/config/shared/config.service'
import { Notifier } from '@app/core'
import { ServerService } from '@app/core/server/server.service'
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
import { CustomConfig, ServerConfig } from '@shared/models'
-import { SelectOptionsItem } from 'src/types/select-options-item.model'
@Component({
selector: 'my-edit-custom-config',
styleUrls: [ './edit-custom-config.component.scss' ]
})
export class EditCustomConfigComponent extends FormReactive implements OnInit, AfterViewChecked {
- // FIXME: use built-in router
@ViewChild('nav') nav: NgbNav
initDone = false
signupAlertMessage: string
+ activeNav: string
+
private serverConfig: ServerConfig
constructor (
+ private router: Router,
+ private route: ActivatedRoute,
private viewportScroller: ViewportScroller,
protected formValidatorService: FormValidatorService,
private notifier: Notifier,
formGroupData.live.transcoding.resolutions[resolution.id] = null
}
+ if (this.route.snapshot.fragment) {
+ this.onNavChange(this.route.snapshot.fragment)
+ }
+
this.buildForm(formGroupData)
this.loadForm()
return true
}
+ onNavChange (newActiveNav: string) {
+ this.activeNav = newActiveNav
+
+ this.router.navigate([], { fragment: this.activeNav })
+ }
+
private updateForm () {
this.form.patchValue(this.customConfig)
}