Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Sep 6, 2024
1 parent d6fc63d commit eb1f8a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ export const fetchMonitorStatusHeatmap = async ({
from: string | number;
to: string | number;
interval: number;
}): Promise<MonitorStatusHeatmapBucket[]> =>
apiService.get(SYNTHETICS_API_URLS.MONITOR_STATUS_HEATMAP, {
}): Promise<MonitorStatusHeatmapBucket[]> => {
const response = await apiService.get<{
result: MonitorStatusHeatmapBucket[];
}>(SYNTHETICS_API_URLS.MONITOR_STATUS_HEATMAP, {
monitorId,
location,
from,
to,
interval,
});
return response.result;
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { schema } from '@kbn/config-schema';
import { MonitorStatusHeatmapBucket } from '../../../common/runtime_types';
import { SYNTHETICS_API_URLS } from '../../../common/constants';
import { queryMonitorHeatmap } from '../../common/pings/monitor_status_heatmap';
import { SyntheticsRestApiRouteFactory } from '../types';
Expand All @@ -22,7 +23,10 @@ export const syntheticsGetPingHeatmapRoute: SyntheticsRestApiRouteFactory = () =
location: schema.string(),
}),
},
handler: async ({ syntheticsEsClient, request, response }) => {
handler: async ({
syntheticsEsClient,
request,
}): Promise<MonitorStatusHeatmapBucket[] | undefined> => {
const { from, to, interval: intervalInMinutes, monitorId, location } = request.query;

const result = await queryMonitorHeatmap({
Expand All @@ -34,8 +38,6 @@ export const syntheticsGetPingHeatmapRoute: SyntheticsRestApiRouteFactory = () =
intervalInMinutes,
});

return response.ok({
body: result.body.aggregations?.heatmap?.buckets,
});
return result.body.aggregations?.heatmap?.buckets as MonitorStatusHeatmapBucket[];
},
});

0 comments on commit eb1f8a3

Please sign in to comment.