Bugfix/improve loading indicator of investment chart (#1392)

* Improve loading indicator

* Update changelog
This commit is contained in:
Thomas Kaul 2022-10-21 20:01:32 +02:00 committed by GitHub
parent 190779ee35
commit 233a8a8a18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 6 deletions

View File

@ -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
### Fixed
- Improved the loading indicator of the portfolio evolution chart
## 1.206.2 - 20.10.2022 ## 1.206.2 - 20.10.2022
### Changed ### Changed

View File

@ -53,6 +53,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
@Input() groupBy: GroupBy; @Input() groupBy: GroupBy;
@Input() historicalDataItems: LineChartItem[] = []; @Input() historicalDataItems: LineChartItem[] = [];
@Input() isInPercent = false; @Input() isInPercent = false;
@Input() isLoading = false;
@Input() locale: string; @Input() locale: string;
@Input() range: DateRange = 'max'; @Input() range: DateRange = 'max';
@Input() savingsRate = 0; @Input() savingsRate = 0;
@ -60,8 +61,6 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
@ViewChild('chartCanvas') chartCanvas; @ViewChild('chartCanvas') chartCanvas;
public chart: Chart<any>; public chart: Chart<any>;
public isLoading = true;
private data: InvestmentItem[]; private data: InvestmentItem[];
public constructor() { public constructor() {
@ -92,8 +91,6 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
} }
private initialize() { private initialize() {
this.isLoading = true;
// Create a clone // Create a clone
this.data = this.benchmarkDataItems.map((item) => Object.assign({}, item)); this.data = this.benchmarkDataItems.map((item) => Object.assign({}, item));
@ -273,8 +270,6 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
}); });
} }
} }
this.isLoading = false;
} }
private getTooltipPluginConfiguration() { private getTooltipPluginConfiguration() {

View File

@ -35,6 +35,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
public investments: InvestmentItem[]; public investments: InvestmentItem[];
public investmentsByMonth: InvestmentItem[]; public investmentsByMonth: InvestmentItem[];
public isLoadingBenchmarkComparator: boolean; public isLoadingBenchmarkComparator: boolean;
public isLoadingInvestmentChart: boolean;
public mode: GroupBy = 'month'; public mode: GroupBy = 'month';
public modeOptions: ToggleOption[] = [ public modeOptions: ToggleOption[] = [
{ label: $localize`Monthly`, value: 'month' } { label: $localize`Monthly`, value: 'month' }
@ -125,6 +126,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
private update() { private update() {
this.isLoadingBenchmarkComparator = true; this.isLoadingBenchmarkComparator = true;
this.isLoadingInvestmentChart = true;
this.dataService this.dataService
.fetchPortfolioPerformance({ .fetchPortfolioPerformance({
@ -156,6 +158,8 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
}); });
} }
this.isLoadingInvestmentChart = false;
this.updateBenchmarkDataItems(); this.updateBenchmarkDataItems();
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();

View File

@ -125,6 +125,7 @@
[daysInMarket]="daysInMarket" [daysInMarket]="daysInMarket"
[historicalDataItems]="performanceDataItems" [historicalDataItems]="performanceDataItems"
[isInPercent]="hasImpersonationId || user.settings.isRestrictedView" [isInPercent]="hasImpersonationId || user.settings.isRestrictedView"
[isLoading]="isLoadingBenchmarkComparator"
[locale]="user?.settings?.locale" [locale]="user?.settings?.locale"
[range]="user?.settings?.dateRange" [range]="user?.settings?.dateRange"
></gf-investment-chart> ></gf-investment-chart>