mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[nit][pre-req] Strongly-type Shipper and Category (#114412)
This commit is contained in:
parent
c926b14c32
commit
243c2133af
1 changed files with 54 additions and 7 deletions
|
@ -9,13 +9,11 @@
|
|||
export const PLUGIN_ID = 'customIntegrations';
|
||||
export const PLUGIN_NAME = 'customIntegrations';
|
||||
|
||||
export interface IntegrationCategoryCount {
|
||||
count: number;
|
||||
id: IntegrationCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* A map of category names and their corresponding titles.
|
||||
*/
|
||||
// TODO: consider i18n
|
||||
export const INTEGRATION_CATEGORY_DISPLAY = {
|
||||
// Known EPR
|
||||
aws: 'AWS',
|
||||
azure: 'Azure',
|
||||
cloud: 'Cloud',
|
||||
|
@ -49,13 +47,62 @@ export const INTEGRATION_CATEGORY_DISPLAY = {
|
|||
updates_available: 'Updates available',
|
||||
};
|
||||
|
||||
/**
|
||||
* A category applicable to an Integration.
|
||||
*/
|
||||
export type IntegrationCategory = keyof typeof INTEGRATION_CATEGORY_DISPLAY;
|
||||
|
||||
/**
|
||||
* The list of all available categories.
|
||||
*/
|
||||
// This `as` is necessary, as Object.keys cannot be strongly typed.
|
||||
// see: https://github.com/Microsoft/TypeScript/issues/12870
|
||||
export const category = Object.keys(INTEGRATION_CATEGORY_DISPLAY) as IntegrationCategory[];
|
||||
|
||||
/**
|
||||
* An object containing the id of an `IntegrationCategory` and the count of all Integrations in that category.
|
||||
*/
|
||||
export interface IntegrationCategoryCount {
|
||||
count: number;
|
||||
id: IntegrationCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* A map of shipper names and their corresponding titles.
|
||||
*/
|
||||
// TODO: consider i18n
|
||||
export const SHIPPER_DISPLAY = {
|
||||
beats: 'Beats',
|
||||
language_clients: 'Language clients',
|
||||
other: 'Other',
|
||||
sample_data: 'Sample data',
|
||||
tests: 'Tests',
|
||||
tutorial: 'Tutorials',
|
||||
};
|
||||
|
||||
/**
|
||||
* A shipper-- an internal or external system capable of storing data in ES/Kibana-- applicable to an Integration.
|
||||
*/
|
||||
export type Shipper = keyof typeof SHIPPER_DISPLAY;
|
||||
|
||||
/**
|
||||
* The list of all known shippers.
|
||||
*/
|
||||
// This `as` is necessary, as Object.keys cannot be strongly typed.
|
||||
// see: https://github.com/Microsoft/TypeScript/issues/12870
|
||||
export const shipper = Object.keys(SHIPPER_DISPLAY) as Shipper[];
|
||||
|
||||
/**
|
||||
* An icon representing an Integration.
|
||||
*/
|
||||
export interface CustomIntegrationIcon {
|
||||
src: string;
|
||||
type: 'eui' | 'svg';
|
||||
}
|
||||
|
||||
/**
|
||||
* A definition of a dataintegration, which can be registered with Kibana.
|
||||
*/
|
||||
export interface CustomIntegration {
|
||||
id: string;
|
||||
title: string;
|
||||
|
@ -65,7 +112,7 @@ export interface CustomIntegration {
|
|||
isBeta: boolean;
|
||||
icons: CustomIntegrationIcon[];
|
||||
categories: IntegrationCategory[];
|
||||
shipper: string;
|
||||
shipper: Shipper;
|
||||
eprOverlap?: string; // name of the equivalent Elastic Agent integration in EPR. e.g. a beat module can correspond to an EPR-package, or an APM-tutorial. When completed, Integrations-UX can preferentially show the EPR-package, rather than the custom-integration
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue