aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/users/user-list/user-list.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/users/user-list/user-list.component.ts')
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.ts17
1 files changed, 12 insertions, 5 deletions
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 b2978212e..699b2a6da 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
@@ -7,6 +7,13 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
7import { ServerConfig, User, UserRole } from '@shared/models' 7import { ServerConfig, User, UserRole } from '@shared/models'
8import { Params, Router, ActivatedRoute } from '@angular/router' 8import { Params, Router, ActivatedRoute } from '@angular/router'
9 9
10type UserForList = User & {
11 rawVideoQuota: number
12 rawVideoQuotaUsed: number
13 rawVideoQuotaDaily: number
14 rawVideoQuotaUsedDaily: number
15}
16
10@Component({ 17@Component({
11 selector: 'my-user-list', 18 selector: 'my-user-list',
12 templateUrl: './user-list.component.html', 19 templateUrl: './user-list.component.html',
@@ -24,8 +31,8 @@ export class UserListComponent extends RestTable implements OnInit {
24 selectedUsers: User[] = [] 31 selectedUsers: User[] = []
25 bulkUserActions: DropdownAction<User[]>[][] = [] 32 bulkUserActions: DropdownAction<User[]>[][] = []
26 columns: { key: string, label: string }[] 33 columns: { key: string, label: string }[]
27 _selectedColumns: { key: string, label: string }[]
28 34
35 private _selectedColumns: { key: string, label: string }[]
29 private serverConfig: ServerConfig 36 private serverConfig: ServerConfig
30 37
31 constructor ( 38 constructor (
@@ -111,7 +118,7 @@ export class UserListComponent extends RestTable implements OnInit {
111 { key: 'role', label: 'Role' }, 118 { key: 'role', label: 'Role' },
112 { key: 'createdAt', label: 'Created' } 119 { key: 'createdAt', label: 'Created' }
113 ] 120 ]
114 this.selectedColumns = [...this.columns] 121 this.selectedColumns = [ ...this.columns ] // make a full copy of the array
115 this.columns.push({ key: 'quotaDaily', label: 'Daily quota' }) 122 this.columns.push({ key: 'quotaDaily', label: 'Daily quota' })
116 this.columns.push({ key: 'pluginAuth', label: 'Auth plugin' }) 123 this.columns.push({ key: 'pluginAuth', label: 'Auth plugin' })
117 this.columns.push({ key: 'lastLoginDate', label: 'Last login' }) 124 this.columns.push({ key: 'lastLoginDate', label: 'Last login' })
@@ -133,14 +140,14 @@ export class UserListComponent extends RestTable implements OnInit {
133 } 140 }
134 141
135 getColumn (key: string) { 142 getColumn (key: string) {
136 return this.selectedColumns.find((col: any) => col.key === key) 143 return this.selectedColumns.find((col: { key: string }) => col.key === key)
137 } 144 }
138 145
139 getUserVideoQuotaPercentage (user: User & { rawVideoQuota: number, rawVideoQuotaUsed: number}) { 146 getUserVideoQuotaPercentage (user: UserForList) {
140 return user.rawVideoQuotaUsed * 100 / user.rawVideoQuota 147 return user.rawVideoQuotaUsed * 100 / user.rawVideoQuota
141 } 148 }
142 149
143 getUserVideoQuotaDailyPercentage (user: User & { rawVideoQuotaDaily: number, rawVideoQuotaUsedDaily: number}) { 150 getUserVideoQuotaDailyPercentage (user: UserForList) {
144 return user.rawVideoQuotaUsedDaily * 100 / user.rawVideoQuotaDaily 151 return user.rawVideoQuotaUsedDaily * 100 / user.rawVideoQuotaDaily
145 } 152 }
146 153