Skip to content

Commit

Permalink
[Fleet] Show all integration assets on detail page (#182180)
Browse files Browse the repository at this point in the history
## Summary
Resolves #160555.

This PR allows all assets to be shown on Integration details > Assets
tab and links them to other apps in Kibana whenever possible for
viewing. Previously, only dashboards, visualizations, and saved searches
were shown in this view. Now all Kibana and Elasticsearch assets are
shown if the integration was installed in the user's current space.

If an integration was installed in a different space, only ES assets
will be shown.

#### Caveats
1) This page lists all assets tracked on the package installation saved
object *after* the package is installed (`installed_es` and
`installed_kibana`). This list differs from the summary of assets shown
on the Overview tab because it includes Fleet-installed assets that are
not part of the package, notably index templates, component templates,
and default ingest pipelines.
#182197 was created to decide
how to resolve this asset count discrepency.

2) ML and Security assets are shown but not linked. The following issues
have been created for downstream teams to decide where their assets
should link to: #182199, #182200

### Screenshots
<details>
<summary>Nginx (including in a different space)</summary>


![image](https://github.com/elastic/kibana/assets/1965714/a2985314-5a08-45fb-9bce-8a4283464cd8)


![image](https://github.com/elastic/kibana/assets/1965714/97981e0c-3149-4629-83ec-3c718a393635)
</details>

<details>
<summary>Security Posture Management</summary>


![image](https://github.com/elastic/kibana/assets/1965714/93314f9f-6797-4871-927a-ffe11f11f32f)
</details>

<details>
<summary>Rapid7 Threat Command</summary>


![image](https://github.com/elastic/kibana/assets/1965714/d31578c6-711a-4d52-9b85-2f60267e41ba)
</details>

<details>
<summary>Lateral Movement Detection</summary>


![image](https://github.com/elastic/kibana/assets/1965714/6720eceb-9e42-4024-8ab5-efef6553c3b7)
</details>

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
jen-huang and kibanamachine committed May 1, 2024
1 parent c5c4098 commit 980d8bf
Show file tree
Hide file tree
Showing 21 changed files with 618 additions and 550 deletions.
16 changes: 8 additions & 8 deletions x-pack/plugins/fleet/common/constants/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { AllowedAssetTypes } from '../types/models';
import { ElasticsearchAssetType, KibanaAssetType } from '../types/models';
import type { DisplayedAssetTypes } from '../types/models';
import { ElasticsearchAssetType, KibanaSavedObjectType } from '../types/models';

export const PACKAGES_SAVED_OBJECT_TYPE = 'epm-packages';
export const ASSETS_SAVED_OBJECT_TYPE = 'epm-packages-assets';
Expand Down Expand Up @@ -87,11 +87,11 @@ export const installationStatuses = {
NotInstalled: 'not_installed',
} as const;

export const allowedAssetTypes: AllowedAssetTypes = [
KibanaAssetType.dashboard,
KibanaAssetType.search,
KibanaAssetType.visualization,
ElasticsearchAssetType.transform,
// These asset types are allowed to be shown on Integration details > Assets tab
// This array also controls the order in which the asset types are displayed
export const displayedAssetTypes: DisplayedAssetTypes = [
...Object.values(KibanaSavedObjectType),
...Object.values(ElasticsearchAssetType),
];

export const allowedAssetTypesLookup = new Set<string>(allowedAssetTypes);
export const displayedAssetTypesLookup = new Set<string>(displayedAssetTypes);
2 changes: 1 addition & 1 deletion x-pack/plugins/fleet/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export type {
FleetServerAgentComponentStatus,
AssetSOObject,
SimpleSOAssetType,
AllowedAssetTypes,
DisplayedAssetTypes,
} from './types';

export { ElasticsearchAssetType } from './types';
46 changes: 23 additions & 23 deletions x-pack/plugins/fleet/common/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -6295,33 +6295,33 @@
"type": "object",
"deprecated": true,
"properties": {
"response": {
"items": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"$ref": "#/components/schemas/saved_object_type"
},
"updatedAt": {
"type": "string"
},
"attributes": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"description": {
"type": "string"
}
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"$ref": "#/components/schemas/saved_object_type"
},
"updatedAt": {
"type": "string"
},
"attributes": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"description": {
"type": "string"
}
}
},
"appLink": {
"type": "string"
}
}
}
Expand Down
36 changes: 18 additions & 18 deletions x-pack/plugins/fleet/common/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3971,26 +3971,26 @@ components:
type: object
deprecated: true
properties:
response:
items:
type: array
items:
type: array
items:
type: object
properties:
id:
type: string
type:
$ref: '#/components/schemas/saved_object_type'
updatedAt:
type: string
attributes:
type: object
properties:
title:
type: string
description:
type: string
type: object
properties:
id:
type: string
type:
$ref: '#/components/schemas/saved_object_type'
updatedAt:
type: string
attributes:
type: object
properties:
title:
type: string
description:
type: string
appLink:
type: string
required:
- items
get_categories_response:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ title: Bulk get assets response
type: object
deprecated: true
properties:
response:
items:
type: array
items:
type: array
items:
type: object
properties:
id:
type: string
type:
$ref: ./saved_object_type.yaml
updatedAt:
type: string
attributes:
type: object
properties:
title:
type: string
description:
type: string
type: object
properties:
id:
type: string
type:
$ref: ./saved_object_type.yaml
updatedAt:
type: string
attributes:
type: object
properties:
title:
type: string
description:
type: string
appLink:
type: string
required:
- items
22 changes: 9 additions & 13 deletions x-pack/plugins/fleet/common/types/models/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,65 +53,61 @@ export type AssetType =
*/
export enum KibanaAssetType {
dashboard = 'dashboard',
lens = 'lens',
visualization = 'visualization',
search = 'search',
indexPattern = 'index_pattern',
map = 'map',
lens = 'lens',
mlModule = 'ml_module',
securityRule = 'security_rule',
cloudSecurityPostureRuleTemplate = 'csp_rule_template',
mlModule = 'ml_module',
tag = 'tag',
osqueryPackAsset = 'osquery_pack_asset',
osquerySavedQuery = 'osquery_saved_query',
tag = 'tag',
}

/*
Enum of saved object types that are allowed to be installed
*/
export enum KibanaSavedObjectType {
dashboard = 'dashboard',
lens = 'lens',
visualization = 'visualization',
search = 'search',
indexPattern = 'index-pattern',
map = 'map',
lens = 'lens',
mlModule = 'ml-module',
securityRule = 'security-rule',
cloudSecurityPostureRuleTemplate = 'csp-rule-template',
tag = 'tag',
osqueryPackAsset = 'osquery-pack-asset',
osquerySavedQuery = 'osquery-saved-query',
tag = 'tag',
}

export enum ElasticsearchAssetType {
index = 'index',
indexTemplate = 'index_template',
componentTemplate = 'component_template',
ingestPipeline = 'ingest_pipeline',
indexTemplate = 'index_template',
ilmPolicy = 'ilm_policy',
transform = 'transform',
dataStreamIlmPolicy = 'data_stream_ilm_policy',
transform = 'transform',
mlModel = 'ml_model',
}
export type FleetElasticsearchAssetType = Exclude<
ElasticsearchAssetType,
ElasticsearchAssetType.index
>;

export type AllowedAssetTypes = [
KibanaAssetType.dashboard,
KibanaAssetType.search,
KibanaAssetType.visualization,
ElasticsearchAssetType.transform
];
export type DisplayedAssetTypes = Array<`${KibanaSavedObjectType | ElasticsearchAssetType}`>;

// Defined as part of the removing public references to saved object schemas
export interface SimpleSOAssetType {
id: string;
type: ElasticsearchAssetType | KibanaSavedObjectType;
updatedAt?: string;
attributes: {
service?: string;
title?: string;
description?: string;
};
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/fleet/common/types/rest_spec/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export interface GetBulkAssetsRequest {
}

export interface GetBulkAssetsResponse {
items: SimpleSOAssetType[];
items: Array<SimpleSOAssetType & { appLink?: string }>;
}

export interface GetInputsTemplatesRequest {
Expand Down

This file was deleted.

0 comments on commit 980d8bf

Please sign in to comment.