diff options
Diffstat (limited to 'client/src/app/+admin/users/user-edit')
3 files changed, 22 insertions, 7 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 25c060344..132e280b9 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 | |||
@@ -8,6 +8,7 @@ import { UserEdit } from './user-edit' | |||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | 8 | import { I18n } from '@ngx-translate/i18n-polyfill' |
9 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 9 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
10 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' | 10 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' |
11 | import { ConfigService } from '@app/+admin/config/shared/config.service' | ||
11 | 12 | ||
12 | @Component({ | 13 | @Component({ |
13 | selector: 'my-user-create', | 14 | selector: 'my-user-create', |
@@ -20,6 +21,7 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
20 | constructor ( | 21 | constructor ( |
21 | protected serverService: ServerService, | 22 | protected serverService: ServerService, |
22 | protected formValidatorService: FormValidatorService, | 23 | protected formValidatorService: FormValidatorService, |
24 | protected configService: ConfigService, | ||
23 | private userValidatorsService: UserValidatorsService, | 25 | private userValidatorsService: UserValidatorsService, |
24 | private router: Router, | 26 | private router: Router, |
25 | private notificationsService: NotificationsService, | 27 | private notificationsService: NotificationsService, |
@@ -27,6 +29,8 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
27 | private i18n: I18n | 29 | private i18n: I18n |
28 | ) { | 30 | ) { |
29 | super() | 31 | super() |
32 | |||
33 | this.buildQuotaOptions() | ||
30 | } | 34 | } |
31 | 35 | ||
32 | ngOnInit () { | 36 | ngOnInit () { |
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 4e7ca8a1b..07b087b5b 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts | |||
@@ -2,18 +2,16 @@ import { ServerService } from '../../../core' | |||
2 | import { FormReactive } from '../../../shared' | 2 | import { FormReactive } from '../../../shared' |
3 | import { USER_ROLE_LABELS, VideoResolution } from '../../../../../../shared' | 3 | import { USER_ROLE_LABELS, VideoResolution } from '../../../../../../shared' |
4 | import { EditCustomConfigComponent } from '../../../+admin/config/edit-custom-config/' | 4 | import { EditCustomConfigComponent } from '../../../+admin/config/edit-custom-config/' |
5 | import { ConfigService } from '@app/+admin/config/shared/config.service' | ||
5 | 6 | ||
6 | export abstract class UserEdit extends FormReactive { | 7 | export abstract class UserEdit extends FormReactive { |
7 | 8 | ||
8 | // These are used by a HTML select, so convert key into strings | 9 | videoQuotaOptions: { value: string, label: string }[] = [] |
9 | videoQuotaOptions = EditCustomConfigComponent.videoQuotaOptions | 10 | videoQuotaDailyOptions: { value: string, label: string }[] = [] |
10 | .map(q => ({ value: q.value.toString(), label: q.label })) | ||
11 | videoQuotaDailyOptions = EditCustomConfigComponent.videoQuotaDailyOptions | ||
12 | .map(q => ({ value: q.value.toString(), label: q.label })) | ||
13 | |||
14 | roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) | 11 | roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) |
15 | 12 | ||
16 | protected abstract serverService: ServerService | 13 | protected abstract serverService: ServerService |
14 | protected abstract configService: ConfigService | ||
17 | abstract isCreation (): boolean | 15 | abstract isCreation (): boolean |
18 | abstract getFormButtonTitle (): string | 16 | abstract getFormButtonTitle (): string |
19 | 17 | ||
@@ -35,4 +33,13 @@ export abstract class UserEdit extends FormReactive { | |||
35 | 33 | ||
36 | return multiplier * parseInt(this.form.value['videoQuota'], 10) | 34 | return multiplier * parseInt(this.form.value['videoQuota'], 10) |
37 | } | 35 | } |
36 | |||
37 | protected buildQuotaOptions () { | ||
38 | // These are used by a HTML select, so convert key into strings | ||
39 | this.videoQuotaOptions = this.configService | ||
40 | .videoQuotaOptions.map(q => ({ value: q.value.toString(), label: q.label })) | ||
41 | |||
42 | this.videoQuotaDailyOptions = this.configService | ||
43 | .videoQuotaDailyOptions.map(q => ({ value: q.value.toString(), label: q.label })) | ||
44 | } | ||
38 | } | 45 | } |
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 5821229b3..9eb91ac95 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 | |||
@@ -5,10 +5,11 @@ import { NotificationsService } from 'angular2-notifications' | |||
5 | import { UserService } from '../shared' | 5 | import { UserService } from '../shared' |
6 | import { ServerService } from '../../../core' | 6 | import { ServerService } from '../../../core' |
7 | import { UserEdit } from './user-edit' | 7 | import { UserEdit } from './user-edit' |
8 | import { UserUpdate, User } from '../../../../../../shared' | 8 | import { User, UserUpdate } from '../../../../../../shared' |
9 | import { I18n } from '@ngx-translate/i18n-polyfill' | 9 | import { I18n } from '@ngx-translate/i18n-polyfill' |
10 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 10 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
11 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' | 11 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' |
12 | import { ConfigService } from '@app/+admin/config/shared/config.service' | ||
12 | 13 | ||
13 | @Component({ | 14 | @Component({ |
14 | selector: 'my-user-update', | 15 | selector: 'my-user-update', |
@@ -25,6 +26,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
25 | constructor ( | 26 | constructor ( |
26 | protected formValidatorService: FormValidatorService, | 27 | protected formValidatorService: FormValidatorService, |
27 | protected serverService: ServerService, | 28 | protected serverService: ServerService, |
29 | protected configService: ConfigService, | ||
28 | private userValidatorsService: UserValidatorsService, | 30 | private userValidatorsService: UserValidatorsService, |
29 | private route: ActivatedRoute, | 31 | private route: ActivatedRoute, |
30 | private router: Router, | 32 | private router: Router, |
@@ -33,6 +35,8 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
33 | private i18n: I18n | 35 | private i18n: I18n |
34 | ) { | 36 | ) { |
35 | super() | 37 | super() |
38 | |||
39 | this.buildQuotaOptions() | ||
36 | } | 40 | } |
37 | 41 | ||
38 | ngOnInit () { | 42 | ngOnInit () { |