From 233a8a8a1820952d5a33a4a3cd92d3f4ca4b8ff9 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 21 Oct 2022 20:01:32 +0200 Subject: [PATCH] Bugfix/improve loading indicator of investment chart (#1392) * Improve loading indicator * Update changelog --- CHANGELOG.md | 6 ++++++ .../investment-chart/investment-chart.component.ts | 7 +------ .../pages/portfolio/analysis/analysis-page.component.ts | 4 ++++ .../src/app/pages/portfolio/analysis/analysis-page.html | 1 + 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90cd0b31..ed16e1a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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/), 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 ### Changed diff --git a/apps/client/src/app/components/investment-chart/investment-chart.component.ts b/apps/client/src/app/components/investment-chart/investment-chart.component.ts index c789d605..9799e16b 100644 --- a/apps/client/src/app/components/investment-chart/investment-chart.component.ts +++ b/apps/client/src/app/components/investment-chart/investment-chart.component.ts @@ -53,6 +53,7 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy { @Input() groupBy: GroupBy; @Input() historicalDataItems: LineChartItem[] = []; @Input() isInPercent = false; + @Input() isLoading = false; @Input() locale: string; @Input() range: DateRange = 'max'; @Input() savingsRate = 0; @@ -60,8 +61,6 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy { @ViewChild('chartCanvas') chartCanvas; public chart: Chart; - public isLoading = true; - private data: InvestmentItem[]; public constructor() { @@ -92,8 +91,6 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy { } private initialize() { - this.isLoading = true; - // Create a clone this.data = this.benchmarkDataItems.map((item) => Object.assign({}, item)); @@ -273,8 +270,6 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy { }); } } - - this.isLoading = false; } private getTooltipPluginConfiguration() { diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts index 3b81390d..c7442e1f 100644 --- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts @@ -35,6 +35,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit { public investments: InvestmentItem[]; public investmentsByMonth: InvestmentItem[]; public isLoadingBenchmarkComparator: boolean; + public isLoadingInvestmentChart: boolean; public mode: GroupBy = 'month'; public modeOptions: ToggleOption[] = [ { label: $localize`Monthly`, value: 'month' } @@ -125,6 +126,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit { private update() { this.isLoadingBenchmarkComparator = true; + this.isLoadingInvestmentChart = true; this.dataService .fetchPortfolioPerformance({ @@ -156,6 +158,8 @@ export class AnalysisPageComponent implements OnDestroy, OnInit { }); } + this.isLoadingInvestmentChart = false; + this.updateBenchmarkDataItems(); this.changeDetectorRef.markForCheck(); diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.html b/apps/client/src/app/pages/portfolio/analysis/analysis-page.html index adabbd0a..6fff81da 100644 --- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.html +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.html @@ -125,6 +125,7 @@ [daysInMarket]="daysInMarket" [historicalDataItems]="performanceDataItems" [isInPercent]="hasImpersonationId || user.settings.isRestrictedView" + [isLoading]="isLoadingBenchmarkComparator" [locale]="user?.settings?.locale" [range]="user?.settings?.dateRange" >