diff options
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.ts | 34 |
1 files changed, 20 insertions, 14 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 699b2a6da..69d4e917d 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 | |||
@@ -30,9 +30,9 @@ export class UserListComponent extends RestTable implements OnInit { | |||
30 | 30 | ||
31 | selectedUsers: User[] = [] | 31 | selectedUsers: User[] = [] |
32 | bulkUserActions: DropdownAction<User[]>[][] = [] | 32 | bulkUserActions: DropdownAction<User[]>[][] = [] |
33 | columns: { key: string, label: string }[] | 33 | columns: { id: string, label: string }[] |
34 | 34 | ||
35 | private _selectedColumns: { key: string, label: string }[] | 35 | private _selectedColumns: string[] |
36 | private serverConfig: ServerConfig | 36 | private serverConfig: ServerConfig |
37 | 37 | ||
38 | constructor ( | 38 | constructor ( |
@@ -60,7 +60,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
60 | return this._selectedColumns | 60 | return this._selectedColumns |
61 | } | 61 | } |
62 | 62 | ||
63 | set selectedColumns (val) { | 63 | set selectedColumns (val: string[]) { |
64 | this._selectedColumns = val | 64 | this._selectedColumns = val |
65 | } | 65 | } |
66 | 66 | ||
@@ -112,16 +112,18 @@ export class UserListComponent extends RestTable implements OnInit { | |||
112 | ] | 112 | ] |
113 | 113 | ||
114 | this.columns = [ | 114 | this.columns = [ |
115 | { key: 'username', label: 'Username' }, | 115 | { id: 'username', label: 'Username' }, |
116 | { key: 'email', label: 'Email' }, | 116 | { id: 'email', label: 'Email' }, |
117 | { key: 'quota', label: 'Video quota' }, | 117 | { id: 'quota', label: 'Video quota' }, |
118 | { key: 'role', label: 'Role' }, | 118 | { id: 'role', label: 'Role' }, |
119 | { key: 'createdAt', label: 'Created' } | 119 | { id: 'createdAt', label: 'Created' } |
120 | ] | 120 | ] |
121 | this.selectedColumns = [ ...this.columns ] // make a full copy of the array | 121 | |
122 | this.columns.push({ key: 'quotaDaily', label: 'Daily quota' }) | 122 | this.selectedColumns = this.columns.map(c => c.id) |
123 | this.columns.push({ key: 'pluginAuth', label: 'Auth plugin' }) | 123 | |
124 | this.columns.push({ key: 'lastLoginDate', label: 'Last login' }) | 124 | this.columns.push({ id: 'quotaDaily', label: 'Daily quota' }) |
125 | this.columns.push({ id: 'pluginAuth', label: 'Auth plugin' }) | ||
126 | this.columns.push({ id: 'lastLoginDate', label: 'Last login' }) | ||
125 | } | 127 | } |
126 | 128 | ||
127 | getIdentifier () { | 129 | getIdentifier () { |
@@ -139,8 +141,12 @@ export class UserListComponent extends RestTable implements OnInit { | |||
139 | } | 141 | } |
140 | } | 142 | } |
141 | 143 | ||
142 | getColumn (key: string) { | 144 | isSelected (id: string) { |
143 | return this.selectedColumns.find((col: { key: string }) => col.key === key) | 145 | return this.selectedColumns.find(c => c === id) |
146 | } | ||
147 | |||
148 | getColumn (id: string) { | ||
149 | return this.columns.find(c => c.id === id) | ||
144 | } | 150 | } |
145 | 151 | ||
146 | getUserVideoQuotaPercentage (user: UserForList) { | 152 | getUserVideoQuotaPercentage (user: UserForList) { |