diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-10 09:19:36 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-02-10 11:36:40 +0100 |
commit | 53e4e201797aa1b581209ffd775bf05197efa78f (patch) | |
tree | 88b392c55733fed9c04c3a88502caa93740f97cd | |
parent | 21e493d4d8acb7a650eff3a30cd7e086b3cb8a28 (diff) | |
download | PeerTube-53e4e201797aa1b581209ffd775bf05197efa78f.tar.gz PeerTube-53e4e201797aa1b581209ffd775bf05197efa78f.tar.zst PeerTube-53e4e201797aa1b581209ffd775bf05197efa78f.zip |
Add fragment support in admin conf page
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | 2 | ||||
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | 18 |
2 files changed, 17 insertions, 3 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index 637203b96..135276192 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | |||
@@ -1,7 +1,7 @@ | |||
1 | <h1 class="sr-only" i18n>Configuration</h1> | 1 | <h1 class="sr-only" i18n>Configuration</h1> |
2 | <form role="form" [formGroup]="form"> | 2 | <form role="form" [formGroup]="form"> |
3 | 3 | ||
4 | <div ngbNav #nav="ngbNav" class="nav-tabs"> | 4 | <div ngbNav #nav="ngbNav" [activeId]="activeNav" (activeIdChange)="onNavChange($event)" class="nav-tabs"> |
5 | 5 | ||
6 | <ng-container ngbNavItem="instance-information"> | 6 | <ng-container ngbNavItem="instance-information"> |
7 | <a ngbNavLink i18n>Instance information</a> | 7 | <a ngbNavLink i18n>Instance information</a> |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 56be97e84..29524fdd8 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -1,7 +1,9 @@ | |||
1 | import { forkJoin } from 'rxjs' | 1 | import { forkJoin } from 'rxjs' |
2 | import { pairwise } from 'rxjs/operators' | 2 | import { pairwise } from 'rxjs/operators' |
3 | import { SelectOptionsItem } from 'src/types/select-options-item.model' | ||
3 | import { ViewportScroller } from '@angular/common' | 4 | import { ViewportScroller } from '@angular/common' |
4 | import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' | 5 | import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' |
6 | import { ActivatedRoute, Router } from '@angular/router' | ||
5 | import { ConfigService } from '@app/+admin/config/shared/config.service' | 7 | import { ConfigService } from '@app/+admin/config/shared/config.service' |
6 | import { Notifier } from '@app/core' | 8 | import { Notifier } from '@app/core' |
7 | import { ServerService } from '@app/core/server/server.service' | 9 | import { ServerService } from '@app/core/server/server.service' |
@@ -22,7 +24,6 @@ import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@a | |||
22 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 24 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
23 | import { NgbNav } from '@ng-bootstrap/ng-bootstrap' | 25 | import { NgbNav } from '@ng-bootstrap/ng-bootstrap' |
24 | import { CustomConfig, ServerConfig } from '@shared/models' | 26 | import { CustomConfig, ServerConfig } from '@shared/models' |
25 | import { SelectOptionsItem } from 'src/types/select-options-item.model' | ||
26 | 27 | ||
27 | @Component({ | 28 | @Component({ |
28 | selector: 'my-edit-custom-config', | 29 | selector: 'my-edit-custom-config', |
@@ -30,7 +31,6 @@ import { SelectOptionsItem } from 'src/types/select-options-item.model' | |||
30 | styleUrls: [ './edit-custom-config.component.scss' ] | 31 | styleUrls: [ './edit-custom-config.component.scss' ] |
31 | }) | 32 | }) |
32 | export class EditCustomConfigComponent extends FormReactive implements OnInit, AfterViewChecked { | 33 | export class EditCustomConfigComponent extends FormReactive implements OnInit, AfterViewChecked { |
33 | // FIXME: use built-in router | ||
34 | @ViewChild('nav') nav: NgbNav | 34 | @ViewChild('nav') nav: NgbNav |
35 | 35 | ||
36 | initDone = false | 36 | initDone = false |
@@ -47,9 +47,13 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
47 | 47 | ||
48 | signupAlertMessage: string | 48 | signupAlertMessage: string |
49 | 49 | ||
50 | activeNav: string | ||
51 | |||
50 | private serverConfig: ServerConfig | 52 | private serverConfig: ServerConfig |
51 | 53 | ||
52 | constructor ( | 54 | constructor ( |
55 | private router: Router, | ||
56 | private route: ActivatedRoute, | ||
53 | private viewportScroller: ViewportScroller, | 57 | private viewportScroller: ViewportScroller, |
54 | protected formValidatorService: FormValidatorService, | 58 | protected formValidatorService: FormValidatorService, |
55 | private notifier: Notifier, | 59 | private notifier: Notifier, |
@@ -352,6 +356,10 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
352 | formGroupData.live.transcoding.resolutions[resolution.id] = null | 356 | formGroupData.live.transcoding.resolutions[resolution.id] = null |
353 | } | 357 | } |
354 | 358 | ||
359 | if (this.route.snapshot.fragment) { | ||
360 | this.onNavChange(this.route.snapshot.fragment) | ||
361 | } | ||
362 | |||
355 | this.buildForm(formGroupData) | 363 | this.buildForm(formGroupData) |
356 | this.loadForm() | 364 | this.loadForm() |
357 | 365 | ||
@@ -440,6 +448,12 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
440 | return true | 448 | return true |
441 | } | 449 | } |
442 | 450 | ||
451 | onNavChange (newActiveNav: string) { | ||
452 | this.activeNav = newActiveNav | ||
453 | |||
454 | this.router.navigate([], { fragment: this.activeNav }) | ||
455 | } | ||
456 | |||
443 | private updateForm () { | 457 | private updateForm () { |
444 | this.form.patchValue(this.customConfig) | 458 | this.form.patchValue(this.customConfig) |
445 | } | 459 | } |