|
|
|
@ -22,10 +22,11 @@ import { |
|
|
|
ChangeDetectionStrategy, |
|
|
|
ChangeDetectorRef, |
|
|
|
Component, |
|
|
|
OnDestroy, |
|
|
|
DestroyRef, |
|
|
|
OnInit, |
|
|
|
ViewChild |
|
|
|
} from '@angular/core'; |
|
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
|
import { MatCardModule } from '@angular/material/card'; |
|
|
|
import { MatMenuModule } from '@angular/material/menu'; |
|
|
|
@ -38,7 +39,7 @@ import { addIcons } from 'ionicons'; |
|
|
|
import { ellipsisHorizontal, trashOutline } from 'ionicons/icons'; |
|
|
|
import { get } from 'lodash'; |
|
|
|
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; |
|
|
|
import { catchError, filter, of, Subject, takeUntil } from 'rxjs'; |
|
|
|
import { catchError, filter, of } from 'rxjs'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
|
@ -64,7 +65,7 @@ import { catchError, filter, of, Subject, takeUntil } from 'rxjs'; |
|
|
|
styleUrls: ['./admin-settings.component.scss'], |
|
|
|
templateUrl: './admin-settings.component.html' |
|
|
|
}) |
|
|
|
export class GfAdminSettingsComponent implements OnDestroy, OnInit { |
|
|
|
export class GfAdminSettingsComponent implements OnInit { |
|
|
|
@ViewChild(MatSort) sort: MatSort; |
|
|
|
|
|
|
|
public dataSource = new MatTableDataSource<DataProviderInfo>(); |
|
|
|
@ -82,12 +83,11 @@ export class GfAdminSettingsComponent implements OnDestroy, OnInit { |
|
|
|
public pricingUrl: string; |
|
|
|
public user: User; |
|
|
|
|
|
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
|
|
|
|
|
public constructor( |
|
|
|
private adminService: AdminService, |
|
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
|
private dataService: DataService, |
|
|
|
private destroyRef: DestroyRef, |
|
|
|
private notificationService: NotificationService, |
|
|
|
private userService: UserService |
|
|
|
) { |
|
|
|
@ -96,7 +96,7 @@ export class GfAdminSettingsComponent implements OnDestroy, OnInit { |
|
|
|
|
|
|
|
public ngOnInit() { |
|
|
|
this.userService.stateChanged |
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
|
.subscribe((state) => { |
|
|
|
if (state?.user) { |
|
|
|
this.user = state.user; |
|
|
|
@ -153,11 +153,6 @@ export class GfAdminSettingsComponent implements OnDestroy, OnInit { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
|
this.unsubscribeSubject.next(); |
|
|
|
this.unsubscribeSubject.complete(); |
|
|
|
} |
|
|
|
|
|
|
|
private initialize() { |
|
|
|
this.isLoading = true; |
|
|
|
|
|
|
|
@ -165,7 +160,7 @@ export class GfAdminSettingsComponent implements OnDestroy, OnInit { |
|
|
|
|
|
|
|
this.adminService |
|
|
|
.fetchAdminData() |
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
|
.subscribe(({ dataProviders, settings }) => { |
|
|
|
const filteredProviders = dataProviders.filter(({ dataSource }) => { |
|
|
|
return dataSource !== 'MANUAL'; |
|
|
|
@ -193,7 +188,7 @@ export class GfAdminSettingsComponent implements OnDestroy, OnInit { |
|
|
|
filter((status) => { |
|
|
|
return status !== null; |
|
|
|
}), |
|
|
|
takeUntil(this.unsubscribeSubject) |
|
|
|
takeUntilDestroyed(this.destroyRef) |
|
|
|
) |
|
|
|
.subscribe((status) => { |
|
|
|
this.ghostfolioApiStatus = status; |
|
|
|
|