Skip to content

Commit

Permalink
[8.x] Preparation for High Contrast Mode, Kibana-Management domains (e…
Browse files Browse the repository at this point in the history
…lastic#202607) (elastic#203304)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Preparation for High Contrast Mode, Kibana-Management domains
(elastic#202607)](elastic#202607)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Tim
Sullivan","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-06T17:09:23Z","message":"Preparation
for High Contrast Mode, Kibana-Management domains (elastic#202607)\n\n##
Summary\r\n\r\n**Reviewers: Please test the code paths affected by this
PR. See the\r\n\"Risks\" section below.**\r\n\r\nPart of work for
enabling \"high contrast mode\" in Kibana.
See\r\nhttps://github.com/elastic/issues/176219\r\n\r\n**Background:**\r\nKibana
will soon have a user profile setting to allow users to enable\r\n\"high
contrast mode.\" This setting will activate a flag
with\r\n`<EuiProvider>` that causes EUI components to render with
higher\r\ncontrast visual elements. Consumer plugins and packages need
to be\r\nupdated selected places where `<EuiProvider>` is wrapped, to
pass the\r\n`UserProfileService` service dependency from the CoreStart
contract.\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following
conditions. \r\n\r\nReviewers should verify this PR satisfies this list
as well.\r\n\r\n- [X] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [X] The PR
description includes the appropriate Release Notes section,\r\nand the
correct `release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Risks\r\n\r\nDoes this PR introduce any risks? For example, consider
risks like hard\r\nto test bugs, performance regression, potential of
data loss.\r\n\r\nDescribe the risk, its severity, and mitigation for
each identified\r\nrisk. Invite stakeholders and evaluate how to proceed
before merging.\r\n\r\n- [ ] [medium/high] The implementor of this
change did not manually test\r\nthe affected code paths and relied on
type-checking and functional tests\r\nto drive the changes. Code owners
for this PR need to manually test the\r\naffected code paths.\r\n- [ ]
[medium] The `UserProfileService` dependency comes from the\r\nCoreStart
contract. If acquiring the service causes synchronous code to\r\nbecome
asynchronous, check for race conditions or errors in rendering\r\nReact
components. Code owners for this PR need to manually test
the\r\naffected code
paths.","sha":"1fe184b165d3a8359b6c0089e0e16ccf73819ad6","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Kibana
Management","release_note:skip","v9.0.0","backport:prev-minor"],"title":"Preparation
for High Contrast Mode, Kibana-Management
domains","number":202607,"url":"https://github.com/elastic/kibana/pull/202607","mergeCommit":{"message":"Preparation
for High Contrast Mode, Kibana-Management domains (elastic#202607)\n\n##
Summary\r\n\r\n**Reviewers: Please test the code paths affected by this
PR. See the\r\n\"Risks\" section below.**\r\n\r\nPart of work for
enabling \"high contrast mode\" in Kibana.
See\r\nhttps://github.com/elastic/issues/176219\r\n\r\n**Background:**\r\nKibana
will soon have a user profile setting to allow users to enable\r\n\"high
contrast mode.\" This setting will activate a flag
with\r\n`<EuiProvider>` that causes EUI components to render with
higher\r\ncontrast visual elements. Consumer plugins and packages need
to be\r\nupdated selected places where `<EuiProvider>` is wrapped, to
pass the\r\n`UserProfileService` service dependency from the CoreStart
contract.\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following
conditions. \r\n\r\nReviewers should verify this PR satisfies this list
as well.\r\n\r\n- [X] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [X] The PR
description includes the appropriate Release Notes section,\r\nand the
correct `release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Risks\r\n\r\nDoes this PR introduce any risks? For example, consider
risks like hard\r\nto test bugs, performance regression, potential of
data loss.\r\n\r\nDescribe the risk, its severity, and mitigation for
each identified\r\nrisk. Invite stakeholders and evaluate how to proceed
before merging.\r\n\r\n- [ ] [medium/high] The implementor of this
change did not manually test\r\nthe affected code paths and relied on
type-checking and functional tests\r\nto drive the changes. Code owners
for this PR need to manually test the\r\naffected code paths.\r\n- [ ]
[medium] The `UserProfileService` dependency comes from the\r\nCoreStart
contract. If acquiring the service causes synchronous code to\r\nbecome
asynchronous, check for race conditions or errors in rendering\r\nReact
components. Code owners for this PR need to manually test
the\r\naffected code
paths.","sha":"1fe184b165d3a8359b6c0089e0e16ccf73819ad6"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202607","number":202607,"mergeCommit":{"message":"Preparation
for High Contrast Mode, Kibana-Management domains (elastic#202607)\n\n##
Summary\r\n\r\n**Reviewers: Please test the code paths affected by this
PR. See the\r\n\"Risks\" section below.**\r\n\r\nPart of work for
enabling \"high contrast mode\" in Kibana.
See\r\nhttps://github.com/elastic/issues/176219\r\n\r\n**Background:**\r\nKibana
will soon have a user profile setting to allow users to enable\r\n\"high
contrast mode.\" This setting will activate a flag
with\r\n`<EuiProvider>` that causes EUI components to render with
higher\r\ncontrast visual elements. Consumer plugins and packages need
to be\r\nupdated selected places where `<EuiProvider>` is wrapped, to
pass the\r\n`UserProfileService` service dependency from the CoreStart
contract.\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following
conditions. \r\n\r\nReviewers should verify this PR satisfies this list
as well.\r\n\r\n- [X] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [X] The PR
description includes the appropriate Release Notes section,\r\nand the
correct `release_note:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Risks\r\n\r\nDoes this PR introduce any risks? For example, consider
risks like hard\r\nto test bugs, performance regression, potential of
data loss.\r\n\r\nDescribe the risk, its severity, and mitigation for
each identified\r\nrisk. Invite stakeholders and evaluate how to proceed
before merging.\r\n\r\n- [ ] [medium/high] The implementor of this
change did not manually test\r\nthe affected code paths and relied on
type-checking and functional tests\r\nto drive the changes. Code owners
for this PR need to manually test the\r\naffected code paths.\r\n- [ ]
[medium] The `UserProfileService` dependency comes from the\r\nCoreStart
contract. If acquiring the service causes synchronous code to\r\nbecome
asynchronous, check for race conditions or errors in rendering\r\nReact
components. Code owners for this PR need to manually test
the\r\naffected code
paths.","sha":"1fe184b165d3a8359b6c0089e0e16ccf73819ad6"}}]}]
BACKPORT-->

Co-authored-by: Tim Sullivan <[email protected]>
  • Loading branch information
kibanamachine and tsullivan authored Dec 6, 2024
1 parent 32d0514 commit f560d2d
Show file tree
Hide file tree
Showing 29 changed files with 80 additions and 29 deletions.
2 changes: 2 additions & 0 deletions packages/kbn-management/settings/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const KibanaSettingsApplication = ({
i18n,
notifications,
settings,
userProfile,
theme,
history,
sectionRegistry,
Expand All @@ -36,6 +37,7 @@ export const KibanaSettingsApplication = ({
<SettingsApplicationKibanaProvider
{...{
settings,
userProfile,
theme,
i18n,
notifications,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React, { ReactChild } from 'react';
import { I18nProvider } from '@kbn/i18n-react';

import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root';
import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks';
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
import { I18nStart } from '@kbn/core-i18n-browser';
Expand All @@ -31,10 +32,12 @@ const createRootMock = () => {
Context: ({ children }) => <I18nProvider>{children}</I18nProvider>,
};
const theme = themeServiceMock.createStartContract();
const userProfile = userProfileServiceMock.createStart();
return {
analytics,
i18n,
theme,
userProfile,
};
};

Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-management/settings/application/services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const SettingsApplicationKibanaProvider: FC<
const {
docLinks,
notifications,
userProfile,
theme,
i18n,
settings,
Expand Down Expand Up @@ -194,7 +195,7 @@ export const SettingsApplicationKibanaProvider: FC<

return (
<SettingsApplicationContext.Provider value={services}>
<FormKibanaProvider {...{ docLinks, notifications, theme, i18n, settings }}>
<FormKibanaProvider {...{ docLinks, notifications, userProfile, theme, i18n, settings }}>
{children}
</FormKibanaProvider>
</SettingsApplicationContext.Provider>
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-management/settings/application/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
"@kbn/management-settings-section-registry",
"@kbn/core-notifications-browser",
"@kbn/core-chrome-browser",
"@kbn/core-user-profile-browser-mocks",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import { I18nProvider } from '@kbn/i18n-react';
import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root';
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks';
import { I18nStart } from '@kbn/core-i18n-browser';

import { FieldInputProvider } from '../services';
import { FieldInputServices } from '../types';

const createRootMock = () => {
const analytics = analyticsServiceMock.createAnalyticsServiceStart();
const userProfile = userProfileServiceMock.createStart();
const i18n: I18nStart = {
Context: ({ children }) => <I18nProvider>{children}</I18nProvider>,
};
Expand All @@ -28,6 +30,7 @@ const createRootMock = () => {
analytics,
i18n,
theme,
userProfile,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"@kbn/core-analytics-browser-mocks",
"@kbn/core-ui-settings-browser",
"@kbn/code-editor",
"@kbn/core-user-profile-browser-mocks",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React, { ReactChild } from 'react';
import { I18nProvider } from '@kbn/i18n-react';

import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root';
import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks';
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
import { I18nStart } from '@kbn/core-i18n-browser';
Expand All @@ -26,10 +27,12 @@ const createRootMock = () => {
Context: ({ children }) => <I18nProvider>{children}</I18nProvider>,
};
const theme = themeServiceMock.createStartContract();
const userProfile = userProfileServiceMock.createStart();
return {
analytics,
i18n,
theme,
userProfile,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"@kbn/core-theme-browser-mocks",
"@kbn/core-i18n-browser",
"@kbn/core-analytics-browser-mocks",
"@kbn/core-user-profile-browser-mocks",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React, { ReactChild } from 'react';
import { I18nProvider } from '@kbn/i18n-react';

import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root';
import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks';
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
import { I18nStart } from '@kbn/core-i18n-browser';
Expand All @@ -25,10 +26,12 @@ const createRootMock = () => {
Context: ({ children }) => <I18nProvider>{children}</I18nProvider>,
};
const theme = themeServiceMock.createStartContract();
const userProfile = userProfileServiceMock.createStart();
return {
analytics,
i18n,
theme,
userProfile,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@ import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { ToastInput } from '@kbn/core-notifications-browser';
import { I18nStart } from '@kbn/core-i18n-browser';
import { ThemeServiceStart } from '@kbn/core-theme-browser';
import type { UserProfileService } from '@kbn/core-user-profile-browser';

export const DATA_TEST_SUBJ_PAGE_RELOAD_BUTTON = 'pageReloadButton';

interface StartDeps {
theme: ThemeServiceStart;
i18n: I18nStart;
userProfile: UserProfileService;
}

/**
* Utility function for returning a {@link ToastInput} for displaying a prompt for reloading the page.
* @param theme The {@link ThemeServiceStart} contract.
* @param i18nStart The {@link I18nStart} contract.
* @returns A toast.
*/
export const reloadPageToast = (theme: ThemeServiceStart, i18nStart: I18nStart): ToastInput => {
export const reloadPageToast = (startDeps: StartDeps): ToastInput => {
return {
title: i18n.translate('management.settings.form.requiresPageReloadToastDescription', {
defaultMessage: 'One or more settings require you to reload the page to take effect.',
Expand All @@ -43,7 +50,7 @@ export const reloadPageToast = (theme: ThemeServiceStart, i18nStart: I18nStart):
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>,
{ i18n: i18nStart, theme }
startDeps
),
color: 'success',
toastLifeTimeMs: 15000,
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-management/settings/components/form/services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const FormKibanaProvider: FC<PropsWithChildren<FormKibanaDependencies>> =
children,
...deps
}) => {
const { settings, notifications, docLinks, theme, i18n } = deps;
const { settings, notifications, docLinks, ...startDeps } = deps;

const services: Services = {
saveChanges: (changes, scope: UiSettingsScope) => {
Expand All @@ -57,7 +57,7 @@ export const FormKibanaProvider: FC<PropsWithChildren<FormKibanaDependencies>> =
return Promise.all(arr);
},
showError: (message: string) => notifications.toasts.addDanger(message),
showReloadPagePrompt: () => notifications.toasts.add(reloadPageToast(theme, i18n)),
showReloadPagePrompt: () => notifications.toasts.add(reloadPageToast(startDeps)),
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@
"@kbn/management-settings-utilities",
"@kbn/core-analytics-browser-mocks",
"@kbn/core-ui-settings-common",
"@kbn/core-user-profile-browser-mocks",
"@kbn/core-user-profile-browser",
]
}
2 changes: 2 additions & 0 deletions packages/kbn-management/settings/components/form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { I18nStart } from '@kbn/core-i18n-browser';
import { ThemeServiceStart } from '@kbn/core-theme-browser';
import { ToastsStart } from '@kbn/core-notifications-browser';
import { UiSettingsScope } from '@kbn/core-ui-settings-common';
import { UserProfileService } from '@kbn/core-user-profile-browser';

/**
* Contextual services used by a {@link Form} component.
Expand All @@ -42,6 +43,7 @@ interface KibanaDependencies {
globalClient: Pick<IUiSettingsClient, 'set'>;
};
theme: ThemeServiceStart;
userProfile: UserProfileService;
i18n: I18nStart;
/** The portion of the {@link ToastsStart} contract used by this component. */
notifications: {
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/console/public/types/plugin_dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
*/

import type { FC } from 'react';
import type { AnalyticsServiceStart, I18nStart, ThemeServiceStart } from '@kbn/core/public';
import type {
AnalyticsServiceStart,
I18nStart,
ThemeServiceStart,
UserProfileService,
} from '@kbn/core/public';
import { HomePublicPluginSetup, HomePublicPluginStart } from '@kbn/home-plugin/public';
import { DevToolsSetup } from '@kbn/dev-tools-plugin/public';
import { UsageCollectionSetup, UsageCollectionStart } from '@kbn/usage-collection-plugin/public';
Expand All @@ -21,6 +26,7 @@ export interface ConsoleStartServices {
analytics: Pick<AnalyticsServiceStart, 'reportEvent'>;
i18n: I18nStart;
theme: Pick<ThemeServiceStart, 'theme$'>;
userProfile: UserProfileService;
}

export interface AppSetupUIPluginDependencies {
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/dev_tools/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export class DevToolsPlugin implements Plugin<DevToolsSetup, void> {

const [core] = await getStartServices();
const { application, chrome, executionContext } = core;
const { analytics, i18n: i18nStart, theme } = core;
const startServices = { analytics, i18n: i18nStart, theme };
const { analytics, i18n: i18nStart, theme, userProfile } = core;
const startServices = { analytics, i18n: i18nStart, theme, userProfile };

this.docTitleService.setup(chrome.docTitle.change);
this.breadcrumbService.setup(chrome.setBreadcrumbs);
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/dev_tools/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { AnalyticsServiceStart, I18nStart, ThemeServiceStart } from '@kbn/core/public';
import {
AnalyticsServiceStart,
I18nStart,
ThemeServiceStart,
UserProfileService,
} from '@kbn/core/public';

export interface ConfigSchema {
deeplinks: {
Expand All @@ -19,4 +24,5 @@ export interface DevToolsStartServices {
analytics: Pick<AnalyticsServiceStart, 'reportEvent'>;
i18n: I18nStart;
theme: Pick<ThemeServiceStart, 'theme$'>;
userProfile: UserProfileService;
}
2 changes: 1 addition & 1 deletion src/plugins/guided_onboarding/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class GuidedOnboardingPlugin
application,
notifications,
}: {
startServices: Pick<CoreStart, 'analytics' | 'i18n' | 'theme'>;
startServices: Pick<CoreStart, 'analytics' | 'i18n' | 'theme' | 'userProfile'>;
targetDomElement: HTMLElement;
api: ApiService;
application: ApplicationStart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const ManagementApp = ({ dependencies, history, appBasePath }: Management
};

return (
<KibanaRenderContextProvider i18n={coreStart.i18n} theme={coreStart.theme}>
<KibanaRenderContextProvider {...coreStart}>
<RedirectAppLinks coreStart={dependencies.coreStart}>
<AppContextProvider value={contextDependencies}>
<KibanaPageTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { init as initDocumentation } from './services/documentation_links';
import { App } from './app';
import { ccrStore } from './store';

type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme'>;
type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme' | 'userProfile'>;

const AppWithExecutionContext = ({
history,
Expand Down
5 changes: 4 additions & 1 deletion x-pack/plugins/index_management/public/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ export const IndexManagementAppContext: React.FC<IndexManagementAppContextProps>
analytics,
i18n,
theme,
userProfile,
} = core;
const startServices = { analytics, i18n, overlays, theme };
const startServices = { analytics, i18n, overlays, theme, userProfile };
const { services, setBreadcrumbs, uiSettings, settings, kibanaVersion } = dependencies;

// theme is required by the CodeEditor component used to edit runtime field Painless scripts.
Expand All @@ -61,6 +62,7 @@ export const IndexManagementAppContext: React.FC<IndexManagementAppContextProps>
get: () => kibanaVersion,
},
theme,
userProfile,
});

const componentTemplateProviderValues = {
Expand Down Expand Up @@ -122,6 +124,7 @@ interface KibanaReactContextServices {
get: () => SemVer;
};
theme: CoreStart['theme'];
userProfile: CoreStart['userProfile'];
}

// We override useKibana() from the react plugin to return a typed version for this app
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/index_management/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
I18nStart,
OverlayStart,
ThemeServiceStart,
UserProfileService,
} from '@kbn/core/public';
import { CloudSetup } from '@kbn/cloud-plugin/public';
import { ConsolePluginStart } from '@kbn/console-plugin/public';
Expand All @@ -24,6 +25,7 @@ export interface IndexManagementStartServices {
i18n: I18nStart;
overlays: OverlayStart;
theme: Pick<ThemeServiceStart, 'theme$'>;
userProfile: UserProfileService;
}

export interface SetupDependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export interface AppServices {
config: Config;
}

type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme'>;
type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme' | 'userProfile'>;

export interface CoreServices extends StartServices {
http: HttpSetup;
Expand Down
11 changes: 1 addition & 10 deletions x-pack/plugins/painless_lab/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,7 @@ export class PainlessLabUIPlugin implements Plugin<void, void, PluginDependencie
mount: async ({ element }) => {
const [core] = await getStartServices();

const {
notifications,
docLinks,
chrome,
settings,
analytics,
i18n: i18nStart,
theme,
} = core;
const startServices = { analytics, i18n: i18nStart, theme };
const { notifications, docLinks, chrome, settings, ...startServices } = core;

const license = await firstValueFrom(licensing.license$);
const licenseStatus = checkLicenseStatus(license);
Expand Down
8 changes: 7 additions & 1 deletion x-pack/plugins/painless_lab/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
import { HomePublicPluginSetup } from '@kbn/home-plugin/public';
import { DevToolsSetup } from '@kbn/dev-tools-plugin/public';
import { LicensingPluginSetup } from '@kbn/licensing-plugin/public';
import { AnalyticsServiceStart, I18nStart, ThemeServiceStart } from '@kbn/core/public';
import {
AnalyticsServiceStart,
I18nStart,
ThemeServiceStart,
UserProfileService,
} from '@kbn/core/public';

export interface PluginDependencies {
licensing: LicensingPluginSetup;
Expand All @@ -20,4 +25,5 @@ export interface PainlessLabStartServices {
analytics: Pick<AnalyticsServiceStart, 'reportEvent'>;
i18n: I18nStart;
theme: Pick<ThemeServiceStart, 'theme$'>;
userProfile: UserProfileService;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export declare const renderApp: (
canUseAPIKeyTrustModel: boolean;
},
history: ScopedHistory,
startServices: Pick<CoreStart, 'analytics' | 'i18n' | 'theme'>
startServices: Pick<CoreStart, 'analytics' | 'i18n' | 'theme' | 'userProfile'>
) => ReturnType<RegisterManagementAppArgs['mount']>;
Loading

0 comments on commit f560d2d

Please sign in to comment.