|
@ -1,6 +1,8 @@ |
|
|
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 { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
import { User } from '@ghostfolio/common/interfaces'; |
|
|
import { User } from '@ghostfolio/common/interfaces'; |
|
|
|
|
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; |
|
|
import { Subject } from 'rxjs'; |
|
|
import { Subject } from 'rxjs'; |
|
|
import { takeUntil } from 'rxjs/operators'; |
|
|
import { takeUntil } from 'rxjs/operators'; |
|
|
|
|
|
|
|
@ -10,6 +12,7 @@ import { takeUntil } from 'rxjs/operators'; |
|
|
styleUrls: ['./portfolio-page.scss'] |
|
|
styleUrls: ['./portfolio-page.scss'] |
|
|
}) |
|
|
}) |
|
|
export class PortfolioPageComponent implements OnDestroy, OnInit { |
|
|
export class PortfolioPageComponent implements OnDestroy, OnInit { |
|
|
|
|
|
public hasPermissionForSubscription: boolean; |
|
|
public user: User; |
|
|
public user: User; |
|
|
|
|
|
|
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
private unsubscribeSubject = new Subject<void>(); |
|
@ -19,8 +22,16 @@ export class PortfolioPageComponent implements OnDestroy, OnInit { |
|
|
*/ |
|
|
*/ |
|
|
public constructor( |
|
|
public constructor( |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
|
|
|
private dataService: DataService, |
|
|
private userService: UserService |
|
|
private userService: UserService |
|
|
) {} |
|
|
) { |
|
|
|
|
|
const { globalPermissions } = this.dataService.fetchInfo(); |
|
|
|
|
|
|
|
|
|
|
|
this.hasPermissionForSubscription = hasPermission( |
|
|
|
|
|
globalPermissions, |
|
|
|
|
|
permissions.enableSubscription |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Initializes the controller |
|
|
* Initializes the controller |
|
|