diff --git a/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts b/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts index 3523c73ee64e..1192f0a3e8e5 100644 --- a/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts +++ b/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts @@ -26,6 +26,7 @@ describe('Fleet - packageToPackagePolicy', () => { search: [], index_pattern: [], map: [], + lens: [], }, elasticsearch: { ingest_pipeline: [], diff --git a/x-pack/plugins/fleet/common/types/models/epm.ts b/x-pack/plugins/fleet/common/types/models/epm.ts index 672486355741..e09fbfc80b19 100644 --- a/x-pack/plugins/fleet/common/types/models/epm.ts +++ b/x-pack/plugins/fleet/common/types/models/epm.ts @@ -46,6 +46,7 @@ export enum KibanaAssetType { search = 'search', indexPattern = 'index_pattern', map = 'map', + lens = 'lens', } /* @@ -57,6 +58,7 @@ export enum KibanaSavedObjectType { search = 'search', indexPattern = 'index-pattern', map = 'map', + lens = 'lens', } export enum ElasticsearchAssetType { diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx index 01f9ecb2723a..fcfb2786ab70 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx @@ -28,6 +28,7 @@ export const AssetTitleMap: Record = { input: 'Agent input', map: 'Map', data_stream_ilm_policy: 'Data Stream ILM Policy', + lens: 'Lens', }; export const ServiceTitleMap: Record = { @@ -41,6 +42,7 @@ export const AssetIcons: Record = { search: 'searchProfilerApp', visualization: 'visualizeApp', map: 'emsApp', + lens: 'lensApp', }; export const ServiceIcons: Record = { diff --git a/x-pack/plugins/fleet/server/services/epm/kibana/assets/install.ts b/x-pack/plugins/fleet/server/services/epm/kibana/assets/install.ts index fe93ed84b32f..eec055e25134 100644 --- a/x-pack/plugins/fleet/server/services/epm/kibana/assets/install.ts +++ b/x-pack/plugins/fleet/server/services/epm/kibana/assets/install.ts @@ -39,6 +39,7 @@ const KibanaSavedObjectTypeMapping: Record { diff --git a/x-pack/test/fleet_api_integration/apis/epm/install_remove_assets.ts b/x-pack/test/fleet_api_integration/apis/epm/install_remove_assets.ts index 1d5f864c27ee..a5d347703cd9 100644 --- a/x-pack/test/fleet_api_integration/apis/epm/install_remove_assets.ts +++ b/x-pack/test/fleet_api_integration/apis/epm/install_remove_assets.ts @@ -388,6 +388,11 @@ const expectAssetsInstalled = ({ id: 'sample_search', }); expect(resSearch.id).equal('sample_search'); + const resLens = await kibanaServer.savedObjects.get({ + type: 'lens', + id: 'sample_lens', + }); + expect(resLens.id).equal('sample_lens'); const resIndexPattern = await kibanaServer.savedObjects.get({ type: 'index-pattern', id: 'test-*', @@ -449,6 +454,10 @@ const expectAssetsInstalled = ({ id: 'test-*', type: 'index-pattern', }, + { + id: 'sample_lens', + type: 'lens', + }, { id: 'sample_search', type: 'search', @@ -515,6 +524,7 @@ const expectAssetsInstalled = ({ { id: '60d6d054-57e4-590f-a580-52bf3f5e7cca', type: 'epm-packages-assets' }, { id: '47758dc2-979d-5fbe-a2bd-9eded68a5a43', type: 'epm-packages-assets' }, { id: '318959c9-997b-5a14-b328-9fc7355b4b74', type: 'epm-packages-assets' }, + { id: 'e21b59b5-eb76-5ab0-bef2-1c8e379e6197', type: 'epm-packages-assets' }, { id: 'e786cbd9-0f3b-5a0b-82a6-db25145ebf58', type: 'epm-packages-assets' }, { id: '53c94591-aa33-591d-8200-cd524c2a0561', type: 'epm-packages-assets' }, { id: 'b658d2d4-752e-54b8-afc2-4c76155c1466', type: 'epm-packages-assets' }, diff --git a/x-pack/test/fleet_api_integration/apis/epm/update_assets.ts b/x-pack/test/fleet_api_integration/apis/epm/update_assets.ts index 7b264f949532..6dd10240b247 100644 --- a/x-pack/test/fleet_api_integration/apis/epm/update_assets.ts +++ b/x-pack/test/fleet_api_integration/apis/epm/update_assets.ts @@ -291,6 +291,10 @@ export default function (providerContext: FtrProviderContext) { id: 'sample_search2', type: 'search', }, + { + id: 'sample_lens', + type: 'lens', + }, ], installed_es: [ { @@ -338,6 +342,7 @@ export default function (providerContext: FtrProviderContext) { { id: '5c3aa147-089c-5084-beca-53c00e72ac80', type: 'epm-packages-assets' }, { id: '48e582df-b1d2-5f88-b6ea-ba1fafd3a569', type: 'epm-packages-assets' }, { id: 'bf3b0b65-9fdc-53c6-a9ca-e76140e56490', type: 'epm-packages-assets' }, + { id: '7f4c5aca-b4f5-5f0a-95af-051da37513fc', type: 'epm-packages-assets' }, { id: '2e56f08b-1d06-55ed-abee-4708e1ccf0aa', type: 'epm-packages-assets' }, { id: 'c7bf1a39-e057-58a0-afde-fb4b48751d8c', type: 'epm-packages-assets' }, { id: '8c665f28-a439-5f43-b5fd-8fda7b576735', type: 'epm-packages-assets' }, diff --git a/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/all_assets/0.1.0/kibana/lens/sample_lens.json b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/all_assets/0.1.0/kibana/lens/sample_lens.json new file mode 100644 index 000000000000..0eefa2790b06 --- /dev/null +++ b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/all_assets/0.1.0/kibana/lens/sample_lens.json @@ -0,0 +1,114 @@ +{ + "type": "lens", + "id": "sample_lens", + "attributes": { + "title": "sample-lens", + "description": "", + "visualizationType": "lnsXY", + "state": { + "datasourceStates": { + "indexpattern": { + "layers": { + "91b37ed1-ec9f-401d-8ba5-990c2fc65cd0": { + "columns": { + "2c9a6ea8-f3c1-4178-b6af-9e1a5811888a": { + "label": "Top values of HostDetails.agent.name", + "dataType": "string", + "operationType": "terms", + "scale": "ordinal", + "sourceField": "HostDetails.agent.name", + "isBucketed": true, + "params": { + "size": 5, + "orderBy": { + "type": "column", + "columnId": "64b26756-2616-4835-bf77-e0e3807cf827" + }, + "orderDirection": "desc", + "otherBucket": true, + "missingBucket": false + } + }, + "64b26756-2616-4835-bf77-e0e3807cf827": { + "label": "Count of records", + "dataType": "number", + "operationType": "count", + "isBucketed": false, + "scale": "ratio", + "sourceField": "Records" + } + }, + "columnOrder": [ + "2c9a6ea8-f3c1-4178-b6af-9e1a5811888a", + "64b26756-2616-4835-bf77-e0e3807cf827" + ], + "incompleteColumns": {} + } + } + } + }, + "visualization": { + "legend": { + "isVisible": true, + "position": "right" + }, + "valueLabels": "hide", + "fittingFunction": "None", + "axisTitlesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "tickLabelsVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "gridlinesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "preferredSeriesType": "bar_stacked", + "layers": [ + { + "layerId": "91b37ed1-ec9f-401d-8ba5-990c2fc65cd0", + "accessors": [ + "64b26756-2616-4835-bf77-e0e3807cf827" + ], + "position": "top", + "seriesType": "bar_stacked", + "showGridlines": false, + "xAccessor": "2c9a6ea8-f3c1-4178-b6af-9e1a5811888a" + } + ] + }, + "query": { + "query": "", + "language": "kuery" + }, + "filters": [] + } + }, + "references": [ + { + "type": "index-pattern", + "id": "metrics-*", + "name": "indexpattern-datasource-current-indexpattern" + }, + { + "type": "index-pattern", + "id": "metrics-*", + "name": "indexpattern-datasource-layer-91b37ed1-ec9f-401d-8ba5-990c2fc65cd0" + } + ], + "migrationVersion": { + "lens": "7.11.0" + }, + "updated_at": "2021-01-13T15:16:10.075Z", + "version": "WzI5NCwxXQ==", + "namespaces": [ + "default" + ], + "score": 0 +} \ No newline at end of file diff --git a/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/all_assets/0.2.0/kibana/lens/sample_lens.json b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/all_assets/0.2.0/kibana/lens/sample_lens.json new file mode 100644 index 000000000000..0eefa2790b06 --- /dev/null +++ b/x-pack/test/fleet_api_integration/apis/fixtures/test_packages/all_assets/0.2.0/kibana/lens/sample_lens.json @@ -0,0 +1,114 @@ +{ + "type": "lens", + "id": "sample_lens", + "attributes": { + "title": "sample-lens", + "description": "", + "visualizationType": "lnsXY", + "state": { + "datasourceStates": { + "indexpattern": { + "layers": { + "91b37ed1-ec9f-401d-8ba5-990c2fc65cd0": { + "columns": { + "2c9a6ea8-f3c1-4178-b6af-9e1a5811888a": { + "label": "Top values of HostDetails.agent.name", + "dataType": "string", + "operationType": "terms", + "scale": "ordinal", + "sourceField": "HostDetails.agent.name", + "isBucketed": true, + "params": { + "size": 5, + "orderBy": { + "type": "column", + "columnId": "64b26756-2616-4835-bf77-e0e3807cf827" + }, + "orderDirection": "desc", + "otherBucket": true, + "missingBucket": false + } + }, + "64b26756-2616-4835-bf77-e0e3807cf827": { + "label": "Count of records", + "dataType": "number", + "operationType": "count", + "isBucketed": false, + "scale": "ratio", + "sourceField": "Records" + } + }, + "columnOrder": [ + "2c9a6ea8-f3c1-4178-b6af-9e1a5811888a", + "64b26756-2616-4835-bf77-e0e3807cf827" + ], + "incompleteColumns": {} + } + } + } + }, + "visualization": { + "legend": { + "isVisible": true, + "position": "right" + }, + "valueLabels": "hide", + "fittingFunction": "None", + "axisTitlesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "tickLabelsVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "gridlinesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "preferredSeriesType": "bar_stacked", + "layers": [ + { + "layerId": "91b37ed1-ec9f-401d-8ba5-990c2fc65cd0", + "accessors": [ + "64b26756-2616-4835-bf77-e0e3807cf827" + ], + "position": "top", + "seriesType": "bar_stacked", + "showGridlines": false, + "xAccessor": "2c9a6ea8-f3c1-4178-b6af-9e1a5811888a" + } + ] + }, + "query": { + "query": "", + "language": "kuery" + }, + "filters": [] + } + }, + "references": [ + { + "type": "index-pattern", + "id": "metrics-*", + "name": "indexpattern-datasource-current-indexpattern" + }, + { + "type": "index-pattern", + "id": "metrics-*", + "name": "indexpattern-datasource-layer-91b37ed1-ec9f-401d-8ba5-990c2fc65cd0" + } + ], + "migrationVersion": { + "lens": "7.11.0" + }, + "updated_at": "2021-01-13T15:16:10.075Z", + "version": "WzI5NCwxXQ==", + "namespaces": [ + "default" + ], + "score": 0 +} \ No newline at end of file