Skip to content

Commit

Permalink
refactoring types
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed Jun 23, 2020
1 parent d9e63c5 commit e04f6f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 15 additions & 1 deletion x-pack/plugins/observability/public/data_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends FetchDataResponse = FetchDataResponse> = (
fetchDataParams: FetchDataParams
) => Promise<T>;
export type HasData = () => Promise<boolean>;

interface DataHandler {
fetchData: FetchData;
hasData: HasData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface Series {
color?: string;
}

interface FetchDataResponse {
export interface FetchDataResponse {
title: string;
appLink: string;
}
Expand Down Expand Up @@ -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<T extends FetchDataResponse = FetchDataResponse> = (
fetchDataParams: FetchDataParams
) => Promise<T>;
type HasData = () => Promise<boolean>;

0 comments on commit e04f6f4

Please sign in to comment.