pull/3816/head
tidusjar 4 years ago
parent d54471b6e8
commit b31f8dd962

@ -8,7 +8,7 @@
</div>
<div class="content">
<table *ngIf="dataSource" mat-table [dataSource]="dataSource" matSort class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort class="mat-elevation-z8">
<ng-container matColumnDef="select">
<th mat-header-cell *matHeaderCellDef>

@ -1,4 +1,4 @@
import { Component, OnInit, ViewChild } from "@angular/core";
import { AfterViewInit, Component, OnInit, ViewChild } from "@angular/core";
import { ICheckbox, ICustomizationSettings, IEmailNotificationSettings, IUser } from "../interfaces";
import { IdentityService, NotificationService, SettingsService } from "../services";
@ -10,7 +10,7 @@ import { SelectionModel } from "@angular/cdk/collections";
templateUrl: "./usermanagement.component.html",
styleUrls: ["./usermanagement.component.scss"],
})
export class UserManagementComponent implements OnInit {
export class UserManagementComponent implements OnInit, AfterViewInit {
public displayedColumns: string[] = ['select', 'username', 'alias', 'email', 'roles', 'remainingRequests',
'nextRequestDue', 'lastLoggedIn', 'userType', 'actions', 'welcome'];
@ -33,11 +33,11 @@ export class UserManagementComponent implements OnInit {
private notificationService: NotificationService,
private plexSettings: SettingsService) { }
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);
@ -46,6 +46,10 @@ export class UserManagementComponent implements OnInit {
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.");

Loading…
Cancel
Save