aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-26 14:46:54 +0200
committerChocobozzz <me@florianbigard.com>2018-09-26 14:50:39 +0200
commit3827c3b3488845f4235714e92eea439423df2909 (patch)
tree2254b6ab4745099730c384110665fb11c5e82f52 /client/src/app/+admin/users
parent4a216666e7f353e638c6927a9ff0c8fce4e94014 (diff)
downloadPeerTube-3827c3b3488845f4235714e92eea439423df2909.tar.gz
PeerTube-3827c3b3488845f4235714e92eea439423df2909.tar.zst
PeerTube-3827c3b3488845f4235714e92eea439423df2909.zip
Fix quota translations
Diffstat (limited to 'client/src/app/+admin/users')
-rw-r--r--client/src/app/+admin/users/user-edit/user-create.component.ts4
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.ts19
-rw-r--r--client/src/app/+admin/users/user-edit/user-update.component.ts6
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'
8import { I18n } from '@ngx-translate/i18n-polyfill' 8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 9import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
10import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' 10import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service'
11import { 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'
2import { FormReactive } from '../../../shared' 2import { FormReactive } from '../../../shared'
3import { USER_ROLE_LABELS, VideoResolution } from '../../../../../../shared' 3import { USER_ROLE_LABELS, VideoResolution } from '../../../../../../shared'
4import { EditCustomConfigComponent } from '../../../+admin/config/edit-custom-config/' 4import { EditCustomConfigComponent } from '../../../+admin/config/edit-custom-config/'
5import { ConfigService } from '@app/+admin/config/shared/config.service'
5 6
6export abstract class UserEdit extends FormReactive { 7export 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'
5import { UserService } from '../shared' 5import { UserService } from '../shared'
6import { ServerService } from '../../../core' 6import { ServerService } from '../../../core'
7import { UserEdit } from './user-edit' 7import { UserEdit } from './user-edit'
8import { UserUpdate, User } from '../../../../../../shared' 8import { User, UserUpdate } from '../../../../../../shared'
9import { I18n } from '@ngx-translate/i18n-polyfill' 9import { I18n } from '@ngx-translate/i18n-polyfill'
10import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 10import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
11import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' 11import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service'
12import { 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 () {