Skip to content

Commit

Permalink
[8.x] Preparation for High Contrast Mode, Core/SharedUX domains (#202606
Browse files Browse the repository at this point in the history
) (#203147)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Preparation for High Contrast Mode, Core/SharedUX domains
(#202606)](#202606)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Tim
Sullivan","email":"tsullivan@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-12-05T15:26:41Z","message":"Preparation
for High Contrast Mode, Core/SharedUX domains (#202606)\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//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**NOTE:** **EUI currently does not yet support the
high-contrast mode\r\nflag**, but support for that is expected to come
in around 2 weeks.\r\nThese first PRs are simply preparing the code by
wiring up the\r\n`UserProvideService`.\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.\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6178e8295dc35343ab1847416a6d40432a35e4a5","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","Team:SharedUX","backport:prev-minor"],"number":202606,"url":"https://github.com/elastic/kibana/pull/202606","mergeCommit":{"message":"Preparation
for High Contrast Mode, Core/SharedUX domains (#202606)\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//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**NOTE:** **EUI currently does not yet support the
high-contrast mode\r\nflag**, but support for that is expected to come
in around 2 weeks.\r\nThese first PRs are simply preparing the code by
wiring up the\r\n`UserProvideService`.\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.\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6178e8295dc35343ab1847416a6d40432a35e4a5"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202606","number":202606,"mergeCommit":{"message":"Preparation
for High Contrast Mode, Core/SharedUX domains (#202606)\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//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**NOTE:** **EUI currently does not yet support the
high-contrast mode\r\nflag**, but support for that is expected to come
in around 2 weeks.\r\nThese first PRs are simply preparing the code by
wiring up the\r\n`UserProvideService`.\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.\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6178e8295dc35343ab1847416a6d40432a35e4a5"}}]}]
BACKPORT-->
  • Loading branch information
tsullivan authored Dec 6, 2024
1 parent 619a64f commit d2a78a9
Show file tree
Hide file tree
Showing 95 changed files with 508 additions and 168 deletions.
2 changes: 2 additions & 0 deletions examples/developer_examples/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
AppMountParameters,
I18nStart,
ThemeServiceStart,
UserProfileService,
} from '@kbn/core/public';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { ExampleDefinition } from './types';
Expand All @@ -36,6 +37,7 @@ interface StartServices {
analytics: Pick<AnalyticsServiceStart, 'reportEvent'>;
i18n: I18nStart;
theme: Pick<ThemeServiceStart, 'theme$'>;
userProfile: UserProfileService;
}

interface Props {
Expand Down
4 changes: 2 additions & 2 deletions examples/developer_examples/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export class DeveloperExamplesPlugin implements Plugin<DeveloperExamplesSetup, v
async mount(params: AppMountParameters) {
const { renderApp } = await import('./app');
const [coreStart] = await core.getStartServices();
const { analytics, i18n, theme } = coreStart;
const { analytics, i18n, theme, userProfile } = coreStart;
return renderApp(
{
startServices: { analytics, i18n, theme },
startServices: { analytics, i18n, theme, userProfile },
examples,
navigateToApp: (appId: string) => coreStart.application.navigateToApp(appId),
getUrlForApp: (appId: string) => coreStart.application.getUrlForApp(appId),
Expand Down
6 changes: 4 additions & 2 deletions examples/routing_example/public/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
CoreStart,
I18nStart,
ThemeServiceStart,
UserProfileService,
} from '@kbn/core/public';
import type { IHttpFetchError } from '@kbn/core-http-browser';
import {
Expand All @@ -25,6 +26,7 @@ interface StartServices {
analytics: Pick<AnalyticsServiceStart, 'reportEvent'>;
i18n: I18nStart;
theme: Pick<ThemeServiceStart, 'theme$'>;
userProfile: UserProfileService;
}

export interface Services {
Expand All @@ -37,8 +39,8 @@ export interface Services {
}

export function getServices(core: CoreStart): Services {
const { analytics, i18n, theme } = core;
const startServices = { analytics, i18n, theme };
const { analytics, i18n, theme, userProfile } = core;
const startServices = { analytics, i18n, theme, userProfile };

return {
startServices,
Expand Down
2 changes: 1 addition & 1 deletion examples/ui_action_examples/public/hello_world_action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { toMountPoint } from '@kbn/react-kibana-mount';

export const ACTION_HELLO_WORLD = 'ACTION_HELLO_WORLD';

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

export const createHelloWorldActionDefinition = (
getStartServices: () => Promise<StartServices>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const DYNAMIC_ACTION_ID = `${ACTION_HELLO_WORLD}-Waldo`;

interface Props {
uiActionsStartService: UiActionsStart;
startServices: Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme'>;
startServices: Pick<CoreStart, 'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile'>;
}

export const HelloWorldExample = ({ uiActionsStartService, startServices }: Props) => {
Expand Down
1 change: 1 addition & 0 deletions packages/cloud/connection_details/kibana/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface ConnectionDetailsGlobalDependencies {
http: CoreStart['http'];
application: CoreStart['application'];
overlays: CoreStart['overlays'];
userProfile: CoreStart['userProfile'];
};
plugins: {
cloud?: CloudStart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface OpenConnectionDetailsParams {
i18n: CoreStart['i18n'];
analytics?: CoreStart['analytics'];
theme: CoreStart['theme'];
userProfile: CoreStart['userProfile'];
};
};
}
Expand Down
2 changes: 2 additions & 0 deletions packages/content-management/content_editor/src/services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type { I18nStart } from '@kbn/core-i18n-browser';
import type { MountPoint, OverlayRef } from '@kbn/core-mount-utils-browser';
import type { OverlayFlyoutOpenOptions } from '@kbn/core-overlays-browser';
import type { ThemeServiceStart } from '@kbn/core-theme-browser';
import type { UserProfileService } from '@kbn/core-user-profile-browser';
import { toMountPoint } from '@kbn/react-kibana-mount';

type NotifyFn = (title: JSX.Element, text?: string) => void;
Expand Down Expand Up @@ -68,6 +69,7 @@ interface ContentEditorStartServices {
analytics: Pick<AnalyticsServiceStart, 'reportEvent'>;
i18n: I18nStart;
theme: Pick<ThemeServiceStart, 'theme$'>;
userProfile: UserProfileService;
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/content-management/content_editor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@kbn/test-jest-helpers",
"@kbn/react-kibana-mount",
"@kbn/content-management-user-profiles",
"@kbn/core-user-profile-browser",
],
"exclude": [
"target/**/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type { I18nStart } from '@kbn/core-i18n-browser';
import type { MountPoint, OverlayRef } from '@kbn/core-mount-utils-browser';
import type { OverlayFlyoutOpenOptions } from '@kbn/core-overlays-browser';
import type { ThemeServiceStart } from '@kbn/core-theme-browser';
import type { UserProfileServiceStart } from '@kbn/core-user-profile-browser';
import type { UserProfileService, UserProfileServiceStart } from '@kbn/core-user-profile-browser';
import type { FormattedRelative } from '@kbn/i18n-react';
import { toMountPoint } from '@kbn/react-kibana-mount';
import { RedirectAppLinksKibanaProvider } from '@kbn/shared-ux-link-redirect-app';
Expand Down Expand Up @@ -100,6 +100,7 @@ interface TableListViewStartServices {
analytics: Pick<AnalyticsServiceStart, 'reportEvent'>;
i18n: I18nStart;
theme: Pick<ThemeServiceStart, 'theme$'>;
userProfile: UserProfileService;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/core/apps/core-apps-browser-internal/src/core_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type {
import type { AnalyticsServiceStart } from '@kbn/core-analytics-browser';
import type { I18nStart } from '@kbn/core-i18n-browser';
import type { ThemeServiceStart } from '@kbn/core-theme-browser';
import type { UserProfileService } from '@kbn/core-user-profile-browser';
import { renderApp as renderStatusApp } from './status';
import {
renderApp as renderErrorApp,
Expand All @@ -45,6 +46,7 @@ export interface CoreAppsServiceStartDeps {
analytics: AnalyticsServiceStart;
i18n: I18nStart;
theme: ThemeServiceStart;
userProfile: UserProfileService;
}

export class CoreAppsService {
Expand Down Expand Up @@ -86,9 +88,7 @@ export class CoreAppsService {
http,
notifications,
uiSettings,
analytics,
i18n,
theme,
...startDeps
}: CoreAppsServiceStartDeps) {
if (!application.history) {
return;
Expand All @@ -101,7 +101,7 @@ export class CoreAppsService {
uiSettings,
});

setupPublicBaseUrlConfigWarning({ docLinks, http, notifications, analytics, i18n, theme });
setupPublicBaseUrlConfigWarning({ docLinks, http, notifications, ...startDeps });
}

public stop() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { httpServiceMock } from '@kbn/core-http-browser-mocks';
import { i18nServiceMock } from '@kbn/core-i18n-browser-mocks';
import { notificationServiceMock } from '@kbn/core-notifications-browser-mocks';
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks';

import { setupPublicBaseUrlConfigWarning } from './public_base_url';

Expand All @@ -22,12 +23,8 @@ describe('publicBaseUrl warning', () => {
const i18nStart = i18nServiceMock.createStartContract();
const analytics = analyticsServiceMock.createAnalyticsServiceStart();
const theme = themeServiceMock.createStartContract();
const startServices = {
notifications,
analytics,
i18n: i18nStart,
theme,
};
const userProfile = userProfileServiceMock.createStart();
const startServices = { notifications, analytics, i18n: i18nStart, theme, userProfile };
const addWarningToastSpy = jest.spyOn(notifications.toasts, 'addWarning');

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type { DocLinksStart } from '@kbn/core-doc-links-browser';
import type { AnalyticsServiceStart } from '@kbn/core-analytics-browser';
import type { I18nStart } from '@kbn/core-i18n-browser';
import type { ThemeServiceStart } from '@kbn/core-theme-browser';
import type { UserProfileService } from '@kbn/core-user-profile-browser';
import type { InternalHttpStart } from '@kbn/core-http-browser-internal';
import type { NotificationsStart } from '@kbn/core-notifications-browser';
import { mountReactNode } from '@kbn/core-mount-utils-browser-internal';
Expand All @@ -35,6 +36,7 @@ interface Deps {
analytics: AnalyticsServiceStart;
i18n: I18nStart;
theme: ThemeServiceStart;
userProfile: UserProfileService;
}

export const setupPublicBaseUrlConfigWarning = ({
Expand Down
4 changes: 3 additions & 1 deletion packages/core/apps/core-apps-browser-internal/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
"@kbn/react-kibana-context-render",
"@kbn/core-analytics-browser-mocks",
"@kbn/core-i18n-browser-mocks",
"@kbn/core-theme-browser-mocks"
"@kbn/core-theme-browser-mocks",
"@kbn/core-user-profile-browser",
"@kbn/core-user-profile-browser-mocks"
],
"exclude": [
"target/**/*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { customBrandingServiceMock } from '@kbn/core-custom-branding-browser-moc
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
import { i18nServiceMock } from '@kbn/core-i18n-browser-mocks';
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks';
import { getAppInfo } from '@kbn/core-application-browser-internal';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { findTestSubject } from '@kbn/test-jest-helpers';
Expand Down Expand Up @@ -55,6 +56,7 @@ function defaultStartDeps(availableApps?: App[], currentAppId?: string) {
analytics: analyticsServiceMock.createAnalyticsServiceStart(),
i18n: i18nServiceMock.createStartContract(),
theme: themeServiceMock.createStartContract(),
userProfile: userProfileServiceMock.createStart(),
application: applicationServiceMock.createInternalStartContract(currentAppId),
docLinks: docLinksServiceMock.createStartContract(),
http: httpServiceMock.createStartContract(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@kbn/core-theme-browser-mocks",
"@kbn/react-kibana-context-render",
"@kbn/recently-accessed",
"@kbn/core-user-profile-browser-mocks",
],
"exclude": [
"target/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { i18n } from '@kbn/i18n';
import { Subscription } from 'rxjs';
import type { AnalyticsServiceStart, AnalyticsServiceSetup } from '@kbn/core-analytics-browser';
import type { ThemeServiceStart } from '@kbn/core-theme-browser';
import type { UserProfileService } from '@kbn/core-user-profile-browser';
import type { I18nStart } from '@kbn/core-i18n-browser';
import type { IUiSettingsClient } from '@kbn/core-ui-settings-browser';
import type { OverlayStart } from '@kbn/core-overlays-browser';
Expand All @@ -29,6 +30,7 @@ export interface StartDeps {
i18n: I18nStart;
overlays: OverlayStart;
theme: ThemeServiceStart;
userProfile: UserProfileService;
analytics: AnalyticsServiceStart;
targetDomElement: HTMLElement;
}
Expand Down Expand Up @@ -62,36 +64,26 @@ export class NotificationsService {
return notificationSetup;
}

public start({
analytics,
i18n: i18nDep,
overlays,
theme,
targetDomElement,
}: StartDeps): NotificationsStart {
public start({ overlays, targetDomElement, ...startDeps }: StartDeps): NotificationsStart {
this.targetDomElement = targetDomElement;
const toastsContainer = document.createElement('div');
targetDomElement.appendChild(toastsContainer);

const eventReporter = new EventReporter({ analytics });
const eventReporter = new EventReporter({ analytics: startDeps.analytics });

return {
toasts: this.toasts.start({
eventReporter,
i18n: i18nDep,
overlays,
analytics,
theme,
targetDomElement: toastsContainer,
...startDeps,
}),
showErrorDialog: ({ title, error }) =>
showErrorDialog({
title,
error,
openModal: overlays.openModal,
analytics,
i18n: i18nDep,
theme,
...startDeps,
}),
};
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { mountWithIntl } from '@kbn/test-jest-helpers';
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
import { ErrorToast } from './error_toast';
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks';
import { i18nServiceMock } from '@kbn/core-i18n-browser-mocks';

interface ErrorToastProps {
Expand All @@ -25,6 +26,7 @@ interface ErrorToastProps {
let openModal: jest.Mock;
const mockAnalytics = analyticsServiceMock.createAnalyticsServiceStart();
const mockTheme = themeServiceMock.createStartContract();
const mockUserProfile = userProfileServiceMock.createStart();
const mockI18n = i18nServiceMock.createStartContract();

beforeEach(() => (openModal = jest.fn()));
Expand All @@ -39,6 +41,7 @@ function render(props: ErrorToastProps = {}) {
analytics={mockAnalytics}
i18n={mockI18n}
theme={mockTheme}
userProfile={mockUserProfile}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ import type { AnalyticsServiceStart } from '@kbn/core-analytics-browser';
import type { I18nStart } from '@kbn/core-i18n-browser';
import type { OverlayStart } from '@kbn/core-overlays-browser';
import { ThemeServiceStart } from '@kbn/core-theme-browser';
import type { UserProfileService } from '@kbn/core-user-profile-browser';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';

interface StartServices {
analytics: AnalyticsServiceStart;
i18n: I18nStart;
userProfile: UserProfileService;
theme: ThemeServiceStart;
}

Expand Down Expand Up @@ -62,7 +64,10 @@ export function showErrorDialog({
error,
openModal,
...startServices
}: Pick<ErrorToastProps, 'error' | 'title' | 'openModal' | 'analytics' | 'i18n' | 'theme'>) {
}: Pick<
ErrorToastProps,
'error' | 'title' | 'openModal' | 'analytics' | 'i18n' | 'userProfile' | 'theme'
>) {
let text = '';

if (isRequestError(error)) {
Expand Down
Loading

0 comments on commit d2a78a9

Please sign in to comment.