aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/config
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/config
parent4a216666e7f353e638c6927a9ff0c8fce4e94014 (diff)
downloadPeerTube-3827c3b3488845f4235714e92eea439423df2909.tar.gz
PeerTube-3827c3b3488845f4235714e92eea439423df2909.tar.zst
PeerTube-3827c3b3488845f4235714e92eea439423df2909.zip
Fix quota translations
Diffstat (limited to 'client/src/app/+admin/config')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts51
-rw-r--r--client/src/app/+admin/config/shared/config.service.ts31
2 files changed, 49 insertions, 33 deletions
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 9b3bd86f1..4983b0425 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
@@ -14,37 +14,10 @@ import { BuildFormDefaultValues, FormValidatorService } from '@app/shared/forms/
14 styleUrls: [ './edit-custom-config.component.scss' ] 14 styleUrls: [ './edit-custom-config.component.scss' ]
15}) 15})
16export class EditCustomConfigComponent extends FormReactive implements OnInit { 16export class EditCustomConfigComponent extends FormReactive implements OnInit {
17 static videoQuotaOptions = [
18 { value: -1, label: 'Unlimited' },
19 { value: 0, label: '0' },
20 { value: 100 * 1024 * 1024, label: '100MB' },
21 { value: 500 * 1024 * 1024, label: '500MB' },
22 { value: 1024 * 1024 * 1024, label: '1GB' },
23 { value: 5 * 1024 * 1024 * 1024, label: '5GB' },
24 { value: 20 * 1024 * 1024 * 1024, label: '20GB' },
25 { value: 50 * 1024 * 1024 * 1024, label: '50GB' }
26 ]
27 static videoQuotaDailyOptions = [
28 { value: -1, label: 'Unlimited' },
29 { value: 0, label: '0' },
30 { value: 10 * 1024 * 1024, label: '10MB' },
31 { value: 50 * 1024 * 1024, label: '50MB' },
32 { value: 100 * 1024 * 1024, label: '100MB' },
33 { value: 500 * 1024 * 1024, label: '500MB' },
34 { value: 2 * 1024 * 1024 * 1024, label: '2GB' },
35 { value: 5 * 1024 * 1024 * 1024, label: '5GB' }
36 ]
37
38 customConfig: CustomConfig 17 customConfig: CustomConfig
39 resolutions = [ '240p', '360p', '480p', '720p', '1080p' ]
40 18
41 transcodingThreadOptions = [ 19 resolutions: string[] = []
42 { value: 0, label: 'Auto (via ffmpeg)' }, 20 transcodingThreadOptions: { label: string, value: number }[] = []
43 { value: 1, label: '1' },
44 { value: 2, label: '2' },
45 { value: 4, label: '4' },
46 { value: 8, label: '8' }
47 ]
48 21
49 private oldCustomJavascript: string 22 private oldCustomJavascript: string
50 private oldCustomCSS: string 23 private oldCustomCSS: string
@@ -60,14 +33,30 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
60 private i18n: I18n 33 private i18n: I18n
61 ) { 34 ) {
62 super() 35 super()
36
37 this.resolutions = [
38 this.i18n('240p'),
39 this.i18n('360p'),
40 this.i18n('480p'),
41 this.i18n('720p'),
42 this.i18n('1080p')
43 ]
44
45 this.transcodingThreadOptions = [
46 { value: 0, label: this.i18n('Auto (via ffmpeg)') },
47 { value: 1, label: '1' },
48 { value: 2, label: '2' },
49 { value: 4, label: '4' },
50 { value: 8, label: '8' }
51 ]
63 } 52 }
64 53
65 get videoQuotaOptions () { 54 get videoQuotaOptions () {
66 return EditCustomConfigComponent.videoQuotaOptions 55 return this.configService.videoQuotaOptions
67 } 56 }
68 57
69 get videoQuotaDailyOptions () { 58 get videoQuotaDailyOptions () {
70 return EditCustomConfigComponent.videoQuotaDailyOptions 59 return this.configService.videoQuotaDailyOptions
71 } 60 }
72 61
73 getResolutionKey (resolution: string) { 62 getResolutionKey (resolution: string) {
diff --git a/client/src/app/+admin/config/shared/config.service.ts b/client/src/app/+admin/config/shared/config.service.ts
index 7c61fe9e7..28a3d67d6 100644
--- a/client/src/app/+admin/config/shared/config.service.ts
+++ b/client/src/app/+admin/config/shared/config.service.ts
@@ -4,15 +4,42 @@ import { Injectable } from '@angular/core'
4import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' 4import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model'
5import { environment } from '../../../../environments/environment' 5import { environment } from '../../../../environments/environment'
6import { RestExtractor } from '../../../shared' 6import { RestExtractor } from '../../../shared'
7import { I18n } from '@ngx-translate/i18n-polyfill'
7 8
8@Injectable() 9@Injectable()
9export class ConfigService { 10export class ConfigService {
10 private static BASE_APPLICATION_URL = environment.apiUrl + '/api/v1/config' 11 private static BASE_APPLICATION_URL = environment.apiUrl + '/api/v1/config'
11 12
13 videoQuotaOptions: { value: number, label: string }[] = []
14 videoQuotaDailyOptions: { value: number, label: string }[] = []
15
12 constructor ( 16 constructor (
13 private authHttp: HttpClient, 17 private authHttp: HttpClient,
14 private restExtractor: RestExtractor 18 private restExtractor: RestExtractor,
15 ) {} 19 private i18n: I18n
20 ) {
21 this.videoQuotaOptions = [
22 { value: -1, label: this.i18n('Unlimited') },
23 { value: 0, label: '0' },
24 { value: 100 * 1024 * 1024, label: this.i18n('100MB') },
25 { value: 500 * 1024 * 1024, label: this.i18n('500MB') },
26 { value: 1024 * 1024 * 1024, label: this.i18n('1GB') },
27 { value: 5 * 1024 * 1024 * 1024, label: this.i18n('5GB') },
28 { value: 20 * 1024 * 1024 * 1024, label: this.i18n('20GB') },
29 { value: 50 * 1024 * 1024 * 1024, label: this.i18n('50GB') }
30 ]
31
32 this.videoQuotaDailyOptions = [
33 { value: -1, label: this.i18n('Unlimited') },
34 { value: 0, label: '0' },
35 { value: 10 * 1024 * 1024, label: this.i18n('10MB') },
36 { value: 50 * 1024 * 1024, label: this.i18n('50MB') },
37 { value: 100 * 1024 * 1024, label: this.i18n('100MB') },
38 { value: 500 * 1024 * 1024, label: this.i18n('500MB') },
39 { value: 2 * 1024 * 1024 * 1024, label: this.i18n('2GB') },
40 { value: 5 * 1024 * 1024 * 1024, label: this.i18n('5GB') }
41 ]
42 }
16 43
17 getCustomConfig () { 44 getCustomConfig () {
18 return this.authHttp.get<CustomConfig>(ConfigService.BASE_APPLICATION_URL + '/custom') 45 return this.authHttp.get<CustomConfig>(ConfigService.BASE_APPLICATION_URL + '/custom')