[EPM] Include both kibana and elasticsearch assets in package information (#88036)
* Return both kibana and elasticsearch assets. * Fix type complaints.
This commit is contained in:
parent
8eb3865af0
commit
6a55d46b2e
|
@ -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',
|
||||
|
|
|
@ -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'>;
|
||||
|
|
|
@ -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> = {
|
||||
|
|
|
@ -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);
|
||||
|
@ -219,6 +222,6 @@ export function groupPathsByService(paths: string[]): AssetsGroupedByServiceByTy
|
|||
|
||||
return {
|
||||
kibana: assets.kibana,
|
||||
// elasticsearch: assets.elasticsearch,
|
||||
elasticsearch: assets.elasticsearch,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue