-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into vega-version
- Loading branch information
Showing
9 changed files
with
95 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { FetchData, HasData } from './typings/data_handler'; | ||
import { ObservabilityApp } from '../typings/common'; | ||
|
||
interface DataHandler { | ||
fetchData: FetchData; | ||
hasData: HasData; | ||
} | ||
|
||
const dataHandlers: Partial<Record<ObservabilityApp, DataHandler>> = {}; | ||
|
||
export type RegisterDataHandler = (params: { appName: ObservabilityApp } & DataHandler) => void; | ||
export const registerDataHandler: RegisterDataHandler = ({ appName, fetchData, hasData }) => { | ||
dataHandlers[appName] = { fetchData, hasData }; | ||
}; | ||
|
||
export function getDataHandler(appName: ObservabilityApp): DataHandler | undefined { | ||
return dataHandlers[appName]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
x-pack/plugins/observability/public/typings/data_handler/index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
interface Stat { | ||
label: string; | ||
value: string; | ||
color?: string; | ||
} | ||
|
||
export interface Coordinates { | ||
x: number; | ||
y?: number; | ||
} | ||
|
||
interface Series { | ||
label: string; | ||
coordinates: Coordinates[]; | ||
color?: string; | ||
key?: string; | ||
} | ||
|
||
interface FetchDataResponse { | ||
title: string; | ||
appLink: string; | ||
stats: Stat[]; | ||
series: Series[]; | ||
} | ||
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<FetchDataResponse>; | ||
|
||
export type HasData = () => Promise<boolean>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters