Skip to content

Commit

Permalink
Rename type.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Jun 6, 2024
1 parent 6d4c1c9 commit 232c61d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export const GetPingsParamsType = t.intersection([

export type GetPingsParams = t.TypeOf<typeof GetPingsParamsType>;

export const MonitorStatusHeatmapType = t.type({
export const MonitorStatusHeatmapBucketType = t.type({
doc_count: t.number,
down: t.type({
value: t.number,
Expand All @@ -319,4 +319,4 @@ export const MonitorStatusHeatmapType = t.type({
key_as_string: t.string,
});

export type MonitorStatusHeatmap = t.TypeOf<typeof MonitorStatusHeatmapType>;
export type MonitorStatusHeatmapBucket = t.TypeOf<typeof MonitorStatusHeatmapBucketType>;
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
COLOR_MODES_STANDARD,
} from '@elastic/eui';
import type { BrushEvent } from '@elastic/charts';
import { MonitorStatusHeatmap } from '../../../../../../common/runtime_types';
import { MonitorStatusHeatmapBucket } from '../../../../../../common/runtime_types';

export const SUCCESS_VIZ_COLOR = VISUALIZATION_COLORS[0];
export const DANGER_VIZ_COLOR = VISUALIZATION_COLORS[VISUALIZATION_COLORS.length - 1];
Expand Down Expand Up @@ -114,10 +114,10 @@ export function createTimeBuckets(intervalMinutes: number, from: number, to: num

export function createStatusTimeBins(
timeBuckets: MonitorStatusTimeBucket[],
pingStatuses: MonitorStatusHeatmap[]
heatmapData: MonitorStatusHeatmapBucket[]
): MonitorStatusTimeBin[] {
return timeBuckets.map(({ start, end }) => {
const { ups, downs } = pingStatuses
const { ups, downs } = heatmapData
.filter(({ key }) => key >= start && key <= end)
.reduce(
(acc, cur) => ({
Expand All @@ -126,6 +126,7 @@ export function createStatusTimeBins(
}),
{ ups: 0, downs: 0 }
);

return {
start,
end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* 2.0.
*/

import { MonitorStatusHeatmap } from '../../../../../common/runtime_types';
import { MonitorStatusHeatmapBucket } from '../../../../../common/runtime_types';
import { createAsyncAction } from '../utils/actions';

import { MonitorStatusHeatmapActionArgs } from './models';

export const getMonitorStatusHeatmapAction = createAsyncAction<
MonitorStatusHeatmapActionArgs,
MonitorStatusHeatmap[]
MonitorStatusHeatmapBucket[]
>('MONITOR STATUS HEATMAP');
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { SYNTHETICS_API_URLS } from '../../../../../common/constants';
import { MonitorStatusHeatmap } from '../../../../../common/runtime_types';
import { MonitorStatusHeatmapBucket } from '../../../../../common/runtime_types';
import { apiService } from '../../../../utils/api_service';

export const fetchMonitorStatusHeatmap = async ({
Expand All @@ -21,7 +21,7 @@ export const fetchMonitorStatusHeatmap = async ({
from: string | number;
to: string | number;
interval: number;
}): Promise<MonitorStatusHeatmap[]> =>
}): Promise<MonitorStatusHeatmapBucket[]> =>
apiService.get(SYNTHETICS_API_URLS.MONITOR_STATUS_HEATMAP, {
monitorId,
location,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

import { createReducer } from '@reduxjs/toolkit';

import { MonitorStatusHeatmap as HeatmapType } from '../../../../../common/runtime_types';
import { MonitorStatusHeatmapBucket } from '../../../../../common/runtime_types';

import { IHttpSerializedFetchError } from '../utils/http_error';

import { getMonitorStatusHeatmapAction } from './actions';

export interface MonitorStatusHeatmap {
heatmap: HeatmapType[];
heatmap: MonitorStatusHeatmapBucket[];
loading: boolean;
error: IHttpSerializedFetchError | null;
}
Expand Down

0 comments on commit 232c61d

Please sign in to comment.