aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-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
-rw-r--r--client/src/app/+admin/follows/followers-list/followers-list.component.html5
-rw-r--r--client/src/app/+admin/follows/following-list/following-list.component.html5
-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
7 files changed, 79 insertions, 42 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')
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.html b/client/src/app/+admin/follows/followers-list/followers-list.component.html
index 1a6ed616a..5645a60cc 100644
--- a/client/src/app/+admin/follows/followers-list/followers-list.component.html
+++ b/client/src/app/+admin/follows/followers-list/followers-list.component.html
@@ -19,7 +19,10 @@
19 <td>{{ follow.score }}</td> 19 <td>{{ follow.score }}</td>
20 <td>{{ follow.follower.name }}</td> 20 <td>{{ follow.follower.name }}</td>
21 <td>{{ follow.follower.host }}</td> 21 <td>{{ follow.follower.host }}</td>
22 <td>{{ follow.state }}</td> 22
23 <td *ngIf="follow.state === 'accepted'" i18n>Accepted</td>
24 <td *ngIf="follow.state === 'pending'" i18n>Pending</td>
25
23 <td>{{ follow.createdAt }}</td> 26 <td>{{ follow.createdAt }}</td>
24 </tr> 27 </tr>
25 </ng-template> 28 </ng-template>
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.html b/client/src/app/+admin/follows/following-list/following-list.component.html
index 66ab64c50..8af624ac5 100644
--- a/client/src/app/+admin/follows/following-list/following-list.component.html
+++ b/client/src/app/+admin/follows/following-list/following-list.component.html
@@ -17,7 +17,10 @@
17 <tr> 17 <tr>
18 <td>{{ follow.id }}</td> 18 <td>{{ follow.id }}</td>
19 <td>{{ follow.following.host }}</td> 19 <td>{{ follow.following.host }}</td>
20 <td>{{ follow.state }}</td> 20
21 <td *ngIf="follow.state === 'accepted'" i18n>Accepted</td>
22 <td *ngIf="follow.state === 'pending'" i18n>Pending</td>
23
21 <td>{{ follow.createdAt }}</td> 24 <td>{{ follow.createdAt }}</td>
22 <td> 25 <td>
23 <my-redundancy-checkbox 26 <my-redundancy-checkbox
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 () {