Skip to content

Commit aa70a6d

Browse files
cRui861gingi
authored andcommitted
Fixes AB#446: Name property not defined for monitor charts
1 parent b2860cb commit aa70a6d

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/app/components/account/monitoring/monitor-chart/monitor-chart.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ const aggregationAttributes = {
2424
[MonitorChartAggregation.Avg]: "average",
2525
[MonitorChartAggregation.Sum]: "total",
2626
};
27+
28+
let idCounter = 0;
2729
@Component({
2830
selector: "bl-monitor-chart",
2931
templateUrl: "monitor-chart.html",
3032
changeDetection: ChangeDetectionStrategy.OnPush,
3133
})
3234
export class MonitorChartComponent implements OnChanges, OnDestroy {
35+
@Input() public headerId = `monitor-chart-header-id-${idCounter++}`;
3336
@Input() public chartType: ChartType = ChartType.Line;
3437
@Input() public metrics: MonitorChartType;
3538
@Input() public preview: boolean = false;
@@ -77,11 +80,11 @@ export class MonitorChartComponent implements OnChanges, OnDestroy {
7780
}),
7881
);
7982

80-
const metrics = combineLatest(
83+
const metrics = combineLatest([
8184
this._metrics.pipe(filter(isNotNullOrUndefined)),
8285
this._timeRange.pipe(filter(isNotNullOrUndefined)),
8386
this.accountService.currentAccountId,
84-
).pipe(
87+
]).pipe(
8588
takeUntil(this._destroy),
8689
tap(() => {
8790
this.chartError = null;

src/app/components/account/monitoring/monitor-chart/monitor-chart.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
<ng-container *ngIf="!preview">
22
<div class="header">
3-
<h2 tabindex="0">
3+
<h2 tabindex="0" id="{{headerId}}">
44
{{ 'account-monitoring.' + metrics | i18n }}
55
</h2>
6-
7-
86
<div class="aggregation" *ngIf="aggregation" tabindex="0">
97
{{aggregation}}
108
</div>
119
</div>
1210
<ng-container *ngIf="isChartReady">
1311
<div class="chart-container" tabindex="0" aria-label="graph">
14-
<canvas blChart [datasets]="datasets" [options]="options" [chartType]="chartType" [colors]="colors"></canvas>
12+
<canvas blChart
13+
[datasets]="datasets"
14+
[options]="options"
15+
[chartType]="chartType"
16+
[colors]="colors"
17+
[attr.aria-labelledby]="headerId">
18+
</canvas>
1519
</div>
1620
<div class="legend">
1721
<div class="legend-item" *ngFor="let dataset of datasets;trackBy: trackDataSet;let index=index" tabindex="0">

0 commit comments

Comments
 (0)