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 | 25 |
1 files changed, 17 insertions, 8 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 339e18206..1c60adf89 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 | |||
@@ -1,8 +1,9 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { Component, OnInit, ViewChild } from '@angular/core' | 2 | import { Component, OnInit, ViewChild } from '@angular/core' |
3 | import { ActivatedRoute, Params, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core' | 4 | import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core' |
5 | import { Account, DropdownAction } from '@app/shared/shared-main' | 5 | import { AdvancedInputFilter } from '@app/shared/shared-forms' |
6 | import { DropdownAction } from '@app/shared/shared-main' | ||
6 | import { UserBanModalComponent } from '@app/shared/shared-moderation' | 7 | import { UserBanModalComponent } from '@app/shared/shared-moderation' |
7 | import { ServerConfig, User, UserRole } from '@shared/models' | 8 | import { ServerConfig, User, UserRole } from '@shared/models' |
8 | 9 | ||
@@ -22,15 +23,24 @@ export class UserListComponent extends RestTable implements OnInit { | |||
22 | @ViewChild('userBanModal', { static: true }) userBanModal: UserBanModalComponent | 23 | @ViewChild('userBanModal', { static: true }) userBanModal: UserBanModalComponent |
23 | 24 | ||
24 | users: User[] = [] | 25 | users: User[] = [] |
26 | |||
25 | totalRecords = 0 | 27 | totalRecords = 0 |
26 | sort: SortMeta = { field: 'createdAt', order: 1 } | 28 | sort: SortMeta = { field: 'createdAt', order: 1 } |
27 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 29 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
30 | |||
28 | highlightBannedUsers = false | 31 | highlightBannedUsers = false |
29 | 32 | ||
30 | selectedUsers: User[] = [] | 33 | selectedUsers: User[] = [] |
31 | bulkUserActions: DropdownAction<User[]>[][] = [] | 34 | bulkUserActions: DropdownAction<User[]>[][] = [] |
32 | columns: { id: string, label: string }[] | 35 | columns: { id: string, label: string }[] |
33 | 36 | ||
37 | inputFilters: AdvancedInputFilter[] = [ | ||
38 | { | ||
39 | queryParams: { 'search': 'banned:true' }, | ||
40 | label: $localize`Banned users` | ||
41 | } | ||
42 | ] | ||
43 | |||
34 | private _selectedColumns: string[] | 44 | private _selectedColumns: string[] |
35 | private serverConfig: ServerConfig | 45 | private serverConfig: ServerConfig |
36 | 46 | ||
@@ -68,7 +78,6 @@ export class UserListComponent extends RestTable implements OnInit { | |||
68 | .subscribe(config => this.serverConfig = config) | 78 | .subscribe(config => this.serverConfig = config) |
69 | 79 | ||
70 | this.initialize() | 80 | this.initialize() |
71 | this.listenToSearchChange() | ||
72 | 81 | ||
73 | this.bulkUserActions = [ | 82 | this.bulkUserActions = [ |
74 | [ | 83 | [ |
@@ -160,7 +169,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
160 | } | 169 | } |
161 | 170 | ||
162 | onUserChanged () { | 171 | onUserChanged () { |
163 | this.loadData() | 172 | this.reloadData() |
164 | } | 173 | } |
165 | 174 | ||
166 | async unbanUsers (users: User[]) { | 175 | async unbanUsers (users: User[]) { |
@@ -171,7 +180,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
171 | .subscribe( | 180 | .subscribe( |
172 | () => { | 181 | () => { |
173 | this.notifier.success($localize`${users.length} users unbanned.`) | 182 | this.notifier.success($localize`${users.length} users unbanned.`) |
174 | this.loadData() | 183 | this.reloadData() |
175 | }, | 184 | }, |
176 | 185 | ||
177 | err => this.notifier.error(err.message) | 186 | err => this.notifier.error(err.message) |
@@ -193,7 +202,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
193 | this.userService.removeUser(users).subscribe( | 202 | this.userService.removeUser(users).subscribe( |
194 | () => { | 203 | () => { |
195 | this.notifier.success($localize`${users.length} users deleted.`) | 204 | this.notifier.success($localize`${users.length} users deleted.`) |
196 | this.loadData() | 205 | this.reloadData() |
197 | }, | 206 | }, |
198 | 207 | ||
199 | err => this.notifier.error(err.message) | 208 | err => this.notifier.error(err.message) |
@@ -204,7 +213,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
204 | this.userService.updateUsers(users, { emailVerified: true }).subscribe( | 213 | this.userService.updateUsers(users, { emailVerified: true }).subscribe( |
205 | () => { | 214 | () => { |
206 | this.notifier.success($localize`${users.length} users email set as verified.`) | 215 | this.notifier.success($localize`${users.length} users email set as verified.`) |
207 | this.loadData() | 216 | this.reloadData() |
208 | }, | 217 | }, |
209 | 218 | ||
210 | err => this.notifier.error(err.message) | 219 | err => this.notifier.error(err.message) |
@@ -215,7 +224,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
215 | return this.selectedUsers.length !== 0 | 224 | return this.selectedUsers.length !== 0 |
216 | } | 225 | } |
217 | 226 | ||
218 | protected loadData () { | 227 | protected reloadData () { |
219 | this.selectedUsers = [] | 228 | this.selectedUsers = [] |
220 | 229 | ||
221 | this.userService.getUsers({ | 230 | this.userService.getUsers({ |