Feature/refactor position detail dialog (#355)
* Add name to portfolio position endpoint * Update changelog
This commit is contained in:
parent
4693a8baa2
commit
5d4156ecec
@ -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).
|
||||||
|
|
||||||
|
## 1.51.0 - 11.09.2021
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Provided the name in the portfolio position endpoint
|
||||||
|
|
||||||
## 1.50.0 - 11.09.2021
|
## 1.50.0 - 11.09.2021
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -11,6 +11,7 @@ export interface PortfolioPositionDetail {
|
|||||||
marketPrice: number;
|
marketPrice: number;
|
||||||
maxPrice: number;
|
maxPrice: number;
|
||||||
minPrice: number;
|
minPrice: number;
|
||||||
|
name: string;
|
||||||
netPerformance: number;
|
netPerformance: number;
|
||||||
netPerformancePercent: number;
|
netPerformancePercent: number;
|
||||||
quantity: number;
|
quantity: number;
|
||||||
|
@ -282,6 +282,7 @@ export class PortfolioService {
|
|||||||
marketPrice: undefined,
|
marketPrice: undefined,
|
||||||
maxPrice: undefined,
|
maxPrice: undefined,
|
||||||
minPrice: undefined,
|
minPrice: undefined,
|
||||||
|
name: undefined,
|
||||||
netPerformance: undefined,
|
netPerformance: undefined,
|
||||||
netPerformancePercent: undefined,
|
netPerformancePercent: undefined,
|
||||||
quantity: undefined,
|
quantity: undefined,
|
||||||
@ -291,6 +292,7 @@ export class PortfolioService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const positionCurrency = orders[0].currency;
|
const positionCurrency = orders[0].currency;
|
||||||
|
const name = orders[0].SymbolProfile?.name ?? '';
|
||||||
|
|
||||||
const portfolioOrders: PortfolioOrder[] = orders.map((order) => ({
|
const portfolioOrders: PortfolioOrder[] = orders.map((order) => ({
|
||||||
currency: order.currency,
|
currency: order.currency,
|
||||||
@ -407,6 +409,7 @@ export class PortfolioService {
|
|||||||
marketPrice,
|
marketPrice,
|
||||||
maxPrice,
|
maxPrice,
|
||||||
minPrice,
|
minPrice,
|
||||||
|
name,
|
||||||
netPerformance,
|
netPerformance,
|
||||||
transactionCount,
|
transactionCount,
|
||||||
averagePrice: averagePrice.toNumber(),
|
averagePrice: averagePrice.toNumber(),
|
||||||
@ -455,6 +458,7 @@ export class PortfolioService {
|
|||||||
marketPrice,
|
marketPrice,
|
||||||
maxPrice,
|
maxPrice,
|
||||||
minPrice,
|
minPrice,
|
||||||
|
name,
|
||||||
averagePrice: 0,
|
averagePrice: 0,
|
||||||
currency: currentData[aSymbol]?.currency,
|
currency: currentData[aSymbol]?.currency,
|
||||||
firstBuyDate: undefined,
|
firstBuyDate: undefined,
|
||||||
|
@ -3,5 +3,4 @@ export interface PositionDetailDialogParams {
|
|||||||
deviceType: string;
|
deviceType: string;
|
||||||
locale: string;
|
locale: string;
|
||||||
symbol: string;
|
symbol: string;
|
||||||
title: string;
|
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,11 @@ export class PositionDetailDialog implements OnDestroy {
|
|||||||
public marketPrice: number;
|
public marketPrice: number;
|
||||||
public maxPrice: number;
|
public maxPrice: number;
|
||||||
public minPrice: number;
|
public minPrice: number;
|
||||||
|
public name: string;
|
||||||
public netPerformance: number;
|
public netPerformance: number;
|
||||||
public netPerformancePercent: number;
|
public netPerformancePercent: number;
|
||||||
public quantity: number;
|
public quantity: number;
|
||||||
|
public symbol: string;
|
||||||
public transactionCount: number;
|
public transactionCount: number;
|
||||||
|
|
||||||
private unsubscribeSubject = new Subject<void>();
|
private unsubscribeSubject = new Subject<void>();
|
||||||
@ -62,9 +64,11 @@ export class PositionDetailDialog implements OnDestroy {
|
|||||||
marketPrice,
|
marketPrice,
|
||||||
maxPrice,
|
maxPrice,
|
||||||
minPrice,
|
minPrice,
|
||||||
|
name,
|
||||||
netPerformance,
|
netPerformance,
|
||||||
netPerformancePercent,
|
netPerformancePercent,
|
||||||
quantity,
|
quantity,
|
||||||
|
symbol,
|
||||||
transactionCount
|
transactionCount
|
||||||
}) => {
|
}) => {
|
||||||
this.averagePrice = averagePrice;
|
this.averagePrice = averagePrice;
|
||||||
@ -90,9 +94,11 @@ export class PositionDetailDialog implements OnDestroy {
|
|||||||
this.marketPrice = marketPrice;
|
this.marketPrice = marketPrice;
|
||||||
this.maxPrice = maxPrice;
|
this.maxPrice = maxPrice;
|
||||||
this.minPrice = minPrice;
|
this.minPrice = minPrice;
|
||||||
|
this.name = name;
|
||||||
this.netPerformance = netPerformance;
|
this.netPerformance = netPerformance;
|
||||||
this.netPerformancePercent = netPerformancePercent;
|
this.netPerformancePercent = netPerformancePercent;
|
||||||
this.quantity = quantity;
|
this.quantity = quantity;
|
||||||
|
this.symbol = symbol;
|
||||||
this.transactionCount = transactionCount;
|
this.transactionCount = transactionCount;
|
||||||
|
|
||||||
if (isToday(parseISO(this.firstBuyDate))) {
|
if (isToday(parseISO(this.firstBuyDate))) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<gf-dialog-header
|
<gf-dialog-header
|
||||||
mat-dialog-title
|
mat-dialog-title
|
||||||
[deviceType]="data.deviceType"
|
[deviceType]="data.deviceType"
|
||||||
[title]="data.title ?? data.symbol"
|
[title]="name ?? symbol"
|
||||||
(closeButtonClicked)="onClose()"
|
(closeButtonClicked)="onClose()"
|
||||||
></gf-dialog-header>
|
></gf-dialog-header>
|
||||||
|
|
||||||
|
@ -64,8 +64,7 @@ export class PositionComponent implements OnDestroy, OnInit {
|
|||||||
baseCurrency: this.baseCurrency,
|
baseCurrency: this.baseCurrency,
|
||||||
deviceType: this.deviceType,
|
deviceType: this.deviceType,
|
||||||
locale: this.locale,
|
locale: this.locale,
|
||||||
symbol: this.position?.symbol,
|
symbol: this.position?.symbol
|
||||||
title: this.position?.name
|
|
||||||
},
|
},
|
||||||
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',
|
height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',
|
||||||
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
|
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
}"
|
}"
|
||||||
(click)="
|
(click)="
|
||||||
!this.ignoreAssetClasses.includes(row.assetClass) &&
|
!this.ignoreAssetClasses.includes(row.assetClass) &&
|
||||||
onOpenPositionDialog({ symbol: row.symbol, title: row.name })
|
onOpenPositionDialog({ symbol: row.symbol })
|
||||||
"
|
"
|
||||||
></tr>
|
></tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -57,14 +57,9 @@ export class PositionsTableComponent implements OnChanges, OnDestroy, OnInit {
|
|||||||
this.routeQueryParams = route.queryParams
|
this.routeQueryParams = route.queryParams
|
||||||
.pipe(takeUntil(this.unsubscribeSubject))
|
.pipe(takeUntil(this.unsubscribeSubject))
|
||||||
.subscribe((params) => {
|
.subscribe((params) => {
|
||||||
if (
|
if (params['positionDetailDialog'] && params['symbol']) {
|
||||||
params['positionDetailDialog'] &&
|
|
||||||
params['symbol'] &&
|
|
||||||
params['title']
|
|
||||||
) {
|
|
||||||
this.openPositionDialog({
|
this.openPositionDialog({
|
||||||
symbol: params['symbol'],
|
symbol: params['symbol']
|
||||||
title: params['title']
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -96,15 +91,9 @@ export class PositionsTableComponent implements OnChanges, OnDestroy, OnInit {
|
|||||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public onOpenPositionDialog({
|
public onOpenPositionDialog({ symbol }: { symbol: string }): void {
|
||||||
symbol,
|
|
||||||
title
|
|
||||||
}: {
|
|
||||||
symbol: string;
|
|
||||||
title: string;
|
|
||||||
}): void {
|
|
||||||
this.router.navigate([], {
|
this.router.navigate([], {
|
||||||
queryParams: { positionDetailDialog: true, symbol, title }
|
queryParams: { positionDetailDialog: true, symbol }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,18 +105,11 @@ export class PositionsTableComponent implements OnChanges, OnDestroy, OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public openPositionDialog({
|
public openPositionDialog({ symbol }: { symbol: string }): void {
|
||||||
symbol,
|
|
||||||
title
|
|
||||||
}: {
|
|
||||||
symbol: string;
|
|
||||||
title: string;
|
|
||||||
}): void {
|
|
||||||
const dialogRef = this.dialog.open(PositionDetailDialog, {
|
const dialogRef = this.dialog.open(PositionDetailDialog, {
|
||||||
autoFocus: false,
|
autoFocus: false,
|
||||||
data: {
|
data: {
|
||||||
symbol,
|
symbol,
|
||||||
title,
|
|
||||||
baseCurrency: this.baseCurrency,
|
baseCurrency: this.baseCurrency,
|
||||||
deviceType: this.deviceType,
|
deviceType: this.deviceType,
|
||||||
locale: this.locale
|
locale: this.locale
|
||||||
|
@ -255,8 +255,7 @@
|
|||||||
mat-row
|
mat-row
|
||||||
(click)="
|
(click)="
|
||||||
onOpenPositionDialog({
|
onOpenPositionDialog({
|
||||||
symbol: row.symbol,
|
symbol: row.symbol
|
||||||
title: row.SymbolProfile?.name
|
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
></tr>
|
></tr>
|
||||||
|
@ -86,8 +86,7 @@ export class TransactionsTableComponent
|
|||||||
.subscribe((params) => {
|
.subscribe((params) => {
|
||||||
if (params['positionDetailDialog'] && params['symbol']) {
|
if (params['positionDetailDialog'] && params['symbol']) {
|
||||||
this.openPositionDialog({
|
this.openPositionDialog({
|
||||||
symbol: params['symbol'],
|
symbol: params['symbol']
|
||||||
title: params['title']
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -196,15 +195,9 @@ export class TransactionsTableComponent
|
|||||||
this.import.emit();
|
this.import.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public onOpenPositionDialog({
|
public onOpenPositionDialog({ symbol }: { symbol: string }): void {
|
||||||
symbol,
|
|
||||||
title
|
|
||||||
}: {
|
|
||||||
symbol: string;
|
|
||||||
title: string;
|
|
||||||
}): void {
|
|
||||||
this.router.navigate([], {
|
this.router.navigate([], {
|
||||||
queryParams: { positionDetailDialog: true, symbol, title }
|
queryParams: { positionDetailDialog: true, symbol }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,18 +209,11 @@ export class TransactionsTableComponent
|
|||||||
this.transactionToClone.emit(aTransaction);
|
this.transactionToClone.emit(aTransaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public openPositionDialog({
|
public openPositionDialog({ symbol }: { symbol: string }): void {
|
||||||
symbol,
|
|
||||||
title
|
|
||||||
}: {
|
|
||||||
symbol: string;
|
|
||||||
title: string;
|
|
||||||
}): void {
|
|
||||||
const dialogRef = this.dialog.open(PositionDetailDialog, {
|
const dialogRef = this.dialog.open(PositionDetailDialog, {
|
||||||
autoFocus: false,
|
autoFocus: false,
|
||||||
data: {
|
data: {
|
||||||
symbol,
|
symbol,
|
||||||
title,
|
|
||||||
baseCurrency: this.baseCurrency,
|
baseCurrency: this.baseCurrency,
|
||||||
deviceType: this.deviceType,
|
deviceType: this.deviceType,
|
||||||
locale: this.locale
|
locale: this.locale
|
||||||
|
Loading…
x
Reference in New Issue
Block a user