From b9270ee4beb0a1095aa4c4833a85596f928ba1b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 16 Apr 2019 10:38:36 +0200 Subject: [PATCH] [29589] Fix refreshing of graph https://community.openproject.com/wp/29589 [ci skip] --- .../wp-by-version-graph.component.ts | 4 ---- .../embedded/wp-embedded-base.component.ts | 2 +- .../embedded/wp-embedded-graph.component.ts | 23 ++++--------------- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/frontend/src/app/components/wp-by-version-graph/wp-by-version-graph.component.ts b/frontend/src/app/components/wp-by-version-graph/wp-by-version-graph.component.ts index ec68fa2126..586f07d113 100644 --- a/frontend/src/app/components/wp-by-version-graph/wp-by-version-graph.component.ts +++ b/frontend/src/app/components/wp-by-version-graph/wp-by-version-graph.component.ts @@ -49,10 +49,6 @@ export class WorkPackageByVersionGraphComponent implements OnInit { this.datasets.push({ label: this.I18n.t('js.label_open_work_packages'), queryProps: this.propsOpen }); this.datasets.push({ label: this.I18n.t('js.label_closed_work_packages'), queryProps: this.propsClosed }); } - - if (this.currentGraph) { - this.currentGraph.refresh(); - } } public get propsBoth() { diff --git a/frontend/src/app/components/wp-table/embedded/wp-embedded-base.component.ts b/frontend/src/app/components/wp-table/embedded/wp-embedded-base.component.ts index f8cc399058..5f87a5b574 100644 --- a/frontend/src/app/components/wp-table/embedded/wp-embedded-base.component.ts +++ b/frontend/src/app/components/wp-table/embedded/wp-embedded-base.component.ts @@ -22,7 +22,7 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB public configuration:WorkPackageTableConfiguration; public error:string|null = null; - private initialized:boolean = false; + protected initialized:boolean = false; readonly QueryDm:QueryDmService = this.injector.get(QueryDmService); readonly querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace); diff --git a/frontend/src/app/components/wp-table/embedded/wp-embedded-graph.component.ts b/frontend/src/app/components/wp-table/embedded/wp-embedded-graph.component.ts index e49cc93b73..7b1209e591 100644 --- a/frontend/src/app/components/wp-table/embedded/wp-embedded-graph.component.ts +++ b/frontend/src/app/components/wp-table/embedded/wp-embedded-graph.component.ts @@ -1,20 +1,5 @@ -import {AfterViewInit, Component, Injector, Input, OnDestroy, OnInit} from '@angular/core'; -import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space"; -import {WorkPackageStatesInitializationService} from 'core-components/wp-list/wp-states-initialization.service'; -import {WorkPackageTableRelationColumnsService} from 'core-components/wp-fast-table/state/wp-table-relation-columns.service'; -import {WorkPackageTableHierarchiesService} from 'core-components/wp-fast-table/state/wp-table-hierarchy.service'; -import {WorkPackageTableTimelineService} from 'core-components/wp-fast-table/state/wp-table-timeline.service'; -import {WorkPackageTablePaginationService} from 'core-components/wp-fast-table/state/wp-table-pagination.service'; -import {WorkPackageTableGroupByService} from 'core-components/wp-fast-table/state/wp-table-group-by.service'; -import {WorkPackageTableSortByService} from 'core-components/wp-fast-table/state/wp-table-sort-by.service'; -import {WorkPackageTableFiltersService} from 'core-components/wp-fast-table/state/wp-table-filters.service'; -import {WorkPackageTableColumnsService} from 'core-components/wp-fast-table/state/wp-table-columns.service'; -import {WorkPackageTableSumService} from 'core-components/wp-fast-table/state/wp-table-sum.service'; -import {WorkPackageTableAdditionalElementsService} from 'core-components/wp-fast-table/state/wp-table-additional-elements.service'; +import {AfterViewInit, Component, Injector, Input, OnDestroy, OnInit, SimpleChanges} from '@angular/core'; import {WorkPackageTableConfiguration} from 'core-components/wp-table/wp-table-configuration'; -import {WorkPackageTableRefreshService} from 'core-components/wp-table/wp-table-refresh-request.service'; -import {OpTableActionsService} from 'core-components/wp-table/table-actions/table-actions.service'; -import {WorkPackageTableSelection} from 'core-components/wp-fast-table/state/wp-table-selection.service'; import {GroupObject} from 'core-app/modules/hal/resources/wp-collection-resource'; import {Chart} from 'chart.js'; import {WorkPackageEmbeddedBaseComponent} from "core-components/wp-table/embedded/wp-embedded-base.component"; @@ -65,8 +50,10 @@ export class WorkPackageEmbeddedGraphComponent extends WorkPackageEmbeddedBaseCo super(injector); } - public refresh(visible:boolean = true):Promise { - return super.refresh(visible).then(() => this.updateChartData()); + ngOnChanges(changes:SimpleChanges) { + if (this.initialized && (changes.datasets)) { + this.loadQuery(false); + } } private updateChartData() {