diff options
Diffstat (limited to 'client/src/app/+admin/users/user-edit')
3 files changed, 17 insertions, 4 deletions
diff --git a/client/src/app/+admin/users/user-edit/user-create.component.ts b/client/src/app/+admin/users/user-edit/user-create.component.ts index 3b57a49c6..e726ec4d7 100644 --- a/client/src/app/+admin/users/user-edit/user-create.component.ts +++ b/client/src/app/+admin/users/user-edit/user-create.component.ts | |||
@@ -34,6 +34,8 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
34 | } | 34 | } |
35 | 35 | ||
36 | ngOnInit () { | 36 | ngOnInit () { |
37 | super.ngOnInit() | ||
38 | |||
37 | const defaultValues = { | 39 | const defaultValues = { |
38 | role: UserRole.USER.toString(), | 40 | role: UserRole.USER.toString(), |
39 | videoQuota: '-1', | 41 | videoQuota: '-1', |
diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 6625d65d6..02f1dcd42 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts | |||
@@ -1,21 +1,30 @@ | |||
1 | import { AuthService, ServerService } from '../../../core' | 1 | import { AuthService, ServerService } from '../../../core' |
2 | import { FormReactive } from '../../../shared' | 2 | import { FormReactive } from '../../../shared' |
3 | import { USER_ROLE_LABELS, UserRole, VideoResolution } from '../../../../../../shared' | 3 | import { ServerConfig, USER_ROLE_LABELS, UserRole, VideoResolution } from '../../../../../../shared' |
4 | import { ConfigService } from '@app/+admin/config/shared/config.service' | 4 | import { ConfigService } from '@app/+admin/config/shared/config.service' |
5 | import { UserAdminFlag } from '@shared/models/users/user-flag.model' | 5 | import { UserAdminFlag } from '@shared/models/users/user-flag.model' |
6 | import { OnInit } from '@angular/core' | ||
6 | 7 | ||
7 | export abstract class UserEdit extends FormReactive { | 8 | export abstract class UserEdit extends FormReactive implements OnInit { |
8 | videoQuotaOptions: { value: string, label: string }[] = [] | 9 | videoQuotaOptions: { value: string, label: string }[] = [] |
9 | videoQuotaDailyOptions: { value: string, label: string }[] = [] | 10 | videoQuotaDailyOptions: { value: string, label: string }[] = [] |
10 | username: string | 11 | username: string |
11 | userId: number | 12 | userId: number |
12 | 13 | ||
14 | protected serverConfig: ServerConfig | ||
15 | |||
13 | protected abstract serverService: ServerService | 16 | protected abstract serverService: ServerService |
14 | protected abstract configService: ConfigService | 17 | protected abstract configService: ConfigService |
15 | protected abstract auth: AuthService | 18 | protected abstract auth: AuthService |
16 | abstract isCreation (): boolean | 19 | abstract isCreation (): boolean |
17 | abstract getFormButtonTitle (): string | 20 | abstract getFormButtonTitle (): string |
18 | 21 | ||
22 | ngOnInit (): void { | ||
23 | this.serverConfig = this.serverService.getTmpConfig() | ||
24 | this.serverService.getConfig() | ||
25 | .subscribe(config => this.serverConfig = config) | ||
26 | } | ||
27 | |||
19 | getRoles () { | 28 | getRoles () { |
20 | const authUser = this.auth.getUser() | 29 | const authUser = this.auth.getUser() |
21 | 30 | ||
@@ -32,12 +41,12 @@ export abstract class UserEdit extends FormReactive { | |||
32 | isTranscodingInformationDisplayed () { | 41 | isTranscodingInformationDisplayed () { |
33 | const formVideoQuota = parseInt(this.form.value['videoQuota'], 10) | 42 | const formVideoQuota = parseInt(this.form.value['videoQuota'], 10) |
34 | 43 | ||
35 | return this.serverService.getConfig().transcoding.enabledResolutions.length !== 0 && | 44 | return this.serverConfig.transcoding.enabledResolutions.length !== 0 && |
36 | formVideoQuota > 0 | 45 | formVideoQuota > 0 |
37 | } | 46 | } |
38 | 47 | ||
39 | computeQuotaWithTranscoding () { | 48 | computeQuotaWithTranscoding () { |
40 | const transcodingConfig = this.serverService.getConfig().transcoding | 49 | const transcodingConfig = this.serverConfig.transcoding |
41 | 50 | ||
42 | const resolutions = transcodingConfig.enabledResolutions | 51 | const resolutions = transcodingConfig.enabledResolutions |
43 | const higherResolution = VideoResolution.H_4K | 52 | const higherResolution = VideoResolution.H_4K |
diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts index c7052a925..d1682a99d 100644 --- a/client/src/app/+admin/users/user-edit/user-update.component.ts +++ b/client/src/app/+admin/users/user-edit/user-update.component.ts | |||
@@ -43,6 +43,8 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
43 | } | 43 | } |
44 | 44 | ||
45 | ngOnInit () { | 45 | ngOnInit () { |
46 | super.ngOnInit() | ||
47 | |||
46 | const defaultValues = { videoQuota: '-1', videoQuotaDaily: '-1' } | 48 | const defaultValues = { videoQuota: '-1', videoQuotaDaily: '-1' } |
47 | this.buildForm({ | 49 | this.buildForm({ |
48 | email: this.userValidatorsService.USER_EMAIL, | 50 | email: this.userValidatorsService.USER_EMAIL, |