diff --git a/CHANGELOG.md b/CHANGELOG.md index 06b2cf246..573fd1161 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added the _Top 3_ and _Bottom 3_ performers to the analysis page +### Fixed + +- Fixed the routing of the create activity dialog + ## 1.99.0 - 01.01.2022 ### Added diff --git a/apps/client/src/app/components/home-holdings/home-holdings.html b/apps/client/src/app/components/home-holdings/home-holdings.html index ccc2ed73f..881c0eec5 100644 --- a/apps/client/src/app/components/home-holdings/home-holdings.html +++ b/apps/client/src/app/components/home-holdings/home-holdings.html @@ -14,6 +14,7 @@
diff --git a/apps/client/src/app/components/positions-table/positions-table.component.html b/apps/client/src/app/components/positions-table/positions-table.component.html index 69f09678c..97ab56d4c 100644 --- a/apps/client/src/app/components/positions-table/positions-table.component.html +++ b/apps/client/src/app/components/positions-table/positions-table.component.html @@ -123,7 +123,12 @@ }" > -
+
diff --git a/apps/client/src/app/components/positions-table/positions-table.component.ts b/apps/client/src/app/components/positions-table/positions-table.component.ts index b06a052be..0c44be05d 100644 --- a/apps/client/src/app/components/positions-table/positions-table.component.ts +++ b/apps/client/src/app/components/positions-table/positions-table.component.ts @@ -26,6 +26,7 @@ import { Subject, Subscription } from 'rxjs'; export class PositionsTableComponent implements OnChanges, OnDestroy, OnInit { @Input() baseCurrency: string; @Input() deviceType: string; + @Input() hasPermissionToCreateOrder: boolean; @Input() locale: string; @Input() positions: PortfolioPosition[]; diff --git a/apps/client/src/app/components/positions/positions.component.html b/apps/client/src/app/components/positions/positions.component.html index 61ed865f7..1a6f44270 100644 --- a/apps/client/src/app/components/positions/positions.component.html +++ b/apps/client/src/app/components/positions/positions.component.html @@ -23,7 +23,10 @@ [range]="range" > -
+
diff --git a/apps/client/src/app/components/positions/positions.component.ts b/apps/client/src/app/components/positions/positions.component.ts index bd0540eff..bbd7dcf37 100644 --- a/apps/client/src/app/components/positions/positions.component.ts +++ b/apps/client/src/app/components/positions/positions.component.ts @@ -17,6 +17,7 @@ import { Position } from '@ghostfolio/common/interfaces'; export class PositionsComponent implements OnChanges, OnInit { @Input() baseCurrency: string; @Input() deviceType: string; + @Input() hasPermissionToCreateOrder: boolean; @Input() locale: string; @Input() positions: Position[]; @Input() range: string; diff --git a/apps/client/src/app/components/rules/rules.component.html b/apps/client/src/app/components/rules/rules.component.html index ba193f495..a049e6134 100644 --- a/apps/client/src/app/components/rules/rules.component.html +++ b/apps/client/src/app/components/rules/rules.component.html @@ -1,7 +1,10 @@
- + diff --git a/apps/client/src/app/components/rules/rules.component.ts b/apps/client/src/app/components/rules/rules.component.ts index 0043be1ab..e5429bdcc 100644 --- a/apps/client/src/app/components/rules/rules.component.ts +++ b/apps/client/src/app/components/rules/rules.component.ts @@ -8,6 +8,7 @@ import { PortfolioReportRule } from '@ghostfolio/common/interfaces'; styleUrls: ['./rules.component.scss'] }) export class RulesComponent { + @Input() hasPermissionToCreateOrder: boolean; @Input() rules: PortfolioReportRule; public constructor() {} diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts index 678c87801..5ab8ba1b5 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts @@ -12,6 +12,7 @@ import { PortfolioPosition, User } from '@ghostfolio/common/interfaces'; +import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { ToggleOption } from '@ghostfolio/common/types'; import { AssetClass } from '@prisma/client'; import { DeviceDetectorService } from 'ngx-device-detector'; @@ -36,6 +37,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { }; public deviceType: string; public hasImpersonationId: boolean; + public hasPermissionToCreateOrder: boolean; public period = 'current'; public periodOptions: ToggleOption[] = [ { label: 'Initial', value: 'original' }, @@ -120,6 +122,11 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { if (state?.user) { this.user = state.user; + this.hasPermissionToCreateOrder = hasPermission( + this.user.permissions, + permissions.createOrder + ); + this.changeDetectorRef.markForCheck(); } }); diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.html b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html index b5207257c..a210c4cdb 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.html +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html @@ -197,6 +197,7 @@ diff --git a/apps/client/src/app/pages/portfolio/report/report-page.component.ts b/apps/client/src/app/pages/portfolio/report/report-page.component.ts index c4a1ce2fb..057923d09 100644 --- a/apps/client/src/app/pages/portfolio/report/report-page.component.ts +++ b/apps/client/src/app/pages/portfolio/report/report-page.component.ts @@ -1,6 +1,8 @@ import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; import { DataService } from '@ghostfolio/client/services/data.service'; -import { PortfolioReportRule } from '@ghostfolio/common/interfaces'; +import { UserService } from '@ghostfolio/client/services/user/user.service'; +import { PortfolioReportRule, User } from '@ghostfolio/common/interfaces'; +import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @@ -14,6 +16,8 @@ export class ReportPageComponent implements OnDestroy, OnInit { public accountClusterRiskRules: PortfolioReportRule[]; public currencyClusterRiskRules: PortfolioReportRule[]; public feeRules: PortfolioReportRule[]; + public hasPermissionToCreateOrder: boolean; + public user: User; private unsubscribeSubject = new Subject(); @@ -22,7 +26,8 @@ export class ReportPageComponent implements OnDestroy, OnInit { */ public constructor( private changeDetectorRef: ChangeDetectorRef, - private dataService: DataService + private dataService: DataService, + private userService: UserService ) {} /** @@ -41,6 +46,21 @@ export class ReportPageComponent implements OnDestroy, OnInit { this.changeDetectorRef.markForCheck(); }); + + this.userService.stateChanged + .pipe(takeUntil(this.unsubscribeSubject)) + .subscribe((state) => { + if (state?.user) { + this.user = state.user; + + this.hasPermissionToCreateOrder = hasPermission( + this.user.permissions, + permissions.createOrder + ); + + this.changeDetectorRef.markForCheck(); + } + }); } public ngOnDestroy() { diff --git a/apps/client/src/app/pages/portfolio/report/report-page.html b/apps/client/src/app/pages/portfolio/report/report-page.html index 6b093119b..759fb3345 100644 --- a/apps/client/src/app/pages/portfolio/report/report-page.html +++ b/apps/client/src/app/pages/portfolio/report/report-page.html @@ -15,15 +15,24 @@

Currency Cluster Risks

- +

Account Cluster Risks

- +

Fees

- +
diff --git a/apps/client/src/app/pages/portfolio/transactions/transactions-page.component.ts b/apps/client/src/app/pages/portfolio/transactions/transactions-page.component.ts index 2b9f85a0d..b6a1ee647 100644 --- a/apps/client/src/app/pages/portfolio/transactions/transactions-page.component.ts +++ b/apps/client/src/app/pages/portfolio/transactions/transactions-page.component.ts @@ -62,7 +62,7 @@ export class TransactionsPageComponent implements OnDestroy, OnInit { this.routeQueryParams = route.queryParams .pipe(takeUntil(this.unsubscribeSubject)) .subscribe((params) => { - if (params['createDialog'] && this.hasPermissionToCreateOrder) { + if (params['createDialog']) { this.openCreateTransactionDialog(); } else if (params['editDialog']) { if (this.transactions) {