diff options
Diffstat (limited to 'client/src/app/+admin/users')
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.html | 8 | ||||
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.ts | 19 |
2 files changed, 11 insertions, 16 deletions
diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index 7170d7019..44d8a7e87 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html | |||
@@ -1,7 +1,7 @@ | |||
1 | <p-table | 1 | <p-table |
2 | [value]="users" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions" | 2 | [value]="users" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions" |
3 | [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" [resizableColumns]="true" | 3 | [sortField]="sort.field" [sortOrder]="sort.order" dataKey="id" [resizableColumns]="true" [(selection)]="selectedUsers" |
4 | [(selection)]="selectedUsers" | 4 | [lazy]="true" (onLazyLoad)="loadLazy($event)" [lazyLoadOnInit]="false" |
5 | [showCurrentPageReport]="true" i18n-currentPageReportTemplate | 5 | [showCurrentPageReport]="true" i18n-currentPageReportTemplate |
6 | currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} users" | 6 | currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} users" |
7 | (onPage)="onPage($event)" [expandedRowKeys]="expandedRows" | 7 | (onPage)="onPage($event)" [expandedRowKeys]="expandedRows" |
@@ -22,7 +22,7 @@ | |||
22 | </div> | 22 | </div> |
23 | 23 | ||
24 | <div class="ml-auto"> | 24 | <div class="ml-auto"> |
25 | <my-advanced-input-filter [filters]="inputFilters" (search)="onSearch($event)" (resetTableFilter)="resetTableFilter()"></my-advanced-input-filter> | 25 | <my-advanced-input-filter [filters]="inputFilters" (search)="onSearch($event)"></my-advanced-input-filter> |
26 | </div> | 26 | </div> |
27 | 27 | ||
28 | </div> | 28 | </div> |
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 435bc17d7..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,5 +1,5 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core' | 2 | import { Component, OnInit, ViewChild } from '@angular/core' |
3 | import { ActivatedRoute, 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 { AdvancedInputFilter } from '@app/shared/shared-forms' | 5 | import { AdvancedInputFilter } from '@app/shared/shared-forms' |
@@ -19,7 +19,7 @@ type UserForList = User & { | |||
19 | templateUrl: './user-list.component.html', | 19 | templateUrl: './user-list.component.html', |
20 | styleUrls: [ './user-list.component.scss' ] | 20 | styleUrls: [ './user-list.component.scss' ] |
21 | }) | 21 | }) |
22 | export class UserListComponent extends RestTable implements OnInit, AfterViewInit { | 22 | export class UserListComponent extends RestTable implements OnInit { |
23 | @ViewChild('userBanModal', { static: true }) userBanModal: UserBanModalComponent | 23 | @ViewChild('userBanModal', { static: true }) userBanModal: UserBanModalComponent |
24 | 24 | ||
25 | users: User[] = [] | 25 | users: User[] = [] |
@@ -78,7 +78,6 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni | |||
78 | .subscribe(config => this.serverConfig = config) | 78 | .subscribe(config => this.serverConfig = config) |
79 | 79 | ||
80 | this.initialize() | 80 | this.initialize() |
81 | this.listenToSearchChange() | ||
82 | 81 | ||
83 | this.bulkUserActions = [ | 82 | this.bulkUserActions = [ |
84 | [ | 83 | [ |
@@ -127,10 +126,6 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni | |||
127 | this.columns.push({ id: 'lastLoginDate', label: 'Last login' }) | 126 | this.columns.push({ id: 'lastLoginDate', label: 'Last login' }) |
128 | } | 127 | } |
129 | 128 | ||
130 | ngAfterViewInit () { | ||
131 | if (this.search) this.setTableFilter(this.search, false) | ||
132 | } | ||
133 | |||
134 | getIdentifier () { | 129 | getIdentifier () { |
135 | return 'UserListComponent' | 130 | return 'UserListComponent' |
136 | } | 131 | } |
@@ -174,7 +169,7 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni | |||
174 | } | 169 | } |
175 | 170 | ||
176 | onUserChanged () { | 171 | onUserChanged () { |
177 | this.loadData() | 172 | this.reloadData() |
178 | } | 173 | } |
179 | 174 | ||
180 | async unbanUsers (users: User[]) { | 175 | async unbanUsers (users: User[]) { |
@@ -185,7 +180,7 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni | |||
185 | .subscribe( | 180 | .subscribe( |
186 | () => { | 181 | () => { |
187 | this.notifier.success($localize`${users.length} users unbanned.`) | 182 | this.notifier.success($localize`${users.length} users unbanned.`) |
188 | this.loadData() | 183 | this.reloadData() |
189 | }, | 184 | }, |
190 | 185 | ||
191 | err => this.notifier.error(err.message) | 186 | err => this.notifier.error(err.message) |
@@ -207,7 +202,7 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni | |||
207 | this.userService.removeUser(users).subscribe( | 202 | this.userService.removeUser(users).subscribe( |
208 | () => { | 203 | () => { |
209 | this.notifier.success($localize`${users.length} users deleted.`) | 204 | this.notifier.success($localize`${users.length} users deleted.`) |
210 | this.loadData() | 205 | this.reloadData() |
211 | }, | 206 | }, |
212 | 207 | ||
213 | err => this.notifier.error(err.message) | 208 | err => this.notifier.error(err.message) |
@@ -218,7 +213,7 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni | |||
218 | this.userService.updateUsers(users, { emailVerified: true }).subscribe( | 213 | this.userService.updateUsers(users, { emailVerified: true }).subscribe( |
219 | () => { | 214 | () => { |
220 | this.notifier.success($localize`${users.length} users email set as verified.`) | 215 | this.notifier.success($localize`${users.length} users email set as verified.`) |
221 | this.loadData() | 216 | this.reloadData() |
222 | }, | 217 | }, |
223 | 218 | ||
224 | err => this.notifier.error(err.message) | 219 | err => this.notifier.error(err.message) |
@@ -229,7 +224,7 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni | |||
229 | return this.selectedUsers.length !== 0 | 224 | return this.selectedUsers.length !== 0 |
230 | } | 225 | } |
231 | 226 | ||
232 | protected loadData () { | 227 | protected reloadData () { |
233 | this.selectedUsers = [] | 228 | this.selectedUsers = [] |
234 | 229 | ||
235 | this.userService.getUsers({ | 230 | this.userService.getUsers({ |