From e04f6f4e2d297e3418470b31ce4cb11443306661 Mon Sep 17 00:00:00 2001 From: cauemarcondes Date: Tue, 23 Jun 2020 13:24:07 +0200 Subject: [PATCH] refactoring types --- .../plugins/observability/public/data_handler.ts | 16 +++++++++++++++- .../index.d.ts | 16 +--------------- 2 files changed, 16 insertions(+), 16 deletions(-) rename x-pack/plugins/observability/public/typings/{data_handler => fetch_data_response}/index.d.ts (76%) diff --git a/x-pack/plugins/observability/public/data_handler.ts b/x-pack/plugins/observability/public/data_handler.ts index 382812903fd8e..8f80f79b2e829 100644 --- a/x-pack/plugins/observability/public/data_handler.ts +++ b/x-pack/plugins/observability/public/data_handler.ts @@ -4,9 +4,23 @@ * you may not use this file except in compliance with the Elastic License. */ -import { FetchData, HasData, ObservabilityFetchDataResponse } from './typings/data_handler'; +import { ObservabilityFetchDataResponse, FetchDataResponse } from './typings/fetch_data_response'; import { ObservabilityApp } from '../typings/common'; +interface FetchDataParams { + // The start timestamp in milliseconds of the queried time interval + startTime: string; + // The end timestamp in milliseconds of the queried time interval + endTime: string; + // The aggregation bucket size in milliseconds if applicable to the data source + bucketSize: string; +} + +export type FetchData = ( + fetchDataParams: FetchDataParams +) => Promise; +export type HasData = () => Promise; + interface DataHandler { fetchData: FetchData; hasData: HasData; diff --git a/x-pack/plugins/observability/public/typings/data_handler/index.d.ts b/x-pack/plugins/observability/public/typings/fetch_data_response/index.d.ts similarity index 76% rename from x-pack/plugins/observability/public/typings/data_handler/index.d.ts rename to x-pack/plugins/observability/public/typings/fetch_data_response/index.d.ts index b4e85ed21eefa..30ecb24a58a5a 100644 --- a/x-pack/plugins/observability/public/typings/data_handler/index.d.ts +++ b/x-pack/plugins/observability/public/typings/fetch_data_response/index.d.ts @@ -31,7 +31,7 @@ interface Series { color?: string; } -interface FetchDataResponse { +export interface FetchDataResponse { title: string; appLink: string; } @@ -84,17 +84,3 @@ export interface ObservabilityFetchDataResponse { infra_logs: LogsFetchDataResponse; uptime: UptimeFetchDataResponse; } - -interface FetchDataParams { - // The start timestamp in milliseconds of the queried time interval - startTime: string; - // The end timestamp in milliseconds of the queried time interval - endTime: string; - // The aggregation bucket size in milliseconds if applicable to the data source - bucketSize: string; -} - -export type FetchData = ( - fetchDataParams: FetchDataParams -) => Promise; -type HasData = () => Promise;