Feature/improve filtering on allocations page (#900)

* Include cash positions on allocations page (with no filtering)

* Update changelog
pull/901/head
Thomas Kaul 3 years ago committed by GitHub
parent 80862e5c2a
commit dfa67b275c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Improved the allocations page with no filtering (include cash positions)
## 1.146.3 - 08.05.2022 ## 1.146.3 - 08.05.2022
### Added ### Added

@ -318,8 +318,8 @@ export class PortfolioService {
(user.Settings?.settings as UserSettings)?.emergencyFund ?? 0 (user.Settings?.settings as UserSettings)?.emergencyFund ?? 0
); );
const userCurrency = const userCurrency =
this.request.user?.Settings?.currency ??
user.Settings?.currency ?? user.Settings?.currency ??
this.request.user?.Settings?.currency ??
baseCurrency; baseCurrency;
const { orders, portfolioOrders, transactionPoints } = const { orders, portfolioOrders, transactionPoints } =
@ -448,7 +448,7 @@ export class PortfolioService {
value: totalValue value: totalValue
}); });
if (aFilters === undefined) { if (aFilters?.length === 0) {
for (const symbol of Object.keys(cashPositions)) { for (const symbol of Object.keys(cashPositions)) {
holdings[symbol] = cashPositions[symbol]; holdings[symbol] = cashPositions[symbol];
} }

@ -73,11 +73,6 @@ export class PositionsTableComponent implements OnChanges, OnDestroy, OnInit {
} }
} }
/*public applyFilter(event: Event) {
const filterValue = (event.target as HTMLInputElement).value;
this.dataSource.filter = filterValue.trim().toLowerCase();
}*/
public onOpenPositionDialog({ dataSource, symbol }: UniqueAsset): void { public onOpenPositionDialog({ dataSource, symbol }: UniqueAsset): void {
this.router.navigate([], { this.router.navigate([], {
queryParams: { dataSource, symbol, positionDetailDialog: true } queryParams: { dataSource, symbol, positionDetailDialog: true }

@ -33,6 +33,7 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
value: number; value: number;
}; };
}; };
public activeFilters: Filter[] = [];
public allFilters: Filter[]; public allFilters: Filter[];
public continents: { public continents: {
[code: string]: { name: string; value: number }; [code: string]: { name: string; value: number };
@ -130,8 +131,11 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
distinctUntilChanged(), distinctUntilChanged(),
switchMap((filters) => { switchMap((filters) => {
this.isLoading = true; this.isLoading = true;
this.activeFilters = filters;
return this.dataService.fetchPortfolioDetails({ filters }); return this.dataService.fetchPortfolioDetails({
filters: this.activeFilters
});
}), }),
takeUntil(this.unsubscribeSubject) takeUntil(this.unsubscribeSubject)
) )
@ -343,7 +347,10 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
} }
} }
if (position.dataSource) { if (
this.activeFilters?.length === 0 ||
position.assetSubClass !== AssetClass.CASH
) {
this.symbols[prettifySymbol(symbol)] = { this.symbols[prettifySymbol(symbol)] = {
dataSource: position.dataSource, dataSource: position.dataSource,
name: position.name, name: position.name,

@ -95,7 +95,7 @@
<mat-card class="mb-3"> <mat-card class="mb-3">
<mat-card-header class="overflow-hidden w-100"> <mat-card-header class="overflow-hidden w-100">
<mat-card-title class="align-items-center d-flex text-truncate" <mat-card-title class="align-items-center d-flex text-truncate"
><span i18n>By Symbol</span ><span i18n>By Position</span
><ion-icon ><ion-icon
*ngIf="user?.subscription?.type === 'Basic'" *ngIf="user?.subscription?.type === 'Basic'"
class="ml-1 text-muted" class="ml-1 text-muted"

@ -10,7 +10,7 @@
<div class="col-md-12 allocations-by-symbol"> <div class="col-md-12 allocations-by-symbol">
<mat-card class="mb-3"> <mat-card class="mb-3">
<mat-card-header class="overflow-hidden w-100"> <mat-card-header class="overflow-hidden w-100">
<mat-card-title class="text-truncate" i18n>Symbols</mat-card-title> <mat-card-title class="text-truncate" i18n>Positions</mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<gf-portfolio-proportion-chart <gf-portfolio-proportion-chart

Loading…
Cancel
Save