mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -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>
|
<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>
|
||||||
<div class="content">
|
<div class="content" >
|
||||||
<table mat-table *ngIf="dataSource" [dataSource]="dataSource" matSort class="mat-elevation-z8">
|
<table mat-table *ngIf="dataSource" [dataSource]="dataSource" matSort class="mat-elevation-z8">
|
||||||
|
|
||||||
<ng-container matColumnDef="select">
|
<ng-container matColumnDef="select">
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { SelectionModel } from "@angular/cdk/collections";
|
||||||
templateUrl: "./usermanagement.component.html",
|
templateUrl: "./usermanagement.component.html",
|
||||||
styleUrls: ["./usermanagement.component.scss"],
|
styleUrls: ["./usermanagement.component.scss"],
|
||||||
})
|
})
|
||||||
export class UserManagementComponent implements OnInit, AfterViewInit {
|
export class UserManagementComponent implements OnInit {
|
||||||
|
|
||||||
public displayedColumns: string[] = ['select', 'username', 'alias', 'email', 'roles', 'remainingRequests',
|
public displayedColumns: string[] = ['select', 'username', 'alias', 'email', 'roles', 'remainingRequests',
|
||||||
'nextRequestDue', 'lastLoggedIn', 'userType', 'actions', 'welcome'];
|
'nextRequestDue', 'lastLoggedIn', 'userType', 'actions', 'welcome'];
|
||||||
|
@ -32,13 +32,15 @@ export class UserManagementComponent implements OnInit, AfterViewInit {
|
||||||
constructor(private identityService: IdentityService,
|
constructor(private identityService: IdentityService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
private plexSettings: SettingsService) { }
|
private plexSettings: SettingsService) {
|
||||||
|
this.dataSource = new MatTableDataSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public async ngOnInit() {
|
public async ngOnInit() {
|
||||||
this.users = await this.identityService.getUsers().toPromise();
|
this.users = await this.identityService.getUsers().toPromise();
|
||||||
|
|
||||||
this.dataSource = new MatTableDataSource(this.users);
|
this.dataSource = new MatTableDataSource(this.users);
|
||||||
|
this.dataSource.sort = this.sort;
|
||||||
|
|
||||||
this.plexSettings.getPlex().subscribe(x => this.plexEnabled = x.enable);
|
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);
|
this.settingsService.getEmailNotificationSettings().subscribe(x => this.emailSettings = x);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngAfterViewInit(): void {
|
|
||||||
this.dataSource.sort = this.sort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public welcomeEmail(user: IUser) {
|
public welcomeEmail(user: IUser) {
|
||||||
if (!user.emailAddress) {
|
if (!user.emailAddress) {
|
||||||
this.notificationService.error("The user needs an email address.");
|
this.notificationService.error("The user needs an email address.");
|
||||||
|
@ -103,6 +101,9 @@ export class UserManagementComponent implements OnInit, AfterViewInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public isAllSelected() {
|
public isAllSelected() {
|
||||||
|
if (!this.dataSource) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const numSelected = this.selection.selected.length;
|
const numSelected = this.selection.selected.length;
|
||||||
const numRows = this.dataSource.data.length;
|
const numRows = this.dataSource.data.length;
|
||||||
return numSelected === numRows;
|
return numSelected === numRows;
|
||||||
|
@ -110,6 +111,9 @@ export class UserManagementComponent implements OnInit, AfterViewInit {
|
||||||
|
|
||||||
|
|
||||||
public masterToggle() {
|
public masterToggle() {
|
||||||
|
if (!this.dataSource) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.isAllSelected() ?
|
this.isAllSelected() ?
|
||||||
this.selection.clear() :
|
this.selection.clear() :
|
||||||
this.dataSource.data.forEach(row => this.selection.select(row));
|
this.dataSource.data.forEach(row => this.selection.select(row));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue