Add fragment support in admin conf page
This commit is contained in:
parent
21e493d4d8
commit
53e4e20179
|
@ -1,7 +1,7 @@
|
||||||
<h1 class="sr-only" i18n>Configuration</h1>
|
<h1 class="sr-only" i18n>Configuration</h1>
|
||||||
<form role="form" [formGroup]="form">
|
<form role="form" [formGroup]="form">
|
||||||
|
|
||||||
<div ngbNav #nav="ngbNav" class="nav-tabs">
|
<div ngbNav #nav="ngbNav" [activeId]="activeNav" (activeIdChange)="onNavChange($event)" class="nav-tabs">
|
||||||
|
|
||||||
<ng-container ngbNavItem="instance-information">
|
<ng-container ngbNavItem="instance-information">
|
||||||
<a ngbNavLink i18n>Instance information</a>
|
<a ngbNavLink i18n>Instance information</a>
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import { forkJoin } from 'rxjs'
|
import { forkJoin } from 'rxjs'
|
||||||
import { pairwise } from 'rxjs/operators'
|
import { pairwise } from 'rxjs/operators'
|
||||||
|
import { SelectOptionsItem } from 'src/types/select-options-item.model'
|
||||||
import { ViewportScroller } from '@angular/common'
|
import { ViewportScroller } from '@angular/common'
|
||||||
import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core'
|
import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core'
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router'
|
||||||
import { ConfigService } from '@app/+admin/config/shared/config.service'
|
import { ConfigService } from '@app/+admin/config/shared/config.service'
|
||||||
import { Notifier } from '@app/core'
|
import { Notifier } from '@app/core'
|
||||||
import { ServerService } from '@app/core/server/server.service'
|
import { ServerService } from '@app/core/server/server.service'
|
||||||
|
@ -22,7 +24,6 @@ import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@a
|
||||||
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
|
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
|
||||||
import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { CustomConfig, ServerConfig } from '@shared/models'
|
import { CustomConfig, ServerConfig } from '@shared/models'
|
||||||
import { SelectOptionsItem } from 'src/types/select-options-item.model'
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-edit-custom-config',
|
selector: 'my-edit-custom-config',
|
||||||
|
@ -30,7 +31,6 @@ import { SelectOptionsItem } from 'src/types/select-options-item.model'
|
||||||
styleUrls: [ './edit-custom-config.component.scss' ]
|
styleUrls: [ './edit-custom-config.component.scss' ]
|
||||||
})
|
})
|
||||||
export class EditCustomConfigComponent extends FormReactive implements OnInit, AfterViewChecked {
|
export class EditCustomConfigComponent extends FormReactive implements OnInit, AfterViewChecked {
|
||||||
// FIXME: use built-in router
|
|
||||||
@ViewChild('nav') nav: NgbNav
|
@ViewChild('nav') nav: NgbNav
|
||||||
|
|
||||||
initDone = false
|
initDone = false
|
||||||
|
@ -47,9 +47,13 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
|
||||||
|
|
||||||
signupAlertMessage: string
|
signupAlertMessage: string
|
||||||
|
|
||||||
|
activeNav: string
|
||||||
|
|
||||||
private serverConfig: ServerConfig
|
private serverConfig: ServerConfig
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
|
private router: Router,
|
||||||
|
private route: ActivatedRoute,
|
||||||
private viewportScroller: ViewportScroller,
|
private viewportScroller: ViewportScroller,
|
||||||
protected formValidatorService: FormValidatorService,
|
protected formValidatorService: FormValidatorService,
|
||||||
private notifier: Notifier,
|
private notifier: Notifier,
|
||||||
|
@ -352,6 +356,10 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
|
||||||
formGroupData.live.transcoding.resolutions[resolution.id] = null
|
formGroupData.live.transcoding.resolutions[resolution.id] = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.route.snapshot.fragment) {
|
||||||
|
this.onNavChange(this.route.snapshot.fragment)
|
||||||
|
}
|
||||||
|
|
||||||
this.buildForm(formGroupData)
|
this.buildForm(formGroupData)
|
||||||
this.loadForm()
|
this.loadForm()
|
||||||
|
|
||||||
|
@ -440,6 +448,12 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onNavChange (newActiveNav: string) {
|
||||||
|
this.activeNav = newActiveNav
|
||||||
|
|
||||||
|
this.router.navigate([], { fragment: this.activeNav })
|
||||||
|
}
|
||||||
|
|
||||||
private updateForm () {
|
private updateForm () {
|
||||||
this.form.patchValue(this.customConfig)
|
this.form.patchValue(this.customConfig)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user