|
|
@ -5,7 +5,7 @@ import { DataService } from '@ghostfolio/client/services/data.service';
|
|
|
|
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
|
|
|
|
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
|
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
|
|
|
import { getDateFormatString, getEmojiFlag } from '@ghostfolio/common/helper';
|
|
|
|
import { getDateFormatString, getEmojiFlag } from '@ghostfolio/common/helper';
|
|
|
|
import { AdminData, InfoItem, User } from '@ghostfolio/common/interfaces';
|
|
|
|
import { AdminUsers, InfoItem, User } from '@ghostfolio/common/interfaces';
|
|
|
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
|
|
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
|
|
|
|
|
|
|
|
|
|
|
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
|
|
|
|
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
|
|
|
@ -24,7 +24,7 @@ import { takeUntil } from 'rxjs/operators';
|
|
|
|
templateUrl: './admin-users.html'
|
|
|
|
templateUrl: './admin-users.html'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
export class AdminUsersComponent implements OnDestroy, OnInit {
|
|
|
|
export class AdminUsersComponent implements OnDestroy, OnInit {
|
|
|
|
public dataSource: MatTableDataSource<AdminData['users'][0]> =
|
|
|
|
public dataSource: MatTableDataSource<AdminUsers['users'][0]> =
|
|
|
|
new MatTableDataSource();
|
|
|
|
new MatTableDataSource();
|
|
|
|
public defaultDateFormat: string;
|
|
|
|
public defaultDateFormat: string;
|
|
|
|
public displayedColumns: string[] = [];
|
|
|
|
public displayedColumns: string[] = [];
|
|
|
@ -94,7 +94,7 @@ export class AdminUsersComponent implements OnDestroy, OnInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ngOnInit() {
|
|
|
|
public ngOnInit() {
|
|
|
|
this.fetchAdminData();
|
|
|
|
this.fetchUsers();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public formatDistanceToNow(aDateString: string) {
|
|
|
|
public formatDistanceToNow(aDateString: string) {
|
|
|
@ -119,7 +119,7 @@ export class AdminUsersComponent implements OnDestroy, OnInit {
|
|
|
|
.deleteUser(aId)
|
|
|
|
.deleteUser(aId)
|
|
|
|
.pipe(takeUntil(this.unsubscribeSubject))
|
|
|
|
.pipe(takeUntil(this.unsubscribeSubject))
|
|
|
|
.subscribe(() => {
|
|
|
|
.subscribe(() => {
|
|
|
|
this.fetchAdminData();
|
|
|
|
this.fetchUsers();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
confirmType: ConfirmationDialogType.Warn,
|
|
|
|
confirmType: ConfirmationDialogType.Warn,
|
|
|
@ -142,11 +142,11 @@ export class AdminUsersComponent implements OnDestroy, OnInit {
|
|
|
|
this.unsubscribeSubject.complete();
|
|
|
|
this.unsubscribeSubject.complete();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fetchAdminData() {
|
|
|
|
private fetchUsers() {
|
|
|
|
this.isLoading = true;
|
|
|
|
this.isLoading = true;
|
|
|
|
|
|
|
|
|
|
|
|
this.adminService
|
|
|
|
this.adminService
|
|
|
|
.fetchAdminData()
|
|
|
|
.fetchUsers()
|
|
|
|
.pipe(takeUntil(this.unsubscribeSubject))
|
|
|
|
.pipe(takeUntil(this.unsubscribeSubject))
|
|
|
|
.subscribe(({ users }) => {
|
|
|
|
.subscribe(({ users }) => {
|
|
|
|
this.dataSource = new MatTableDataSource(users);
|
|
|
|
this.dataSource = new MatTableDataSource(users);
|
|
|
|