2018-05-25 13:49:00 +00:00
|
|
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
2019-06-12 11:55:10 +00:00
|
|
|
import { MatPaginator } from '@angular/material/paginator';
|
|
|
|
import { MatSort } from '@angular/material/sort';
|
2018-05-25 13:49:00 +00:00
|
|
|
import {UserListDataSource} from './user-list-datasource';
|
2019-06-12 14:04:50 +00:00
|
|
|
import {User} from '../../core/user';
|
2018-05-25 13:49:00 +00:00
|
|
|
import {ActivatedRoute} from '@angular/router';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-user-list',
|
|
|
|
templateUrl: './user-list.component.html',
|
|
|
|
styleUrls: ['./user-list.component.css']
|
|
|
|
})
|
|
|
|
export class UserListComponent implements OnInit {
|
2019-06-12 11:55:10 +00:00
|
|
|
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
|
|
|
@ViewChild(MatSort, { static: true }) sort: MatSort;
|
2018-05-25 13:49:00 +00:00
|
|
|
dataSource: UserListDataSource;
|
|
|
|
list: User[];
|
|
|
|
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
|
|
|
displayedColumns = ['name', 'lockedOut', 'groups'];
|
|
|
|
|
|
|
|
constructor(private route: ActivatedRoute) {
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.route.data
|
|
|
|
.subscribe((data: { list: User[] }) => {
|
|
|
|
this.list = data.list;
|
|
|
|
});
|
|
|
|
this.dataSource = new UserListDataSource(this.paginator, this.sort, this.list);
|
|
|
|
}
|
|
|
|
}
|