Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EPM] Include both kibana and elasticsearch assets in package information #88036

Merged
merged 2 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ describe('Fleet - packageToPackagePolicy', () => {
index_pattern: [],
map: [],
},
elasticsearch: {
ingest_pipeline: [],
component_template: [],
index_template: [],
transform: [],
ilm_policy: [],
data_stream_ilm_policy: [],
},
},
status: 'not_installed',
release: 'experimental',
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/fleet/common/types/models/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ export type AssetTypeToParts = KibanaAssetTypeToParts & ElasticsearchAssetTypeTo
export type AssetsGroupedByServiceByType = Record<
Extract<ServiceName, 'kibana'>,
KibanaAssetTypeToParts
>;
// & Record<Extract<ServiceName, 'elasticsearch'>, ElasticsearchAssetTypeToParts>;
> &
Record<Extract<ServiceName, 'elasticsearch'>, ElasticsearchAssetTypeToParts>;

export type KibanaAssetParts = AssetParts & {
service: Extract<ServiceName, 'kibana'>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ export const AssetTitleMap: Record<AssetType, string> = {
data_stream_ilm_policy: 'Data Stream ILM Policy',
};

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

export const AssetIcons: Record<KibanaAssetType, IconType> = {
Expand Down
7 changes: 5 additions & 2 deletions x-pack/plugins/fleet/server/services/epm/registry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ export function groupPathsByService(paths: string[]): AssetsGroupedByServiceByTy
// ASK: best way, if any, to avoid `any`?
const assets = paths.reduce((map: any, path) => {
const parts = getPathParts(path.replace(/^\/package\//, ''));
if (parts.service === 'kibana' && kibanaAssetTypes.includes(parts.type)) {
if (
(parts.service === 'kibana' && kibanaAssetTypes.includes(parts.type)) ||
parts.service === 'elasticsearch'
) {
if (!map[parts.service]) map[parts.service] = {};
if (!map[parts.service][parts.type]) map[parts.service][parts.type] = [];
map[parts.service][parts.type].push(parts);
Expand All @@ -219,6 +222,6 @@ export function groupPathsByService(paths: string[]): AssetsGroupedByServiceByTy

return {
kibana: assets.kibana,
// elasticsearch: assets.elasticsearch,
elasticsearch: assets.elasticsearch,
};
}