Browse Source

Fix review comments

pull/4281/head
Amandee Ellawala 7 months ago
committed by Thomas Kaul
parent
commit
dd32bd629a
  1. 18
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts
  2. 10
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html
  3. 1
      libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.html

18
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

@ -7,7 +7,6 @@ import { UserService } from '@ghostfolio/client/services/user/user.service';
import { NUMERICAL_PRECISION_THRESHOLD } from '@ghostfolio/common/config';
import { DATE_FORMAT, downloadAsFile } from '@ghostfolio/common/helper';
import {
AdminMarketDataDetails,
DataProviderInfo,
EnhancedSymbolProfile,
Filter,
@ -52,7 +51,6 @@ import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { AssetProfileDialogParams } from '../admin-market-data/asset-profile-dialog/interfaces/interfaces';
import { HoldingDetailDialogParams } from './interfaces/interfaces';
@Component({
@ -86,7 +84,6 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
public activityForm: FormGroup;
public accounts: Account[];
public assetClass: string;
public assetProfile: AdminMarketDataDetails['assetProfile'];
public assetSubClass: string;
public averagePrice: number;
public benchmarkDataItems: LineChartItem[];
@ -132,7 +129,6 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
private unsubscribeSubject = new Subject<void>();
public constructor(
@Inject(MAT_DIALOG_DATA) public assetProfileData: AssetProfileDialogParams,
private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
public dialogRef: MatDialogRef<GfHoldingDetailDialogComponent>,
@ -399,7 +395,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
};
}
);
this.fetchMarketData();
this.changeDetectorRef.markForCheck();
}
);
@ -421,7 +417,6 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
this.changeDetectorRef.markForCheck();
}
});
this.onFetchMarketData();
}
public onCloneActivity(aActivity: Activity) {
@ -456,15 +451,14 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
});
}
public onFetchMarketData() {
public fetchMarketData() {
this.dataService
.fetchMarketDataBySymbol({
dataSource: this.assetProfileData.dataSource,
symbol: this.assetProfileData.symbol
dataSource: this.data.dataSource,
symbol: this.data.symbol
})
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ assetProfile, marketData }) => {
this.assetProfile = assetProfile;
.subscribe(({ marketData }) => {
this.marketDataItems = marketData;
this.historicalDataItems = marketData.map(({ date, marketPrice }) => {
return {
@ -478,7 +472,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
public onMarketDataChanged(withRefresh: boolean = false) {
if (withRefresh) {
this.onFetchMarketData();
this.fetchMarketData();
}
}

10
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html

@ -370,12 +370,12 @@
<div class="d-none d-sm-block ml-2" i18n>Market Data</div>
</ng-template>
<gf-historical-market-data-editor
[currency]="assetProfile?.currency"
[dataSource]="assetProfileData.dataSource"
[dateOfFirstActivity]="assetProfile?.dateOfFirstActivity"
[locale]="assetProfileData.locale"
[currency]="SymbolProfile?.currency"
[dataSource]="SymbolProfile?.dataSource"
[dateOfFirstActivity]="firstBuyDate"
[locale]="data.locale"
[marketData]="marketDataItems"
[symbol]="assetProfileData.symbol"
[symbol]="SymbolProfile?.symbol"
[user]="user"
(marketDataChanged)="onMarketDataChanged($event)"
/>

1
libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.html

@ -48,6 +48,7 @@
cdkTextareaAutosize
formControlName="csvString"
matInput
rows="2"
type="text"
(keyup.enter)="$event.stopPropagation()"
></textarea>

Loading…
Cancel
Save