Skip to content
This repository was archived by the owner on Nov 14, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: different calls for different metrics
  • Loading branch information
Abhijeet Singh committed Dec 9, 2022
commit 366e6382d7fa915ac29a04eecec5d67becc5b506
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,7 @@ export abstract class ExploreCartesianDataSourceModel extends GraphQlDataSourceM
console.log({ requestState });
// tslint:disable-next-line: ban-ts-ignore
// @ts-ignore
return of(
response.results[0][
`${requestState.series[0].specification.aggregation}(${requestState.series[0].specification.name})`
].value
);
return of(response.results[0]);
}

return this.getAllData(requestState, response, interval, timeRange).pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,17 @@ export class MetricDisplayWidgetModel {
// tslint:disable-next-line: no-console
console.log('Calling getData from metric-display-widget model');

return this.api.getData<unknown>().pipe(mergeMap(receivedValue => this.normalizeData(receivedValue)));
return this.api.getData<unknown>().pipe(
mergeMap(receivedValue => {
if (typeof receivedValue === 'object') {
const [aggregation, name] = this.title?.split(' ') ?? ['', ''];
// @ts-ignore
return this.normalizeData(receivedValue[`${name}(${aggregation})`].value);
}

return this.normalizeData(receivedValue);
})
);
}

private normalizeData(metricValue: unknown): Observable<MetricWidgetValueData> {
Expand Down