[29589] Fix refreshing of graph

https://community.openproject.com/wp/29589

[ci skip]
pull/7217/head
Oliver Günther 6 years ago
parent 9d10a45f3e
commit b9270ee4be
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 4
      frontend/src/app/components/wp-by-version-graph/wp-by-version-graph.component.ts
  2. 2
      frontend/src/app/components/wp-table/embedded/wp-embedded-base.component.ts
  3. 23
      frontend/src/app/components/wp-table/embedded/wp-embedded-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_open_work_packages'), queryProps: this.propsOpen });
this.datasets.push({ label: this.I18n.t('js.label_closed_work_packages'), queryProps: this.propsClosed }); this.datasets.push({ label: this.I18n.t('js.label_closed_work_packages'), queryProps: this.propsClosed });
} }
if (this.currentGraph) {
this.currentGraph.refresh();
}
} }
public get propsBoth() { public get propsBoth() {

@ -22,7 +22,7 @@ export abstract class WorkPackageEmbeddedBaseComponent extends WorkPackagesViewB
public configuration:WorkPackageTableConfiguration; public configuration:WorkPackageTableConfiguration;
public error:string|null = null; public error:string|null = null;
private initialized:boolean = false; protected initialized:boolean = false;
readonly QueryDm:QueryDmService = this.injector.get(QueryDmService); readonly QueryDm:QueryDmService = this.injector.get(QueryDmService);
readonly querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace); readonly querySpace:IsolatedQuerySpace = this.injector.get(IsolatedQuerySpace);

@ -1,20 +1,5 @@
import {AfterViewInit, Component, Injector, Input, OnDestroy, OnInit} from '@angular/core'; import {AfterViewInit, Component, Injector, Input, OnDestroy, OnInit, SimpleChanges} 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 {WorkPackageTableConfiguration} from 'core-components/wp-table/wp-table-configuration'; 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 {GroupObject} from 'core-app/modules/hal/resources/wp-collection-resource';
import {Chart} from 'chart.js'; import {Chart} from 'chart.js';
import {WorkPackageEmbeddedBaseComponent} from "core-components/wp-table/embedded/wp-embedded-base.component"; import {WorkPackageEmbeddedBaseComponent} from "core-components/wp-table/embedded/wp-embedded-base.component";
@ -65,8 +50,10 @@ export class WorkPackageEmbeddedGraphComponent extends WorkPackageEmbeddedBaseCo
super(injector); super(injector);
} }
public refresh(visible:boolean = true):Promise<any> { ngOnChanges(changes:SimpleChanges) {
return super.refresh(visible).then(() => this.updateChartData()); if (this.initialized && (changes.datasets)) {
this.loadQuery(false);
}
} }
private updateChartData() { private updateChartData() {

Loading…
Cancel
Save