Skip to content

Commit cda2439

Browse files
authored
feat: add property to cartesian widget to allow disabling band fetches (#602)
* feat: add property to cartesian widget to allow disabling band fetches * fix: rename to showBands
1 parent 14a3264 commit cda2439

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

projects/observability/src/shared/dashboard/widgets/charts/cartesian-widget/cartesian-widget.model.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
STRING_PROPERTY
1111
} from '@hypertrace/hyperdash';
1212
import { ModelInject, MODEL_API } from '@hypertrace/hyperdash-angular';
13-
import { Observable } from 'rxjs';
13+
import { Observable, of } from 'rxjs';
1414
import { map } from 'rxjs/operators';
1515
import { Band, CartesianSeriesVisualizationType, Series } from '../../../../components/cartesian/chart';
1616
import { LegendPosition } from '../../../../components/legend/legend.component';
@@ -48,6 +48,12 @@ export class CartesianWidgetModel<TInterval> {
4848
})
4949
public bands: BandModel<TInterval>[] = [];
5050

51+
@ModelProperty({
52+
key: 'show-bands',
53+
type: BOOLEAN_PROPERTY.type
54+
})
55+
public showBands: boolean = true;
56+
5157
@ModelProperty({
5258
key: 'color-palette',
5359
displayName: 'Color Palette',
@@ -258,7 +264,7 @@ export class CartesianWidgetModel<TInterval> {
258264
bands: DecoratedBandDataFetcher<TInterval>[],
259265
interval: TimeDuration
260266
): Observable<MetricBand<TInterval>[]> {
261-
return forkJoinSafeEmpty(bands.map(fetcher => fetcher.getData(interval)));
267+
return this.showBands ? forkJoinSafeEmpty(bands.map(fetcher => fetcher.getData(interval))) : of([]);
262268
}
263269

264270
private getDecoratedSeriesDataFetchers(): Observable<DecoratedSeriesDataFetcher<TInterval>[]> {

0 commit comments

Comments
 (0)