mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Fixed #3907
This commit is contained in:
parent
fc94f5694d
commit
8f6ef2cdb2
2 changed files with 12 additions and 8 deletions
|
@ -7,7 +7,7 @@
|
|||
<button type="button" style="float:right;" mat-raised-button color="primary" (click)="showBulkEdit = !showBulkEdit" [disabled]="this.selection.selected.length <= 0">Bulk Edit</button>
|
||||
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="content" >
|
||||
<table mat-table *ngIf="dataSource" [dataSource]="dataSource" matSort class="mat-elevation-z8">
|
||||
|
||||
<ng-container matColumnDef="select">
|
||||
|
|
|
@ -10,7 +10,7 @@ import { SelectionModel } from "@angular/cdk/collections";
|
|||
templateUrl: "./usermanagement.component.html",
|
||||
styleUrls: ["./usermanagement.component.scss"],
|
||||
})
|
||||
export class UserManagementComponent implements OnInit, AfterViewInit {
|
||||
export class UserManagementComponent implements OnInit {
|
||||
|
||||
public displayedColumns: string[] = ['select', 'username', 'alias', 'email', 'roles', 'remainingRequests',
|
||||
'nextRequestDue', 'lastLoggedIn', 'userType', 'actions', 'welcome'];
|
||||
|
@ -32,13 +32,15 @@ export class UserManagementComponent implements OnInit, AfterViewInit {
|
|||
constructor(private identityService: IdentityService,
|
||||
private settingsService: SettingsService,
|
||||
private notificationService: NotificationService,
|
||||
private plexSettings: SettingsService) { }
|
||||
private plexSettings: SettingsService) {
|
||||
this.dataSource = new MatTableDataSource();
|
||||
}
|
||||
|
||||
|
||||
public async ngOnInit() {
|
||||
this.users = await this.identityService.getUsers().toPromise();
|
||||
|
||||
this.dataSource = new MatTableDataSource(this.users);
|
||||
this.dataSource.sort = this.sort;
|
||||
|
||||
this.plexSettings.getPlex().subscribe(x => this.plexEnabled = x.enable);
|
||||
|
||||
|
@ -47,10 +49,6 @@ export class UserManagementComponent implements OnInit, AfterViewInit {
|
|||
this.settingsService.getEmailNotificationSettings().subscribe(x => this.emailSettings = x);
|
||||
}
|
||||
|
||||
public ngAfterViewInit(): void {
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
public welcomeEmail(user: IUser) {
|
||||
if (!user.emailAddress) {
|
||||
this.notificationService.error("The user needs an email address.");
|
||||
|
@ -103,6 +101,9 @@ export class UserManagementComponent implements OnInit, AfterViewInit {
|
|||
}
|
||||
|
||||
public isAllSelected() {
|
||||
if (!this.dataSource) {
|
||||
return;
|
||||
}
|
||||
const numSelected = this.selection.selected.length;
|
||||
const numRows = this.dataSource.data.length;
|
||||
return numSelected === numRows;
|
||||
|
@ -110,6 +111,9 @@ export class UserManagementComponent implements OnInit, AfterViewInit {
|
|||
|
||||
|
||||
public masterToggle() {
|
||||
if (!this.dataSource) {
|
||||
return;
|
||||
}
|
||||
this.isAllSelected() ?
|
||||
this.selection.clear() :
|
||||
this.dataSource.data.forEach(row => this.selection.select(row));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue