diff options
Diffstat (limited to 'client/src/app/+admin/users/user-edit/user-edit.ts')
-rw-r--r-- | client/src/app/+admin/users/user-edit/user-edit.ts | 17 |
1 files changed, 13 insertions, 4 deletions
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 |