diff --git a/src/plugins/kibana_overview/kibana.json b/src/plugins/kibana_overview/kibana.json index 9ddcaabdaed6b..f09fe0cc16a31 100644 --- a/src/plugins/kibana_overview/kibana.json +++ b/src/plugins/kibana_overview/kibana.json @@ -4,6 +4,6 @@ "server": false, "ui": true, "requiredPlugins": ["navigation", "data", "home"], - "optionalPlugins": ["newsfeed"], + "optionalPlugins": ["newsfeed", "usageCollection"], "requiredBundles": ["kibanaReact", "newsfeed"] } diff --git a/src/plugins/kibana_overview/public/components/add_data/__snapshots__/add_data.test.tsx.snap b/src/plugins/kibana_overview/public/components/add_data/__snapshots__/add_data.test.tsx.snap index 42623abd79ac0..25538d2eda287 100644 --- a/src/plugins/kibana_overview/public/components/add_data/__snapshots__/add_data.test.tsx.snap +++ b/src/plugins/kibana_overview/public/components/add_data/__snapshots__/add_data.test.tsx.snap @@ -61,6 +61,7 @@ exports[`AddData render 1`] = ` iconType="indexOpen" id="home_tutorial_directory" isBeta={false} + onClick={[Function]} title="Ingest data" url="/app/home#/tutorial_directory" wrapInPanel={true} @@ -76,6 +77,7 @@ exports[`AddData render 1`] = ` iconType="indexManagementApp" id="ingestManager" isBeta={false} + onClick={[Function]} title="Add Elastic Agent" url="/app/ingestManager" wrapInPanel={true} @@ -91,6 +93,7 @@ exports[`AddData render 1`] = ` iconType="document" id="ml_file_data_visualizer" isBeta={false} + onClick={[Function]} title="Upload a file" url="/app/ml#/filedatavisualizer" wrapInPanel={true} diff --git a/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx b/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx index c04aa9db87ace..6b3aead0391fc 100644 --- a/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx +++ b/src/plugins/kibana_overview/public/components/add_data/add_data.test.tsx @@ -55,6 +55,10 @@ const mockFeatures = [ }, ]; +jest.mock('../../lib/ui_metric', () => ({ + trackUiMetric: jest.fn(), +})); + const addBasePathMock = jest.fn((path: string) => (path ? path : 'path')); describe('AddData', () => { diff --git a/src/plugins/kibana_overview/public/components/add_data/add_data.tsx b/src/plugins/kibana_overview/public/components/add_data/add_data.tsx index e29c2a08395cf..acb1cf726a28c 100644 --- a/src/plugins/kibana_overview/public/components/add_data/add_data.tsx +++ b/src/plugins/kibana_overview/public/components/add_data/add_data.tsx @@ -26,6 +26,7 @@ import { RedirectAppLinks, useKibana } from '../../../../../../src/plugins/kiban import { FeatureCatalogueEntry } from '../../../../../../src/plugins/home/public'; // @ts-expect-error untyped component import { Synopsis } from '../synopsis'; +import { METRIC_TYPE, trackUiMetric } from '../../lib/ui_metric'; interface Props { addBasePath: (path: string) => string; @@ -82,6 +83,9 @@ export const AddData: FC = ({ addBasePath, features }) => { title={feature.title} url={addBasePath(feature.path)} wrapInPanel + onClick={() => { + trackUiMetric(METRIC_TYPE.CLICK, `ingest_data_card_${feature.id}`); + }} /> diff --git a/src/plugins/kibana_overview/public/components/manage_data/__snapshots__/manage_data.test.tsx.snap b/src/plugins/kibana_overview/public/components/manage_data/__snapshots__/manage_data.test.tsx.snap index 4be9e4df6b736..9abb7c9c12147 100644 --- a/src/plugins/kibana_overview/public/components/manage_data/__snapshots__/manage_data.test.tsx.snap +++ b/src/plugins/kibana_overview/public/components/manage_data/__snapshots__/manage_data.test.tsx.snap @@ -41,6 +41,7 @@ exports[`ManageData render 1`] = ` iconType="securityApp" id="security" isBeta={false} + onClick={[Function]} title="Protect your data" url="path-to-security-roles" wrapInPanel={true} @@ -57,6 +58,7 @@ exports[`ManageData render 1`] = ` iconType="monitoringApp" id="monitoring" isBeta={false} + onClick={[Function]} title="Monitor the stack" url="path-to-monitoring" wrapInPanel={true} @@ -73,6 +75,7 @@ exports[`ManageData render 1`] = ` iconType="storage" id="snapshot_restore" isBeta={false} + onClick={[Function]} title="Store & recover backups" url="path-to-snapshot-restore" wrapInPanel={true} @@ -89,6 +92,7 @@ exports[`ManageData render 1`] = ` iconType="indexSettings" id="index_lifecycle_management" isBeta={false} + onClick={[Function]} title="Manage index lifecycles" url="path-to-index-lifecycle-management" wrapInPanel={true} diff --git a/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx b/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx index 69ef12f217738..e4298aeb191b6 100644 --- a/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx +++ b/src/plugins/kibana_overview/public/components/manage_data/manage_data.test.tsx @@ -66,6 +66,10 @@ const mockFeatures = [ }, ]; +jest.mock('../../lib/ui_metric', () => ({ + trackUiMetric: jest.fn(), +})); + const addBasePathMock = jest.fn((path: string) => (path ? path : 'path')); describe('ManageData', () => { diff --git a/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx b/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx index f7a40b9370efd..5ceff207b2809 100644 --- a/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx +++ b/src/plugins/kibana_overview/public/components/manage_data/manage_data.tsx @@ -26,6 +26,7 @@ import { RedirectAppLinks, useKibana } from '../../../../../../src/plugins/kiban import { FeatureCatalogueEntry } from '../../../../../../src/plugins/home/public'; // @ts-expect-error untyped component import { Synopsis } from '../synopsis'; +import { METRIC_TYPE, trackUiMetric } from '../../lib/ui_metric'; interface Props { addBasePath: (path: string) => string; @@ -68,6 +69,9 @@ export const ManageData: FC = ({ addBasePath, features }) => { title={feature.title} url={addBasePath(feature.path)} wrapInPanel + onClick={() => { + trackUiMetric(METRIC_TYPE.CLICK, `ingest_data_card_${feature.id}`); + }} /> diff --git a/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap b/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap index 028bf085c8c06..142fe37ae932f 100644 --- a/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap +++ b/src/plugins/kibana_overview/public/components/overview/__snapshots__/overview.test.tsx.snap @@ -204,6 +204,7 @@ exports[`Overview render 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png" + onClick={[Function]} title="Kibana" titleElement="h3" titleSize="xs" @@ -229,6 +230,7 @@ exports[`Overview render 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png" + onClick={[Function]} title="Solution two" titleElement="h3" titleSize="xs" @@ -254,6 +256,7 @@ exports[`Overview render 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png" + onClick={[Function]} title="Solution three" titleElement="h3" titleSize="xs" @@ -279,6 +282,7 @@ exports[`Overview render 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png" + onClick={[Function]} title="Solution four" titleElement="h3" titleSize="xs" @@ -358,6 +362,8 @@ exports[`Overview render 1`] = ` ], } } + onChangeDefaultRoute={[Function]} + onSetDefaultRoute={[Function]} path="/app/kibana_overview" /> @@ -624,6 +630,7 @@ exports[`Overview without features 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_kibana_light_2x.png" + onClick={[Function]} title="Kibana" titleElement="h3" titleSize="xs" @@ -649,6 +656,7 @@ exports[`Overview without features 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_2_light_2x.png" + onClick={[Function]} title="Solution two" titleElement="h3" titleSize="xs" @@ -674,6 +682,7 @@ exports[`Overview without features 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_3_light_2x.png" + onClick={[Function]} title="Solution three" titleElement="h3" titleSize="xs" @@ -699,6 +708,7 @@ exports[`Overview without features 1`] = ` /> } image="/plugins/kibanaOverview/assets/solutions_solution_4_light_2x.png" + onClick={[Function]} title="Solution four" titleElement="h3" titleSize="xs" @@ -834,6 +844,8 @@ exports[`Overview without features 1`] = ` ], } } + onChangeDefaultRoute={[Function]} + onSetDefaultRoute={[Function]} path="/app/kibana_overview" /> @@ -1215,6 +1227,8 @@ exports[`Overview without solutions 1`] = ` ], } } + onChangeDefaultRoute={[Function]} + onSetDefaultRoute={[Function]} path="/app/kibana_overview" /> diff --git a/src/plugins/kibana_overview/public/components/overview/overview.test.tsx b/src/plugins/kibana_overview/public/components/overview/overview.test.tsx index 07c3a6e69c15c..9748c60776330 100644 --- a/src/plugins/kibana_overview/public/components/overview/overview.test.tsx +++ b/src/plugins/kibana_overview/public/components/overview/overview.test.tsx @@ -36,6 +36,10 @@ jest.mock('../../../../../../src/plugins/kibana_react/public', () => ({ OverviewPageHeader: jest.fn().mockReturnValue(<>), })); +jest.mock('../../lib/ui_metric', () => ({ + trackUiMetric: jest.fn(), +})); + afterAll(() => jest.clearAllMocks()); const mockNewsFetchResult = { diff --git a/src/plugins/kibana_overview/public/components/overview/overview.tsx b/src/plugins/kibana_overview/public/components/overview/overview.tsx index c951c01aa361e..0a2bcda7ebb15 100644 --- a/src/plugins/kibana_overview/public/components/overview/overview.tsx +++ b/src/plugins/kibana_overview/public/components/overview/overview.tsx @@ -49,6 +49,7 @@ import { AddData } from '../add_data'; import { GettingStarted } from '../getting_started'; import { ManageData } from '../manage_data'; import { NewsFeed } from '../news_feed'; +import { METRIC_TYPE, trackUiMetric } from '../../lib/ui_metric'; const sortByOrder = (featureA: FeatureCatalogueEntry, featureB: FeatureCatalogueEntry) => (featureA.order || Infinity) - (featureB.order || Infinity); @@ -108,6 +109,9 @@ export const Overview: FC = ({ newsFetchResult, solutions, features }) => { + trackUiMetric(METRIC_TYPE.CLICK, `app_card_${appId}`); + }} image={addBasePath( `/plugins/${PLUGIN_ID}/assets/kibana_${appId}_${IS_DARK_THEME ? 'dark' : 'light'}.svg` )} @@ -222,6 +226,9 @@ export const Overview: FC = ({ newsFetchResult, solutions, features }) => title={title} titleElement="h3" titleSize="xs" + onClick={() => { + trackUiMetric(METRIC_TYPE.CLICK, `solution_panel_${id}`); + }} /> @@ -252,7 +259,16 @@ export const Overview: FC = ({ newsFetchResult, solutions, features }) =>