-export class UserListComponent {
- usersSource: RestDataSource = null
- tableSettings = {
- mode: 'external',
- attr: {
- class: 'table-hover'
- },
- hideSubHeader: true,
- actions: {
- position: 'right',
- add: false,
- edit: false,
- delete: true
- },
- delete: {
- deleteButtonContent: Utils.getRowDeleteButton()
- },
- pager: {
- display: true,
- perPage: 1
- },
- columns: {
- id: {
- title: 'ID',
- sortDirection: 'asc'
- },
- username: {
- title: 'Username'
- },
- email: {
- title: 'Email'
+export class UserListComponent extends RestTable implements OnInit {
+ @ViewChild('userBanModal', { static: true }) userBanModal: UserBanModalComponent
+
+ users: User[] = []
+ totalRecords = 0
+ rowsPerPage = 10
+ sort: SortMeta = { field: 'createdAt', order: 1 }
+ pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
+
+ selectedUsers: User[] = []
+ bulkUserActions: DropdownAction<User[]>[] = []
+
+ constructor (
+ private notifier: Notifier,
+ private confirmService: ConfirmService,
+ private serverService: ServerService,
+ private userService: UserService,
+ private auth: AuthService,
+ private i18n: I18n
+ ) {
+ super()
+ }
+
+ get authUser () {
+ return this.auth.getUser()
+ }
+
+ get requiresEmailVerification () {
+ return this.serverService.getConfig().signup.requiresEmailVerification
+ }
+
+ ngOnInit () {
+ this.initialize()
+
+ this.bulkUserActions = [
+ {
+ label: this.i18n('Delete'),
+ handler: users => this.removeUsers(users),
+ isDisplayed: users => users.every(u => this.authUser.canManage(u))