Skip to content

Commit

Permalink
[Fleet] Remove duplication between two files elastic#103282
Browse files Browse the repository at this point in the history
## Summary

`public/applications/integrations/constants.tsx` and
`public/applications/integrations/sections/epm/constants.tsx` are identical except for this line in `public/applications/integrations/constants.tsx`

```ts
export * from '../../constants';
```

This PR removes all the duplication from the "upper" file (`public/applications/integrations/constants.tsx`) and leaves the other code "down" in `/sections/epm/` closer to where it's used.

Initially, I deleted `public/applications/integrations/constants.tsx` entirely but several files do `import` the constants it exports, so I left it.
  • Loading branch information
John Schulz committed Jun 24, 2021
1 parent bfb9805 commit eb8e9d7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,4 @@
* 2.0.
*/

import type { IconType } from '@elastic/eui';

import type { ServiceName } from '../../types';
import { ElasticsearchAssetType, KibanaAssetType } from '../../types';

export * from '../../constants';

// only allow Kibana assets for the kibana key, ES asssets for elasticsearch, etc
type ServiceNameToAssetTypes = Record<Extract<ServiceName, 'kibana'>, KibanaAssetType[]> &
Record<Extract<ServiceName, 'elasticsearch'>, ElasticsearchAssetType[]>;

export const DisplayedAssets: ServiceNameToAssetTypes = {
kibana: Object.values(KibanaAssetType),
elasticsearch: Object.values(ElasticsearchAssetType),
};
export type DisplayedAssetType = KibanaAssetType | ElasticsearchAssetType;

export const AssetTitleMap: Record<DisplayedAssetType, string> = {
dashboard: 'Dashboard',
ilm_policy: 'ILM Policy',
ingest_pipeline: 'Ingest Pipeline',
transform: 'Transform',
index_pattern: 'Index Pattern',
index_template: 'Index Template',
component_template: 'Component Template',
search: 'Saved Search',
visualization: 'Visualization',
map: 'Map',
data_stream_ilm_policy: 'Data Stream ILM Policy',
lens: 'Lens',
security_rule: 'Security Rule',
ml_module: 'ML Module',
};

export const ServiceTitleMap: Record<ServiceName, string> = {
kibana: 'Kibana',
elasticsearch: 'Elasticsearch',
};

export const AssetIcons: Record<KibanaAssetType, IconType> = {
dashboard: 'dashboardApp',
index_pattern: 'indexPatternApp',
search: 'searchProfilerApp',
visualization: 'visualizeApp',
map: 'emsApp',
lens: 'lensApp',
security_rule: 'securityApp',
ml_module: 'mlApp',
};

export const ServiceIcons: Record<ServiceName, IconType> = {
elasticsearch: 'logoElasticsearch',
kibana: 'logoKibana',
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
EuiNotificationBadge,
} from '@elastic/eui';

import { AssetTitleMap } from '../../../../../constants';
import { AssetTitleMap } from '../../../constants';

import { getHrefToObjectInKibanaApp, useStartServices } from '../../../../../hooks';

Expand Down

0 comments on commit eb8e9d7

Please sign in to comment.