Skip to content

Commit 693189d

Browse files
DanielStegerfinnmartens
authored andcommitted
[IT-2819] Show error message if no chart data available
1 parent 25912e9 commit 693189d

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

frontend/src/app/modules/aggregation/aggregation.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<p>
33
{{ 'frontend.de.iteratec.osm.aggregation.description' | translate }}
44
</p>
5-
<osm-aggregation-chart *ngIf="!isHidden" [barchartAverageData]="barchartAverageData$ | async"
5+
<osm-aggregation-chart *ngIf="showChart" [barchartAverageData]="barchartAverageData$ | async"
66
[barchartMedianData]="barchartMedianData$ | async"></osm-aggregation-chart>
77
<div class="action-row">
88
<div class="col-md-12">

frontend/src/app/modules/aggregation/aggregation.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
1+
import {Component, OnInit} from '@angular/core';
22
import {BarchartDataService} from "./services/barchart-data.service";
33
import {ResultSelectionStore} from "../result-selection/services/result-selection.store";
44
import {BehaviorSubject} from "rxjs";
@@ -13,7 +13,7 @@ export class AggregationComponent implements OnInit {
1313

1414
barchartAverageData$: BehaviorSubject<any> = new BehaviorSubject<any>([]);
1515
barchartMedianData$: BehaviorSubject<any> = new BehaviorSubject<any>([]);
16-
isHidden: boolean;
16+
showChart: boolean = false;
1717

1818
constructor(private barchartDataService: BarchartDataService, private resultSelectionStore: ResultSelectionStore, private aggregationChartDataService: AggregationChartDataService) {
1919
this.aggregationChartDataService.barchartAverageData$.subscribe((data) => {
@@ -25,14 +25,14 @@ export class AggregationComponent implements OnInit {
2525
}
2626

2727
ngOnInit() {
28-
this.isHidden = true;
28+
this.showChart = false;
2929
if (this.resultSelectionStore.validQuery) {
3030
this.getBarchartData();
3131
}
3232
}
3333

3434
getBarchartData(): void {
35-
this.isHidden = false;
35+
this.showChart = true;
3636
this.aggregationChartDataService.getBarchartData(this.resultSelectionStore.resultSelectionCommand, this.resultSelectionStore.remainingResultSelection);
3737
}
3838
}

frontend/src/app/modules/aggregation/components/aggregation-chart/aggregation-chart.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ export class AggregationChartComponent implements OnChanges {
7474
}
7575

7676
redraw(): void {
77-
if (this.barchartAverageData.length < 1 || this.barchartMedianData.length < 1) {
77+
if (Object.keys(this.barchartAverageData).length < 1 && Object.keys(this.barchartMedianData).length < 1 && this.barchartAverageData.length != 0 && this.barchartMedianData.length != 0) {
78+
this.resultSelectionStore.dataAvailable$.next(false);
79+
return;
80+
}
81+
if (Object.keys(this.barchartAverageData).length < 1 || Object.keys(this.barchartMedianData).length < 1 || this.barchartAverageData.length < 1 && this.barchartMedianData.length < 1) {
7882
return;
7983
}
8084

frontend/src/app/modules/result-selection/components/submit/submit.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
(!measurandsRequired || (measurandsOrPerformanceAspectsSelected$ | async))">
1414
{{ 'frontend.de.iteratec.osm.resultSelection.warning.longProcessingTime' | translate }}
1515
</p>
16-
<p id="unavailable-data" class="bg-danger get-barchart-data-warnings" *ngIf="(resultCount$ | async) == 0">
16+
<p id="unavailable-data" class="bg-danger get-barchart-data-warnings"
17+
*ngIf="(resultCount$ | async) == 0 || !(dataAvailable$ | async)">
1718
{{ 'frontend.de.iteratec.osm.resultSelection.warning.noDataAvailable' | translate }}
1819
</p>
1920
<p id="no-application-selected" class="bg-danger get-barchart-data-warnings"

frontend/src/app/modules/result-selection/components/submit/submit.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export class SubmitComponent implements OnInit {
1515
pagesOrMeasuredEventsSelected$: BehaviorSubject<boolean> = new BehaviorSubject(false);
1616
measurandsOrPerformanceAspectsSelected$: BehaviorSubject<boolean> = new BehaviorSubject(false);
1717
resultCount$: Observable<number>;
18+
dataAvailable$: Observable<boolean>;
1819

1920
@Input() applicationsRequired: boolean = false;
2021
@Input() pagesRequired: boolean = false;
@@ -23,6 +24,7 @@ export class SubmitComponent implements OnInit {
2324

2425
constructor(private resultSelectionStore: ResultSelectionStore) {
2526
this.resultCount$ = this.resultSelectionStore.resultCount$;
27+
this.dataAvailable$ = this.resultSelectionStore.dataAvailable$;
2628
}
2729

2830
ngOnInit() {

frontend/src/app/modules/result-selection/services/result-selection.store.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export class ResultSelectionStore {
5151
requestSizes$: BehaviorSubject<MeasurandGroup> = new BehaviorSubject({isLoading: false, name: "", values: []});
5252
percentages$: BehaviorSubject<MeasurandGroup> = new BehaviorSubject({isLoading: false, name: "", values: []});
5353
resultCount$: BehaviorSubject<number> = new BehaviorSubject<number>(0);
54+
dataAvailable$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
5455

5556
reset$: Subject<void> = new Subject<void>();
5657

@@ -188,6 +189,7 @@ export class ResultSelectionStore {
188189
}
189190

190191
setResultSelectionCommand(newState: ResultSelectionCommand): void {
192+
this.dataAvailable$.next(true);
191193
this._resultSelectionCommand$.next(newState);
192194
this.loadResultCount(newState);
193195
}
@@ -213,6 +215,7 @@ export class ResultSelectionStore {
213215
}
214216

215217
private setRemainingResultSelection(newState: RemainingResultSelection): void {
218+
this.dataAvailable$.next(true);
216219
this._remainingResultSelection$.next(newState);
217220
}
218221

0 commit comments

Comments
 (0)