diff --git a/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap b/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap
index e9b0494105e12..b949fa7995d30 100644
--- a/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap
+++ b/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap
@@ -44,6 +44,8 @@ exports[`home change home route should render a link to change the default route
/>
@@ -94,6 +96,8 @@ exports[`home directories should not render directory entry when showOnHomePage
/>
@@ -156,6 +160,8 @@ exports[`home directories should render ADMIN directory entry in "Manage your da
/>
@@ -218,6 +224,8 @@ exports[`home directories should render DATA directory entry in "Ingest your dat
/>
@@ -320,6 +328,8 @@ exports[`home directories should render solutions in the "solution section" 1`]
/>
@@ -370,6 +380,8 @@ exports[`home header render 1`] = `
/>
@@ -432,6 +444,8 @@ exports[`home header should show "Dev tools" link if console is available 1`] =
/>
@@ -482,6 +496,8 @@ exports[`home header should show "Manage" link if stack management is available
/>
@@ -532,6 +548,8 @@ exports[`home isNewKibanaInstance should safely handle execeptions 1`] = `
/>
@@ -582,6 +600,8 @@ exports[`home isNewKibanaInstance should set isNewKibanaInstance to false when t
/>
@@ -632,6 +652,8 @@ exports[`home isNewKibanaInstance should set isNewKibanaInstance to true when th
/>
@@ -682,6 +704,8 @@ exports[`home should render home component 1`] = `
/>
@@ -732,6 +756,8 @@ exports[`home welcome should show the normal home page if loading fails 1`] = `
/>
@@ -782,6 +808,8 @@ exports[`home welcome should show the normal home page if welcome screen is disa
/>
@@ -839,6 +867,8 @@ exports[`home welcome stores skip welcome setting if skipped 1`] = `
/>
diff --git a/src/plugins/home/public/application/components/add_data/add_data.test.tsx b/src/plugins/home/public/application/components/add_data/add_data.test.tsx
index b6d97db7388cc..9ba554dd2c222 100644
--- a/src/plugins/home/public/application/components/add_data/add_data.test.tsx
+++ b/src/plugins/home/public/application/components/add_data/add_data.test.tsx
@@ -27,6 +27,12 @@ jest.mock('../app_navigation_handler', () => {
};
});
+jest.mock('../../kibana_services', () => ({
+ getServices: () => ({
+ trackUiMetric: jest.fn(),
+ }),
+}));
+
beforeEach(() => {
jest.clearAllMocks();
});
diff --git a/src/plugins/home/public/application/components/add_data/add_data.tsx b/src/plugins/home/public/application/components/add_data/add_data.tsx
index 0311c1fc5e5c6..eb710f0fcc168 100644
--- a/src/plugins/home/public/application/components/add_data/add_data.tsx
+++ b/src/plugins/home/public/application/components/add_data/add_data.tsx
@@ -17,69 +17,78 @@
* under the License.
*/
-import React, { FC } from 'react';
+import React, { FC, MouseEvent } from 'react';
import PropTypes from 'prop-types';
import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
+import { METRIC_TYPE } from '@kbn/analytics';
// @ts-expect-error untyped service
import { FeatureCatalogueEntry } from '../../services';
import { createAppNavigationHandler } from '../app_navigation_handler';
// @ts-expect-error untyped component
import { Synopsis } from '../synopsis';
+import { getServices } from '../../kibana_services';
interface Props {
addBasePath: (path: string) => string;
features: FeatureCatalogueEntry[];
}
-export const AddData: FC = ({ addBasePath, features }) => (
-
-
-
-
-
-
-
-
-
+export const AddData: FC = ({ addBasePath, features }) => {
+ const { trackUiMetric } = getServices();
-
-
-
-
-
-
-
-
-
-
+ return (
+
+
+
+
+
+
+
+
+
-
- {features.map((feature) => (
-
-
+
+
+
+
+
+
- ))}
-
-
-);
+
+
+
+
+
+ {features.map((feature) => (
+
+ {
+ trackUiMetric(METRIC_TYPE.CLICK, `ingest_data_card_${feature.id}`);
+ createAppNavigationHandler(feature.path)(event);
+ }}
+ description={feature.description}
+ iconType={feature.icon}
+ title={feature.title}
+ url={addBasePath(feature.path)}
+ wrapInPanel
+ />
+
+ ))}
+
+
+ );
+};
AddData.propTypes = {
addBasePath: PropTypes.func.isRequired,
diff --git a/src/plugins/home/public/application/components/home.js b/src/plugins/home/public/application/components/home.js
index 054f5a5344df4..a990beaa6a442 100644
--- a/src/plugins/home/public/application/components/home.js
+++ b/src/plugins/home/public/application/components/home.js
@@ -21,6 +21,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiFlexGroup, EuiFlexItem, EuiHorizontalRule } from '@elastic/eui';
+import { METRIC_TYPE } from '@kbn/analytics';
import { i18n } from '@kbn/i18n';
import {
OverviewPageFooter,
@@ -120,7 +121,7 @@ export class Home extends Component {
renderNormal() {
const { addBasePath, solutions, directories } = this.props;
-
+ const { trackUiMetric } = getServices();
const devTools = this.findDirectoryById('console');
const addDataFeatures = this.getFeaturesByCategory(FeatureCatalogueCategory.DATA);
const manageDataFeatures = this.getFeaturesByCategory(FeatureCatalogueCategory.ADMIN);
@@ -171,7 +172,16 @@ export class Home extends Component {
-
+ {
+ trackUiMetric(METRIC_TYPE.CLICK, 'set_home_as_default_route');
+ }}
+ onChangeDefaultRoute={() => {
+ trackUiMetric(METRIC_TYPE.CLICK, 'change_to_different_default_route');
+ }}
+ />
);
diff --git a/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx b/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx
index 18a58e86eaa3f..69c7ec46a7a2c 100644
--- a/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx
+++ b/src/plugins/home/public/application/components/manage_data/manage_data.test.tsx
@@ -27,6 +27,12 @@ jest.mock('../app_navigation_handler', () => {
};
});
+jest.mock('../../kibana_services', () => ({
+ getServices: () => ({
+ trackUiMetric: jest.fn(),
+ }),
+}));
+
beforeEach(() => {
jest.clearAllMocks();
});
diff --git a/src/plugins/home/public/application/components/manage_data/manage_data.tsx b/src/plugins/home/public/application/components/manage_data/manage_data.tsx
index 85f1bc04f353b..afef5010d47a5 100644
--- a/src/plugins/home/public/application/components/manage_data/manage_data.tsx
+++ b/src/plugins/home/public/application/components/manage_data/manage_data.tsx
@@ -17,58 +17,69 @@
* under the License.
*/
-import React, { FC } from 'react';
+import React, { FC, MouseEvent } from 'react';
import PropTypes from 'prop-types';
import { EuiFlexGroup, EuiHorizontalRule, EuiSpacer, EuiTitle, EuiFlexItem } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
+import { METRIC_TYPE } from '@kbn/analytics';
// @ts-expect-error untyped service
import { FeatureCatalogueEntry } from '../../services';
import { createAppNavigationHandler } from '../app_navigation_handler';
// @ts-expect-error untyped component
import { Synopsis } from '../synopsis';
+import { getServices } from '../../kibana_services';
interface Props {
addBasePath: (path: string) => string;
features: FeatureCatalogueEntry[];
}
-export const ManageData: FC = ({ addBasePath, features }) => (
- <>
- {features.length > 1 && }
+export const ManageData: FC = ({ addBasePath, features }) => {
+ const { trackUiMetric } = getServices();
+ return (
+ <>
+ {features.length > 1 && }
- {features.length > 0 && (
-
-
-
-
-
-
+ {features.length > 0 && (
+
+
+
+
+
+
-
+
-
- {features.map((feature) => (
-
-
-
- ))}
-
-
- )}
- >
-);
+
+ {features.map((feature) => (
+
+ {
+ trackUiMetric(METRIC_TYPE.CLICK, `manage_data_card_${feature.id}`);
+ createAppNavigationHandler(feature.path)(event);
+ }}
+ description={feature.description}
+ iconType={feature.icon}
+ title={feature.title}
+ url={addBasePath(feature.path)}
+ wrapInPanel
+ />
+
+ ))}
+
+
+ )}
+ >
+ );
+};
ManageData.propTypes = {
addBasePath: PropTypes.func.isRequired,
diff --git a/src/plugins/home/public/application/components/solutions_section/solution_panel.test.tsx b/src/plugins/home/public/application/components/solutions_section/solution_panel.test.tsx
index ddfe1288ff860..091677f77e636 100644
--- a/src/plugins/home/public/application/components/solutions_section/solution_panel.test.tsx
+++ b/src/plugins/home/public/application/components/solutions_section/solution_panel.test.tsx
@@ -32,6 +32,12 @@ const solutionEntry = {
order: 1,
};
+jest.mock('../../kibana_services', () => ({
+ getServices: () => ({
+ trackUiMetric: jest.fn(),
+ }),
+}));
+
const addBasePathMock = (path: string) => (path ? path : 'path');
describe('SolutionPanel', () => {
diff --git a/src/plugins/home/public/application/components/solutions_section/solution_panel.tsx b/src/plugins/home/public/application/components/solutions_section/solution_panel.tsx
index 943260efb275f..bd8334e656b56 100644
--- a/src/plugins/home/public/application/components/solutions_section/solution_panel.tsx
+++ b/src/plugins/home/public/application/components/solutions_section/solution_panel.tsx
@@ -17,11 +17,13 @@
* under the License.
*/
-import React, { FC } from 'react';
+import React, { FC, MouseEvent } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiSpacer, EuiText } from '@elastic/eui';
+import { METRIC_TYPE } from '@kbn/analytics';
import { FeatureCatalogueEntry, FeatureCatalogueSolution } from '../../../';
import { createAppNavigationHandler } from '../app_navigation_handler';
import { SolutionTitle } from './solution_title';
+import { getServices } from '../../kibana_services';
const getDescriptionText = (description: string): JSX.Element => (
@@ -53,37 +55,44 @@ interface Props {
apps?: FeatureCatalogueEntry[];
}
-export const SolutionPanel: FC = ({ addBasePath, solution, apps = [] }) => (
-
- = ({ addBasePath, solution, apps = [] }) => {
+ const { trackUiMetric } = getServices();
+
+ return (
+
-
-
-
-
-
+ {
+ trackUiMetric(METRIC_TYPE.CLICK, `solution_panel_${solution.id}`);
+ createAppNavigationHandler(solution.path)(event);
+ }}
+ >
+
+
+
+
+
-
- {getDescriptions(
- apps.length ? apps.map(({ subtitle = '' }) => subtitle) : solution.appDescriptions
- )}
-
-
-
-
-
-);
+
+ {getDescriptions(
+ apps.length ? apps.map(({ subtitle = '' }) => subtitle) : solution.appDescriptions
+ )}
+
+
+
+
+
+ );
+};
diff --git a/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.tsx b/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.tsx
index 4a8a5276e0e7d..113992099aee1 100644
--- a/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.tsx
+++ b/src/plugins/kibana_react/public/overview_page/overview_page_footer/overview_page_footer.tsx
@@ -17,7 +17,7 @@
* under the License.
*/
-import React, { FC } from 'react';
+import React, { FC, MouseEvent } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
@@ -30,9 +30,18 @@ interface Props {
addBasePath: (path: string) => string;
/** The path to set as the new default route in advanced settings */
path: string;
+ /** Callback function to invoke when the user wants to set their default route to the current page */
+ onSetDefaultRoute?: (event: MouseEvent) => void;
+ /** Callback function to invoke when the user wants to change their default route button is changed */
+ onChangeDefaultRoute?: (event: MouseEvent) => void;
}
-export const OverviewPageFooter: FC = ({ addBasePath, path }) => {
+export const OverviewPageFooter: FC = ({
+ addBasePath,
+ path,
+ onSetDefaultRoute,
+ onChangeDefaultRoute,
+}) => {
const [defaultRoute, setDefaultRoute] = useUiSetting$('defaultRoute');
const {
services: {
@@ -44,43 +53,50 @@ export const OverviewPageFooter: FC = ({ addBasePath, path }) => {
const { show, save } = application.capabilities.advancedSettings;
const isAdvancedSettingsEnabled = show && save;
- const defaultRoutebutton =
- defaultRoute === path ? (
-
-
-
-
-
- ) : (
+ const defaultRoutebutton = defaultRoute.includes(path) ? (
+
{
- setDefaultRoute(path);
- toasts.addSuccess({
- title: i18n.translate('kibana-react.pageFooter.changeDefaultRouteSuccessToast', {
- defaultMessage: 'Landing page updated',
- }),
- });
- }}
size="xs"
+ onClick={(event: MouseEvent) => {
+ application.navigateToUrl(addBasePath('/app/management/kibana/settings#defaultRoute'));
+ if (onChangeDefaultRoute) {
+ onChangeDefaultRoute(event);
+ }
+ }}
>
- );
+
+ ) : (
+ {
+ setDefaultRoute(path);
+ toasts.addSuccess({
+ title: i18n.translate('kibana-react.pageFooter.changeDefaultRouteSuccessToast', {
+ defaultMessage: 'Landing page updated',
+ }),
+ });
+ if (onSetDefaultRoute) {
+ onSetDefaultRoute(event);
+ }
+ }}
+ size="xs"
+ >
+
+
+ );
return (