aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-18 15:31:54 +0100
committerChocobozzz <me@florianbigard.com>2019-12-18 15:40:59 +0100
commitba430d7516bc5b1324b60571ba7594460969b7fb (patch)
treedf5c6952c82f49a94c0a884bbc97d4a0cbd9f867 /client/src/app/+admin/users
parent5dfb7c1dec8222b0bbccac5b56ad46da1438747e (diff)
downloadPeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.gz
PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.zst
PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.zip
Lazy load static objects
Diffstat (limited to 'client/src/app/+admin/users')
-rw-r--r--client/src/app/+admin/users/user-edit/user-create.component.ts2
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.ts17
-rw-r--r--client/src/app/+admin/users/user-edit/user-update.component.ts2
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.ts10
4 files changed, 25 insertions, 6 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 3b57a49c6..e726ec4d7 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
@@ -34,6 +34,8 @@ export class UserCreateComponent extends UserEdit implements OnInit {
34 } 34 }
35 35
36 ngOnInit () { 36 ngOnInit () {
37 super.ngOnInit()
38
37 const defaultValues = { 39 const defaultValues = {
38 role: UserRole.USER.toString(), 40 role: UserRole.USER.toString(),
39 videoQuota: '-1', 41 videoQuota: '-1',
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 @@
1import { AuthService, ServerService } from '../../../core' 1import { AuthService, ServerService } from '../../../core'
2import { FormReactive } from '../../../shared' 2import { FormReactive } from '../../../shared'
3import { USER_ROLE_LABELS, UserRole, VideoResolution } from '../../../../../../shared' 3import { ServerConfig, USER_ROLE_LABELS, UserRole, VideoResolution } from '../../../../../../shared'
4import { ConfigService } from '@app/+admin/config/shared/config.service' 4import { ConfigService } from '@app/+admin/config/shared/config.service'
5import { UserAdminFlag } from '@shared/models/users/user-flag.model' 5import { UserAdminFlag } from '@shared/models/users/user-flag.model'
6import { OnInit } from '@angular/core'
6 7
7export abstract class UserEdit extends FormReactive { 8export 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
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 c7052a925..d1682a99d 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
@@ -43,6 +43,8 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
43 } 43 }
44 44
45 ngOnInit () { 45 ngOnInit () {
46 super.ngOnInit()
47
46 const defaultValues = { videoQuota: '-1', videoQuotaDaily: '-1' } 48 const defaultValues = { videoQuota: '-1', videoQuotaDaily: '-1' }
47 this.buildForm({ 49 this.buildForm({
48 email: this.userValidatorsService.USER_EMAIL, 50 email: this.userValidatorsService.USER_EMAIL,
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts
index ab82713b2..1083ba291 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/users/user-list/user-list.component.ts
@@ -4,7 +4,7 @@ import { SortMeta } from 'primeng/components/common/sortmeta'
4import { ConfirmService, ServerService } from '../../../core' 4import { ConfirmService, ServerService } from '../../../core'
5import { RestPagination, RestTable, UserService } from '../../../shared' 5import { RestPagination, RestTable, UserService } from '../../../shared'
6import { I18n } from '@ngx-translate/i18n-polyfill' 6import { I18n } from '@ngx-translate/i18n-polyfill'
7import { User } from '../../../../../../shared' 7import { ServerConfig, User } from '../../../../../../shared'
8import { UserBanModalComponent } from '@app/shared/moderation' 8import { UserBanModalComponent } from '@app/shared/moderation'
9import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' 9import { DropdownAction } from '@app/shared/buttons/action-dropdown.component'
10 10
@@ -25,6 +25,8 @@ export class UserListComponent extends RestTable implements OnInit {
25 selectedUsers: User[] = [] 25 selectedUsers: User[] = []
26 bulkUserActions: DropdownAction<User[]>[] = [] 26 bulkUserActions: DropdownAction<User[]>[] = []
27 27
28 private serverConfig: ServerConfig
29
28 constructor ( 30 constructor (
29 private notifier: Notifier, 31 private notifier: Notifier,
30 private confirmService: ConfirmService, 32 private confirmService: ConfirmService,
@@ -41,10 +43,14 @@ export class UserListComponent extends RestTable implements OnInit {
41 } 43 }
42 44
43 get requiresEmailVerification () { 45 get requiresEmailVerification () {
44 return this.serverService.getConfig().signup.requiresEmailVerification 46 return this.serverConfig.signup.requiresEmailVerification
45 } 47 }
46 48
47 ngOnInit () { 49 ngOnInit () {
50 this.serverConfig = this.serverService.getTmpConfig()
51 this.serverService.getConfig()
52 .subscribe(config => this.serverConfig = config)
53
48 this.initialize() 54 this.initialize()
49 55
50 this.bulkUserActions = [ 56 this.bulkUserActions = [