diff --git a/x-pack/plugins/index_management/public/application/sections/home/template_list/template_list.tsx b/x-pack/plugins/index_management/public/application/sections/home/template_list/template_list.tsx
index 8c4828da5f04a..c29fbfde16f5d 100644
--- a/x-pack/plugins/index_management/public/application/sections/home/template_list/template_list.tsx
+++ b/x-pack/plugins/index_management/public/application/sections/home/template_list/template_list.tsx
@@ -30,11 +30,12 @@ import {
PageError,
attemptToURIDecode,
reactRouterNavigate,
+ useExecutionContext,
} from '../../../../shared_imports';
import { LegacyIndexTemplatesDeprecation } from '../../../components';
import { useLoadIndexTemplates } from '../../../services/api';
import { documentationService } from '../../../services/documentation';
-import { useServices } from '../../../app_context';
+import { useAppContext, useServices } from '../../../app_context';
import {
getTemplateEditLink,
getTemplateListLink,
@@ -68,8 +69,17 @@ export const TemplateList: React.FunctionComponent
{
const { uiMetricService } = useServices();
+ const {
+ core: { executionContext },
+ } = useAppContext();
+
const { error, isLoading, data: allTemplates, resendRequest: reload } = useLoadIndexTemplates();
+ useExecutionContext(executionContext, {
+ type: 'application',
+ page: 'indexManagementIndexTemplatesTab',
+ });
+
const [filters, setFilters] = useState>({
managed: {
name: i18n.translate('xpack.idxMgmt.indexTemplatesList.viewManagedTemplateLabel', {
diff --git a/x-pack/plugins/index_management/public/shared_imports.ts b/x-pack/plugins/index_management/public/shared_imports.ts
index c2d76a50fa1ac..210eb30cc82da 100644
--- a/x-pack/plugins/index_management/public/shared_imports.ts
+++ b/x-pack/plugins/index_management/public/shared_imports.ts
@@ -64,4 +64,5 @@ export {
reactRouterNavigate,
useKibana,
KibanaThemeProvider,
+ useExecutionContext,
} from '../../../../src/plugins/kibana_react/public';
diff --git a/x-pack/plugins/ingest_pipelines/public/application/app.tsx b/x-pack/plugins/ingest_pipelines/public/application/app.tsx
index 99624cbcf9967..19ad3b2e1dd75 100644
--- a/x-pack/plugins/ingest_pipelines/public/application/app.tsx
+++ b/x-pack/plugins/ingest_pipelines/public/application/app.tsx
@@ -10,7 +10,7 @@ import { EuiPageContent, EuiEmptyPrompt } from '@elastic/eui';
import React, { FunctionComponent } from 'react';
import { Router, Switch, Route } from 'react-router-dom';
-import { useKibana } from '../shared_imports';
+import { useKibana, useExecutionContext } from '../shared_imports';
import { APP_CLUSTER_REQUIRED_PRIVILEGES } from '../../common/constants';
@@ -44,7 +44,12 @@ export const AppWithoutRouter = () => (
export const App: FunctionComponent = () => {
const { apiError } = useAuthorizationContext();
- const { history } = useKibana().services;
+ const { history, executionContext } = useKibana().services;
+
+ useExecutionContext(executionContext!, {
+ type: 'application',
+ page: 'ingestPipelines',
+ });
if (apiError) {
return (
diff --git a/x-pack/plugins/ingest_pipelines/public/application/mount_management_section.ts b/x-pack/plugins/ingest_pipelines/public/application/mount_management_section.ts
index 81f7be35074d8..a032b3a66347b 100644
--- a/x-pack/plugins/ingest_pipelines/public/application/mount_management_section.ts
+++ b/x-pack/plugins/ingest_pipelines/public/application/mount_management_section.ts
@@ -28,6 +28,7 @@ export async function mountManagementSection(
docLinks,
application,
i18n: { Context: I18nContext },
+ executionContext,
} = coreStart;
documentationService.setup(docLinks);
@@ -45,6 +46,7 @@ export async function mountManagementSection(
share: depsStart.share,
fileUpload: depsStart.fileUpload,
application,
+ executionContext,
};
return renderApp(element, I18nContext, services, { http }, { theme$ });
diff --git a/x-pack/plugins/ingest_pipelines/public/shared_imports.ts b/x-pack/plugins/ingest_pipelines/public/shared_imports.ts
index 90ccf78355f1a..1fde3a1930ba9 100644
--- a/x-pack/plugins/ingest_pipelines/public/shared_imports.ts
+++ b/x-pack/plugins/ingest_pipelines/public/shared_imports.ts
@@ -90,6 +90,7 @@ export {
export {
KibanaContextProvider,
KibanaThemeProvider,
+ useExecutionContext,
} from '../../../../src/plugins/kibana_react/public';
export const useKibana = () => _useKibana();
diff --git a/x-pack/plugins/license_management/public/application/app.js b/x-pack/plugins/license_management/public/application/app.js
index b260c4ebfb7a8..f02725bbaf875 100644
--- a/x-pack/plugins/license_management/public/application/app.js
+++ b/x-pack/plugins/license_management/public/application/app.js
@@ -5,94 +5,101 @@
* 2.0.
*/
-import React, { Component } from 'react';
+import React, { useEffect } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { LicenseDashboard, UploadLicense } from './sections';
import { Switch, Route } from 'react-router-dom';
import { APP_PERMISSION } from '../../common/constants';
-import { SectionLoading } from '../shared_imports';
+import { SectionLoading, useExecutionContext } from '../shared_imports';
import { EuiPageContent, EuiPageBody, EuiEmptyPrompt } from '@elastic/eui';
-export class App extends Component {
- componentDidMount() {
- const { loadPermissions } = this.props;
- loadPermissions();
- }
-
- render() {
- const { hasPermission, permissionsLoading, permissionsError, telemetry } = this.props;
-
- if (permissionsLoading) {
- return (
-
-
-
-
-
- );
- }
+export const App = ({
+ hasPermission,
+ permissionsLoading,
+ permissionsError,
+ telemetry,
+ loadPermissions,
+ executionContext,
+}) => {
+ useExecutionContext(executionContext, {
+ type: 'application',
+ page: 'licenseManagement',
+ });
- if (permissionsError) {
- const error = permissionsError?.data?.message;
+ useEffect(() => {
+ loadPermissions();
+ }, [loadPermissions]);
- return (
-
-
-
-
- }
- body={error ? {error}
: null}
+ if (permissionsLoading) {
+ return (
+
+
+
-
- );
- }
+
+
+ );
+ }
- if (!hasPermission) {
- return (
-
-
-
-
- }
- body={
-
- {APP_PERMISSION},
- }}
- />
-
- }
- />
-
- );
- }
+ if (permissionsError) {
+ const error = permissionsError?.data?.message;
- const withTelemetry = (Component) => (props) => ;
return (
-
-
-
-
-
-
+
+
+
+
+ }
+ body={error ? {error}
: null}
+ />
+
);
}
-}
+
+ if (!hasPermission) {
+ return (
+
+
+
+
+ }
+ body={
+
+ {APP_PERMISSION},
+ }}
+ />
+
+ }
+ />
+
+ );
+ }
+
+ const withTelemetry = (Component) => (props) => ;
+ return (
+
+
+
+
+
+
+ );
+};
diff --git a/x-pack/plugins/license_management/public/application/index.tsx b/x-pack/plugins/license_management/public/application/index.tsx
index 16b6ebb1afdf9..dd70e15646fc7 100644
--- a/x-pack/plugins/license_management/public/application/index.tsx
+++ b/x-pack/plugins/license_management/public/application/index.tsx
@@ -26,6 +26,7 @@ export const renderApp = (element: Element, dependencies: AppDependencies) => {
,
element
diff --git a/x-pack/plugins/license_management/public/shared_imports.ts b/x-pack/plugins/license_management/public/shared_imports.ts
index 878655c82c557..ad4d91b1473f6 100644
--- a/x-pack/plugins/license_management/public/shared_imports.ts
+++ b/x-pack/plugins/license_management/public/shared_imports.ts
@@ -7,4 +7,7 @@
export { SectionLoading } from '../../../../src/plugins/es_ui_shared/public/';
-export { KibanaThemeProvider } from '../../../../src/plugins/kibana_react/public';
+export {
+ KibanaThemeProvider,
+ useExecutionContext,
+} from '../../../../src/plugins/kibana_react/public';
diff --git a/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/setup_environment.tsx b/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/setup_environment.tsx
index a150e2a92fcc9..31eec97c83ff7 100644
--- a/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/setup_environment.tsx
+++ b/x-pack/plugins/remote_clusters/__jest__/client_integration/helpers/setup_environment.tsx
@@ -11,6 +11,7 @@ import {
notificationServiceMock,
fatalErrorsServiceMock,
docLinksServiceMock,
+ executionContextServiceMock,
} from '../../../../../../src/core/public/mocks';
import { AppContextProvider } from '../../../public/application/app_context';
@@ -31,7 +32,12 @@ export const WithAppDependencies =
return (
diff --git a/x-pack/plugins/remote_clusters/public/application/app_context.tsx b/x-pack/plugins/remote_clusters/public/application/app_context.tsx
index 528ec322f49e1..5f3bae6133dfd 100644
--- a/x-pack/plugins/remote_clusters/public/application/app_context.tsx
+++ b/x-pack/plugins/remote_clusters/public/application/app_context.tsx
@@ -6,10 +6,12 @@
*/
import React, { createContext, useContext } from 'react';
+import { ExecutionContextStart } from 'kibana/public';
export interface Context {
isCloudEnabled: boolean;
cloudBaseUrl: string;
+ executionContext: ExecutionContextStart;
}
export const AppContext = createContext({} as any);
diff --git a/x-pack/plugins/remote_clusters/public/application/index.d.ts b/x-pack/plugins/remote_clusters/public/application/index.d.ts
index 588d18263df48..9f8f80d46a507 100644
--- a/x-pack/plugins/remote_clusters/public/application/index.d.ts
+++ b/x-pack/plugins/remote_clusters/public/application/index.d.ts
@@ -6,7 +6,7 @@
*/
import { Observable } from 'rxjs';
-import { ScopedHistory, CoreTheme } from 'kibana/public';
+import { ScopedHistory, CoreTheme, ExecutionContextStart } from 'kibana/public';
import { RegisterManagementAppArgs, I18nStart } from '../types';
export declare const renderApp: (
@@ -15,6 +15,7 @@ export declare const renderApp: (
appDependencies: {
isCloudEnabled: boolean;
cloudBaseUrl: string;
+ executionContext: ExecutionContextStart;
},
history: ScopedHistory,
theme$: Observable
diff --git a/x-pack/plugins/remote_clusters/public/application/index.js b/x-pack/plugins/remote_clusters/public/application/index.js
index 01a6e20222210..39313b616acde 100644
--- a/x-pack/plugins/remote_clusters/public/application/index.js
+++ b/x-pack/plugins/remote_clusters/public/application/index.js
@@ -9,20 +9,32 @@ import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { Provider } from 'react-redux';
-import { KibanaThemeProvider } from '../shared_imports';
+import { KibanaThemeProvider, useExecutionContext } from '../shared_imports';
import { App } from './app';
import { remoteClustersStore } from './store';
import { AppContextProvider } from './app_context';
import './_hacks.scss';
+const AppWithExecutionContext = ({ history, executionContext }) => {
+ useExecutionContext(executionContext, {
+ type: 'application',
+ page: 'remoteClusters',
+ });
+
+ return ;
+};
+
export const renderApp = (elem, I18nContext, appDependencies, history, theme$) => {
render(
-
+
diff --git a/x-pack/plugins/remote_clusters/public/plugin.ts b/x-pack/plugins/remote_clusters/public/plugin.ts
index c6de539d1e6ed..c3d00bb0b2f48 100644
--- a/x-pack/plugins/remote_clusters/public/plugin.ts
+++ b/x-pack/plugins/remote_clusters/public/plugin.ts
@@ -51,6 +51,7 @@ export class RemoteClustersUIPlugin
i18n: { Context: i18nContext },
docLinks,
fatalErrors,
+ executionContext,
} = core;
docTitle.change(PLUGIN.getI18nName());
@@ -69,7 +70,7 @@ export class RemoteClustersUIPlugin
const unmountAppCallback = await renderApp(
element,
i18nContext,
- { isCloudEnabled, cloudBaseUrl },
+ { isCloudEnabled, cloudBaseUrl, executionContext },
history,
theme$
);
diff --git a/x-pack/plugins/remote_clusters/public/shared_imports.ts b/x-pack/plugins/remote_clusters/public/shared_imports.ts
index 55d963e2a29b7..2cf69938d5464 100644
--- a/x-pack/plugins/remote_clusters/public/shared_imports.ts
+++ b/x-pack/plugins/remote_clusters/public/shared_imports.ts
@@ -11,4 +11,7 @@ export {
SectionLoading,
} from '../../../../src/plugins/es_ui_shared/public';
-export { KibanaThemeProvider } from '../../../../src/plugins/kibana_react/public';
+export {
+ KibanaThemeProvider,
+ useExecutionContext,
+} from '../../../../src/plugins/kibana_react/public';
diff --git a/x-pack/plugins/rollup/public/application.tsx b/x-pack/plugins/rollup/public/application.tsx
index 3bebe4597a08a..6e216f87ce6dc 100644
--- a/x-pack/plugins/rollup/public/application.tsx
+++ b/x-pack/plugins/rollup/public/application.tsx
@@ -9,8 +9,8 @@ import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { Provider } from 'react-redux';
-import { CoreSetup } from 'kibana/public';
-import { KibanaContextProvider, KibanaThemeProvider } from './shared_imports';
+import { CoreSetup, ExecutionContextStart } from 'kibana/public';
+import { KibanaContextProvider, KibanaThemeProvider, useExecutionContext } from './shared_imports';
// @ts-ignore
import { rollupJobsStore } from './crud_app/store';
// @ts-ignore
@@ -20,6 +20,21 @@ import './index.scss';
import { ManagementAppMountParams } from '../../../../src/plugins/management/public';
+const AppWithExecutionContext = ({
+ history,
+ executionContext,
+}: {
+ history: ManagementAppMountParams['history'];
+ executionContext: ExecutionContextStart;
+}) => {
+ useExecutionContext(executionContext, {
+ type: 'application',
+ page: 'rollup',
+ });
+
+ return ;
+};
+
/**
* This module will be loaded asynchronously to reduce the bundle size of your plugin's main bundle.
*/
@@ -40,7 +55,7 @@ export const renderApp = async (
-
+
diff --git a/x-pack/plugins/rollup/public/shared_imports.ts b/x-pack/plugins/rollup/public/shared_imports.ts
index cb100f2df26f7..83182f2e05fe7 100644
--- a/x-pack/plugins/rollup/public/shared_imports.ts
+++ b/x-pack/plugins/rollup/public/shared_imports.ts
@@ -15,4 +15,5 @@ export {
export {
KibanaContextProvider,
KibanaThemeProvider,
+ useExecutionContext,
} from '../../../../src/plugins/kibana_react/public';
diff --git a/x-pack/plugins/snapshot_restore/public/application/app.tsx b/x-pack/plugins/snapshot_restore/public/application/app.tsx
index f7056a673cfbb..d2de3dba3d25f 100644
--- a/x-pack/plugins/snapshot_restore/public/application/app.tsx
+++ b/x-pack/plugins/snapshot_restore/public/application/app.tsx
@@ -18,6 +18,7 @@ import {
PageError,
WithPrivileges,
NotAuthorizedSection,
+ useExecutionContext,
} from '../shared_imports';
import { PageLoading } from './components';
import { DEFAULT_SECTION, Section } from './constants';
@@ -29,11 +30,12 @@ import {
PolicyAdd,
PolicyEdit,
} from './sections';
-import { useConfig } from './app_context';
+import { useAppContext, useConfig } from './app_context';
export const App: React.FunctionComponent = () => {
const { slm_ui: slmUi } = useConfig();
const { apiError } = useAuthorizationContext();
+ const { core } = useAppContext();
const sections: Section[] = ['repositories', 'snapshots', 'restore_status'];
@@ -43,6 +45,11 @@ export const App: React.FunctionComponent = () => {
const sectionsRegex = sections.join('|');
+ useExecutionContext(core.executionContext, {
+ type: 'application',
+ page: 'snapshotRestore',
+ });
+
return apiError ? (
{
return linkToRepository(newRepositoryName);
@@ -67,6 +68,11 @@ export const RepositoryList: React.FunctionComponent {
} = useLoadRestores(currentInterval);
const { uiMetricService, history } = useServices();
+ const { core } = useAppContext();
// Track component loaded
useEffect(() => {
uiMetricService.trackUiMetric(UIM_RESTORE_LIST_LOAD);
}, [uiMetricService]);
+ useExecutionContext(core.executionContext, {
+ type: 'application',
+ page: 'snapshotRestoreRestoreTab',
+ });
+
let content: JSX.Element;
if (isInitialRequest) {
diff --git a/x-pack/plugins/snapshot_restore/public/application/sections/home/snapshot_list/snapshot_list.tsx b/x-pack/plugins/snapshot_restore/public/application/sections/home/snapshot_list/snapshot_list.tsx
index 0245f14addd42..bfc276410ebc6 100644
--- a/x-pack/plugins/snapshot_restore/public/application/sections/home/snapshot_list/snapshot_list.tsx
+++ b/x-pack/plugins/snapshot_restore/public/application/sections/home/snapshot_list/snapshot_list.tsx
@@ -11,11 +11,17 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { RouteComponentProps } from 'react-router-dom';
import { EuiCallOut, EuiLink, EuiSpacer } from '@elastic/eui';
-import { PageLoading, PageError, Error, reactRouterNavigate } from '../../../../shared_imports';
+import {
+ PageLoading,
+ PageError,
+ Error,
+ reactRouterNavigate,
+ useExecutionContext,
+} from '../../../../shared_imports';
import { BASE_PATH, UIM_SNAPSHOT_LIST_LOAD } from '../../../constants';
import { useLoadSnapshots } from '../../../services/http';
import { linkToRepositories } from '../../../services/navigation';
-import { useServices } from '../../../app_context';
+import { useAppContext, useServices } from '../../../app_context';
import { useDecodedParams, SnapshotListParams, DEFAULT_SNAPSHOT_LIST_PARAMS } from '../../../lib';
import { SnapshotDetails } from './snapshot_details';
@@ -52,6 +58,7 @@ export const SnapshotList: React.FunctionComponent {
history.push(`${BASE_PATH}/snapshots`);
@@ -74,6 +81,11 @@ export const SnapshotList: React.FunctionComponent {
if (search) {
diff --git a/x-pack/plugins/snapshot_restore/public/shared_imports.ts b/x-pack/plugins/snapshot_restore/public/shared_imports.ts
index 65c2bc7dc0f77..21792338caece 100644
--- a/x-pack/plugins/snapshot_restore/public/shared_imports.ts
+++ b/x-pack/plugins/snapshot_restore/public/shared_imports.ts
@@ -33,4 +33,5 @@ export { APP_WRAPPER_CLASS } from '../../../../src/core/public';
export {
reactRouterNavigate,
KibanaThemeProvider,
+ useExecutionContext,
} from '../../../../src/plugins/kibana_react/public';
diff --git a/x-pack/plugins/watcher/__jest__/client_integration/helpers/app_context.mock.tsx b/x-pack/plugins/watcher/__jest__/client_integration/helpers/app_context.mock.tsx
index 8176d3fcbbca2..586f4cf9648f7 100644
--- a/x-pack/plugins/watcher/__jest__/client_integration/helpers/app_context.mock.tsx
+++ b/x-pack/plugins/watcher/__jest__/client_integration/helpers/app_context.mock.tsx
@@ -16,6 +16,7 @@ import {
notificationServiceMock,
httpServiceMock,
scopedHistoryMock,
+ executionContextServiceMock,
} from '../../../../../../src/core/public/mocks';
import { AppContextProvider } from '../../../public/application/app_context';
import { AppDeps } from '../../../public/application/app';
@@ -51,6 +52,7 @@ export const mockContextValue: AppDeps = {
http: httpServiceMock.createSetupContract(),
history,
getUrlForApp: jest.fn(),
+ executionContext: executionContextServiceMock.createStartContract(),
};
export const withAppContext = (Component: ComponentType) => (props: any) => {
diff --git a/x-pack/plugins/watcher/public/application/app.tsx b/x-pack/plugins/watcher/public/application/app.tsx
index 2f8ca489a5787..7f93d5d8cf798 100644
--- a/x-pack/plugins/watcher/public/application/app.tsx
+++ b/x-pack/plugins/watcher/public/application/app.tsx
@@ -13,6 +13,7 @@ import {
ToastsSetup,
IUiSettingsClient,
ApplicationStart,
+ ExecutionContextStart,
} from 'kibana/public';
import { Router, Switch, Route, Redirect, withRouter, RouteComponentProps } from 'react-router-dom';
@@ -26,13 +27,14 @@ import {
ManagementAppMountParams,
} from '../../../../../src/plugins/management/public';
+import { ChartsPluginSetup } from '../../../../../src/plugins/charts/public';
import { LicenseStatus } from '../../common/types/license_status';
import { WatchStatus } from './sections/watch_status/components/watch_status';
import { WatchEdit } from './sections/watch_edit/components/watch_edit';
import { WatchList } from './sections/watch_list/components/watch_list';
import { registerRouter } from './lib/navigation';
import { AppContextProvider } from './app_context';
-import { ChartsPluginSetup } from '../../../../../src/plugins/charts/public';
+import { useExecutionContext } from './shared_imports';
const ShareRouter = withRouter(({ children, history }: RouteComponentProps & { children: any }) => {
registerRouter({ history });
@@ -50,6 +52,7 @@ export interface AppDeps {
setBreadcrumbs: Parameters[0]['setBreadcrumbs'];
history: ManagementAppMountParams['history'];
getUrlForApp: ApplicationStart['getUrlForApp'];
+ executionContext: ExecutionContextStart;
}
export const App = (deps: AppDeps) => {
@@ -60,6 +63,11 @@ export const App = (deps: AppDeps) => {
return () => s.unsubscribe();
}, [deps.licenseStatus$]);
+ useExecutionContext(deps.executionContext, {
+ type: 'application',
+ page: 'watcher',
+ });
+
if (!valid) {
return (
diff --git a/x-pack/plugins/watcher/public/application/shared_imports.ts b/x-pack/plugins/watcher/public/application/shared_imports.ts
index 0e11e0fdcf9be..4001b55bfdd2e 100644
--- a/x-pack/plugins/watcher/public/application/shared_imports.ts
+++ b/x-pack/plugins/watcher/public/application/shared_imports.ts
@@ -19,4 +19,7 @@ export {
EuiCodeEditor,
} from '../../../../../src/plugins/es_ui_shared/public';
-export { KibanaThemeProvider } from '../../../../../src/plugins/kibana_react/public';
+export {
+ KibanaThemeProvider,
+ useExecutionContext,
+} from '../../../../../src/plugins/kibana_react/public';
diff --git a/x-pack/plugins/watcher/public/plugin.ts b/x-pack/plugins/watcher/public/plugin.ts
index dcc9d9fd56fdc..2da4415010d6c 100644
--- a/x-pack/plugins/watcher/public/plugin.ts
+++ b/x-pack/plugins/watcher/public/plugin.ts
@@ -50,6 +50,7 @@ export class WatcherUIPlugin implements Plugin {
docLinks,
savedObjects,
application,
+ executionContext,
} = coreStart;
docTitle.change(pluginName);
@@ -74,6 +75,7 @@ export class WatcherUIPlugin implements Plugin {
history,
getUrlForApp: application.getUrlForApp,
theme$,
+ executionContext,
});
return () => {