|
|
@ -1,6 +1,7 @@
|
|
|
|
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
|
|
|
|
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
|
|
|
|
import { DataService } from '@ghostfolio/client/services/data.service';
|
|
|
|
import { DataService } from '@ghostfolio/client/services/data.service';
|
|
|
|
import { AdminData } from '@ghostfolio/common/interfaces';
|
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
|
|
|
|
|
|
|
import { AdminData, User } from '@ghostfolio/common/interfaces';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
differenceInSeconds,
|
|
|
|
differenceInSeconds,
|
|
|
|
formatDistanceToNowStrict,
|
|
|
|
formatDistanceToNowStrict,
|
|
|
@ -15,6 +16,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 user: User;
|
|
|
|
public users: AdminData['users'];
|
|
|
|
public users: AdminData['users'];
|
|
|
|
|
|
|
|
|
|
|
|
private unsubscribeSubject = new Subject<void>();
|
|
|
|
private unsubscribeSubject = new Subject<void>();
|
|
|
@ -24,8 +26,17 @@ export class AdminUsersComponent implements OnDestroy, OnInit {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public constructor(
|
|
|
|
public constructor(
|
|
|
|
private changeDetectorRef: ChangeDetectorRef,
|
|
|
|
private changeDetectorRef: ChangeDetectorRef,
|
|
|
|
private dataService: DataService
|
|
|
|
private dataService: DataService,
|
|
|
|
) {}
|
|
|
|
private userService: UserService
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
this.userService.stateChanged
|
|
|
|
|
|
|
|
.pipe(takeUntil(this.unsubscribeSubject))
|
|
|
|
|
|
|
|
.subscribe((state) => {
|
|
|
|
|
|
|
|
if (state?.user) {
|
|
|
|
|
|
|
|
this.user = state.user;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Initializes the controller
|
|
|
|
* Initializes the controller
|
|
|
|