From 598d3defd15442766ce1eec5b717f479ea62b5df Mon Sep 17 00:00:00 2001 From: Tim Sullivan Date: Mon, 9 Dec 2024 13:03:23 -0700 Subject: [PATCH] Preparation for High Contrast Mode, Security domains (#202609) ## Summary **Reviewers: Please test the code paths affected by this PR. See the "Risks" section below.** Part of work for enabling "high contrast mode" in Kibana. See https://github.com/elastic/kibana/issues/176219. **Background:** Kibana will soon have a user profile setting to allow users to enable "high contrast mode." This setting will activate a flag with `` that causes EUI components to render with higher contrast visual elements. Consumer plugins and packages need to be updated selected places where `` is wrapped, to pass the `UserProfileService` service dependency from the CoreStart contract. **NOTE:** **EUI currently does not yet support the high-contrast mode flag**, but support for that is expected to come in around 2 weeks. These first PRs are simply preparing the code by wiring up the `UserProvideService`. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [X] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [X] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [medium/high] The implementor of this change did not manually test the affected code paths and relied on type-checking and functional tests to drive the changes. Code owners for this PR need to manually test the affected code paths. - [ ] [medium] The `UserProfileService` dependency comes from the CoreStart contract. If acquiring the service causes synchronous code to become asynchronous, check for race conditions or errors in rendering React components. Code owners for this PR need to manually test the affected code paths. --- packages/kbn-mock-idp-plugin/public/plugin.tsx | 4 ++-- .../kbn-mock-idp-plugin/public/reload_page_toast.tsx | 4 +++- packages/kbn-mock-idp-plugin/public/role_switcher.tsx | 1 + packages/kbn-mock-idp-plugin/tsconfig.json | 1 + packages/kbn-user-profile-components/src/services.tsx | 6 ++++-- packages/kbn-user-profile-components/tsconfig.json | 1 + x-pack/plugins/security/public/index.ts | 2 +- .../management/roles/edit_role/edit_role_page.test.tsx | 4 ++++ .../management/roles/roles_grid/roles_grid_page.test.tsx | 9 ++++++++- .../management/roles/roles_grid/roles_grid_page.tsx | 8 ++------ .../components/insecure_cluster_alert.tsx | 2 ++ .../public/security_checkup/security_checkup_service.tsx | 2 ++ x-pack/plugins/security/tsconfig.json | 1 + .../edit_space/edit_space_content_tab.test.tsx | 3 +++ .../edit_space/edit_space_general_tab.test.tsx | 3 +++ .../management/edit_space/edit_space_roles_tab.test.tsx | 3 +++ .../management/edit_space/edit_space_roles_tab.tsx | 4 +++- .../edit_space/provider/edit_space_provider.test.tsx | 3 +++ .../edit_space/provider/edit_space_provider.tsx | 5 ++++- .../component/space_assign_role_privilege_form.test.tsx | 3 +++ .../public/management/spaces_management_app.test.tsx | 2 +- .../spaces/public/management/spaces_management_app.tsx | 5 +++-- .../spaces/public/space_selector/space_selector.tsx | 2 +- x-pack/plugins/spaces/tsconfig.json | 3 ++- 24 files changed, 61 insertions(+), 20 deletions(-) diff --git a/packages/kbn-mock-idp-plugin/public/plugin.tsx b/packages/kbn-mock-idp-plugin/public/plugin.tsx index c1f733027f656..d27a9d0bc8ad5 100644 --- a/packages/kbn-mock-idp-plugin/public/plugin.tsx +++ b/packages/kbn-mock-idp-plugin/public/plugin.tsx @@ -49,7 +49,7 @@ export const plugin: PluginInitializer< ]); ReactDOM.render( - + @@ -69,7 +69,7 @@ export const plugin: PluginInitializer< order: 4000 + 1, // Make sure it comes after the user menu mount: (element: HTMLElement) => { ReactDOM.render( - + diff --git a/packages/kbn-mock-idp-plugin/public/reload_page_toast.tsx b/packages/kbn-mock-idp-plugin/public/reload_page_toast.tsx index c3f93f3269da1..e254e21d47cde 100644 --- a/packages/kbn-mock-idp-plugin/public/reload_page_toast.tsx +++ b/packages/kbn-mock-idp-plugin/public/reload_page_toast.tsx @@ -13,6 +13,7 @@ import React from 'react'; import type { I18nStart } from '@kbn/core-i18n-browser'; import type { ToastInput } from '@kbn/core-notifications-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'; import type { AuthenticatedUser } from '@kbn/security-plugin-types-common'; @@ -26,6 +27,7 @@ export const DATA_TEST_SUBJ_PAGE_RELOAD_BUTTON = 'pageReloadButton'; */ export const createReloadPageToast = (options: { user: Pick; + userProfile: UserProfileService; theme: ThemeServiceStart; i18n: I18nStart; }): ToastInput => { @@ -43,7 +45,7 @@ export const createReloadPageToast = (options: { , - { i18n: options.i18n, theme: options.theme } + options ), color: 'success', toastLifeTimeMs: 0x7fffffff, // Do not auto-hide toast since page is in an unknown state diff --git a/packages/kbn-mock-idp-plugin/public/role_switcher.tsx b/packages/kbn-mock-idp-plugin/public/role_switcher.tsx index 347293abbc6c7..7a3845b0cc54a 100644 --- a/packages/kbn-mock-idp-plugin/public/role_switcher.tsx +++ b/packages/kbn-mock-idp-plugin/public/role_switcher.tsx @@ -69,6 +69,7 @@ export const RoleSwitcher = () => { services.notifications.toasts.add( createReloadPageToast({ user: authenticateUserState.value, + userProfile: services.userProfile, theme: services.theme, i18n: services.i18n, }) diff --git a/packages/kbn-mock-idp-plugin/tsconfig.json b/packages/kbn-mock-idp-plugin/tsconfig.json index 83c4023733404..d8b5fad09fb06 100644 --- a/packages/kbn-mock-idp-plugin/tsconfig.json +++ b/packages/kbn-mock-idp-plugin/tsconfig.json @@ -26,5 +26,6 @@ "@kbn/mock-idp-utils", "@kbn/cloud-plugin", "@kbn/es", + "@kbn/core-user-profile-browser", ] } diff --git a/packages/kbn-user-profile-components/src/services.tsx b/packages/kbn-user-profile-components/src/services.tsx index 7cf7a2d66c82f..f59caee26a034 100644 --- a/packages/kbn-user-profile-components/src/services.tsx +++ b/packages/kbn-user-profile-components/src/services.tsx @@ -13,6 +13,7 @@ import React, { useContext } from 'react'; import type { I18nStart } from '@kbn/core-i18n-browser'; import type { NotificationsStart, ToastOptions } from '@kbn/core-notifications-browser'; import type { ThemeServiceStart } from '@kbn/core-theme-browser'; +import type { UserProfileService } from '@kbn/core-user-profile-browser'; import type { toMountPoint } from '@kbn/react-kibana-mount'; import type { UserProfileAPIClient } from './types'; @@ -47,6 +48,7 @@ export interface UserProfilesKibanaDependencies { core: { notifications: NotificationsStart; theme: ThemeServiceStart; + userProfile: UserProfileService; i18n: I18nStart; }; security: { @@ -70,7 +72,7 @@ export const UserProfilesKibanaProvider: FC { const { - core: { notifications, i18n, theme }, + core: { notifications, ...startServices }, security: { userProfiles: userProfileApiClient }, toMountPoint: toMountPointUtility, } = services; @@ -86,7 +88,7 @@ export const UserProfilesKibanaProvider: FC = (initializerContext: PluginInitializerContext) => new SecurityPlugin(initializerContext); // services needed for rendering React using shared modules -export type StartServices = Pick; +export type StartServices = Pick; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx index 9a9abab064fa8..166b1de7cf057 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx @@ -15,6 +15,7 @@ import { coreMock, scopedHistoryMock } from '@kbn/core/public/mocks'; 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 { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { KibanaFeature } from '@kbn/features-plugin/public'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; @@ -196,6 +197,8 @@ function getProps({ const analyticsMock = analyticsServiceMock.createAnalyticsServiceStart(); const i18nMock = i18nServiceMock.createStartContract(); const themeMock = themeServiceMock.createStartContract(); + const userProfileMock = userProfileServiceMock.createStart(); + return { action, roleName: role?.name, @@ -214,6 +217,7 @@ function getProps({ history: scopedHistoryMock.create(), spacesApiUi, buildFlavor, + userProfile: userProfileMock, theme: themeMock, i18n: i18nMock, analytics: analyticsMock, diff --git a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx index 57281f5ec754c..1c965551a63dc 100644 --- a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.test.tsx @@ -44,7 +44,7 @@ const waitForRender = async ( describe('', () => { let apiClientMock: jest.Mocked>; let history: ReturnType; - const { theme, i18n, analytics, notifications } = coreMock.createStart(); + const { userProfile, theme, i18n, analytics, notifications } = coreMock.createStart(); beforeEach(() => { history = scopedHistoryMock.create(); @@ -93,6 +93,7 @@ describe('', () => { buildFlavor={'traditional'} analytics={analytics} theme={theme} + userProfile={userProfile} /> ); const initialIconCount = wrapper.find(EuiIcon).length; @@ -115,6 +116,7 @@ describe('', () => { buildFlavor={'traditional'} analytics={analytics} theme={theme} + userProfile={userProfile} /> ); const initialIconCount = wrapper.find(EuiIcon).length; @@ -139,6 +141,7 @@ describe('', () => { buildFlavor={'traditional'} analytics={analytics} theme={theme} + userProfile={userProfile} /> ); await waitForRender(wrapper, (updatedWrapper) => { @@ -157,6 +160,7 @@ describe('', () => { buildFlavor={'traditional'} analytics={analytics} theme={theme} + userProfile={userProfile} /> ); const initialIconCount = wrapper.find(EuiIcon).length; @@ -201,6 +205,7 @@ describe('', () => { buildFlavor={'traditional'} analytics={analytics} theme={theme} + userProfile={userProfile} /> ); const initialIconCount = wrapper.find(EuiIcon).length; @@ -332,6 +337,7 @@ describe('', () => { buildFlavor={'traditional'} analytics={analytics} theme={theme} + userProfile={userProfile} /> ); const initialIconCount = wrapper.find(EuiIcon).length; @@ -441,6 +447,7 @@ describe('', () => { buildFlavor={'traditional'} analytics={analytics} theme={theme} + userProfile={userProfile} readOnly /> ); diff --git a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.tsx b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.tsx index 457b9053a0ac8..cfea3a7f29804 100644 --- a/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.tsx +++ b/x-pack/plugins/security/public/management/roles/roles_grid/roles_grid_page.tsx @@ -75,9 +75,7 @@ export const RolesGridPage: FC = ({ readOnly, buildFlavor, cloudOrgUrl, - analytics, - theme, - i18n: i18nStart, + ...startServices }) => { const [roles, setRoles] = useState([]); const [visibleRoles, setVisibleRoles] = useState([]); @@ -409,9 +407,7 @@ export const RolesGridPage: FC = ({ notifications={notifications} rolesAPIClient={rolesAPIClient} buildFlavor={buildFlavor} - theme={theme} - analytics={analytics} - i18n={i18nStart} + {...startServices} /> ) : null} diff --git a/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx b/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx index 71e1a53e7d2fb..37b58eecc4d9e 100644 --- a/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx +++ b/x-pack/plugins/security/public/security_checkup/components/insecure_cluster_alert.tsx @@ -22,6 +22,7 @@ import type { I18nStart, MountPoint, ThemeServiceStart, + UserProfileService, } from '@kbn/core/public'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; @@ -37,6 +38,7 @@ interface Deps { analytics: Pick; i18n: I18nStart; theme: Pick; + userProfile: UserProfileService; } export const insecureClusterAlertText = (deps: Deps, onDismiss: (persist: boolean) => void) => diff --git a/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx b/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx index 4818e3721818a..295aef39f02e4 100644 --- a/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx +++ b/x-pack/plugins/security/public/security_checkup/security_checkup_service.tsx @@ -16,6 +16,7 @@ import type { NotificationsStart, ThemeServiceStart, Toast, + UserProfileService, } from '@kbn/core/public'; import { insecureClusterAlertText, insecureClusterAlertTitle } from './components'; @@ -33,6 +34,7 @@ interface StartDeps { analytics: Pick; i18n: I18nStart; theme: Pick; + userProfile: UserProfileService; } const DEFAULT_SECURITY_CHECKUP_STATE = Object.freeze({ diff --git a/x-pack/plugins/security/tsconfig.json b/x-pack/plugins/security/tsconfig.json index bfbf5df127597..518af73f96877 100644 --- a/x-pack/plugins/security/tsconfig.json +++ b/x-pack/plugins/security/tsconfig.json @@ -91,6 +91,7 @@ "@kbn/core-capabilities-server", "@kbn/core-elasticsearch-server", "@kbn/core-http-server-utils", + "@kbn/core-user-profile-browser-mocks", ], "exclude": [ "target/**/*", diff --git a/x-pack/plugins/spaces/public/management/edit_space/edit_space_content_tab.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/edit_space_content_tab.test.tsx index 6f668b79756c8..5946706874c4a 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/edit_space_content_tab.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/edit_space_content_tab.test.tsx @@ -16,6 +16,7 @@ import { overlayServiceMock, themeServiceMock, } from '@kbn/core/public/mocks'; +import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks'; import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; import { EditSpaceContentTab } from './edit_space_content_tab'; @@ -37,6 +38,7 @@ const http = httpServiceMock.createStartContract(); const notifications = notificationServiceMock.createStartContract(); const overlays = overlayServiceMock.createStartContract(); const theme = themeServiceMock.createStartContract(); +const userProfile = userProfileServiceMock.createStart(); const i18n = i18nServiceMock.createStartContract(); const logger = loggingSystemMock.createLogger(); @@ -62,6 +64,7 @@ const TestComponent: React.FC = ({ children }) => { getPrivilegesAPIClient={getPrivilegeAPIClient} getSecurityLicense={getSecurityLicenseMock} theme={theme} + userProfile={userProfile} i18n={i18n} logger={logger} > diff --git a/x-pack/plugins/spaces/public/management/edit_space/edit_space_general_tab.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/edit_space_general_tab.test.tsx index 2344b92832db6..353c64b835c0e 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/edit_space_general_tab.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/edit_space_general_tab.test.tsx @@ -19,6 +19,7 @@ import { themeServiceMock, } from '@kbn/core/public/mocks'; import { DEFAULT_APP_CATEGORIES } from '@kbn/core-application-common'; +import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks'; import { KibanaFeature } from '@kbn/features-plugin/common'; import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; @@ -43,6 +44,7 @@ const reloadWindow = jest.fn(); const http = httpServiceMock.createStartContract(); const notifications = notificationServiceMock.createStartContract(); const overlays = overlayServiceMock.createStartContract(); +const userProfile = userProfileServiceMock.createStart(); const theme = themeServiceMock.createStartContract(); const i18n = i18nServiceMock.createStartContract(); const logger = loggingSystemMock.createLogger(); @@ -83,6 +85,7 @@ describe('EditSpaceSettings', () => { getIsRoleManagementEnabled={() => Promise.resolve(() => undefined)} getPrivilegesAPIClient={getPrivilegeAPIClient} getSecurityLicense={getSecurityLicenseMock} + userProfile={userProfile} theme={theme} i18n={i18n} logger={logger} diff --git a/x-pack/plugins/spaces/public/management/edit_space/edit_space_roles_tab.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/edit_space_roles_tab.test.tsx index 542af2222c3f1..02a754e9d93f0 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/edit_space_roles_tab.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/edit_space_roles_tab.test.tsx @@ -16,6 +16,7 @@ import { overlayServiceMock, themeServiceMock, } from '@kbn/core/public/mocks'; +import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks'; import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; import { EditSpaceAssignedRolesTab } from './edit_space_roles_tab'; @@ -34,6 +35,7 @@ const getPrivilegeAPIClient = getPrivilegeAPIClientMock; const http = httpServiceMock.createStartContract(); const notifications = notificationServiceMock.createStartContract(); const overlays = overlayServiceMock.createStartContract(); +const userProfile = userProfileServiceMock.createStart(); const theme = themeServiceMock.createStartContract(); const i18n = i18nServiceMock.createStartContract(); const logger = loggingSystemMock.createLogger(); @@ -77,6 +79,7 @@ describe('EditSpaceAssignedRolesTab', () => { getIsRoleManagementEnabled={getIsRoleManagementEnabled} getPrivilegesAPIClient={getPrivilegeAPIClient} getSecurityLicense={getSecurityLicenseMock} + userProfile={userProfile} theme={theme} i18n={i18n} logger={logger} diff --git a/x-pack/plugins/spaces/public/management/edit_space/edit_space_roles_tab.tsx b/x-pack/plugins/spaces/public/management/edit_space/edit_space_roles_tab.tsx index 18e11110d7564..34ebbf1989bbc 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/edit_space_roles_tab.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/edit_space_roles_tab.tsx @@ -33,6 +33,7 @@ export const EditSpaceAssignedRolesTab: FC = ({ space, features, isReadOn const { getUrlForApp, overlays, + userProfile, theme, i18n: i18nStart, logger, @@ -99,7 +100,7 @@ export const EditSpaceAssignedRolesTab: FC = ({ space, features, isReadOn }} /> , - { theme, i18n: i18nStart } + { theme, i18n: i18nStart, userProfile } ), { size: 'm', @@ -117,6 +118,7 @@ export const EditSpaceAssignedRolesTab: FC = ({ space, features, isReadOn features, invokeClient, getUrlForApp, + userProfile, theme, i18nStart, notifications.toasts, diff --git a/x-pack/plugins/spaces/public/management/edit_space/provider/edit_space_provider.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/provider/edit_space_provider.test.tsx index 4da9806b0dee0..df2135e256970 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/provider/edit_space_provider.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/provider/edit_space_provider.test.tsx @@ -18,6 +18,7 @@ import { themeServiceMock, } from '@kbn/core/public/mocks'; import type { ApplicationStart } from '@kbn/core-application-browser'; +import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks'; import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; import { @@ -33,6 +34,7 @@ import { getSecurityLicenseMock } from '../../security_license.mock'; const http = httpServiceMock.createStartContract(); const notifications = notificationServiceMock.createStartContract(); const overlays = overlayServiceMock.createStartContract(); +const userProfile = userProfileServiceMock.createStart(); const theme = themeServiceMock.createStartContract(); const i18n = i18nServiceMock.createStartContract(); const logger = loggingSystemMock.createLogger(); @@ -55,6 +57,7 @@ const SUTProvider = ({ logger, i18n, http, + userProfile, theme, overlays, notifications, diff --git a/x-pack/plugins/spaces/public/management/edit_space/provider/edit_space_provider.tsx b/x-pack/plugins/spaces/public/management/edit_space/provider/edit_space_provider.tsx index 7eafb4ae7e391..8de774797c974 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/provider/edit_space_provider.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/provider/edit_space_provider.tsx @@ -35,7 +35,10 @@ import { import type { SpacesManager } from '../../../spaces_manager'; export interface EditSpaceProviderRootProps - extends Pick { + extends Pick< + CoreStart, + 'userProfile' | 'theme' | 'i18n' | 'overlays' | 'http' | 'notifications' + > { logger: Logger; capabilities: ApplicationStart['capabilities']; getUrlForApp: ApplicationStart['getUrlForApp']; diff --git a/x-pack/plugins/spaces/public/management/edit_space/roles/component/space_assign_role_privilege_form.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/roles/component/space_assign_role_privilege_form.test.tsx index 5b1e263e20f16..ea24864bb092c 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/roles/component/space_assign_role_privilege_form.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/roles/component/space_assign_role_privilege_form.test.tsx @@ -19,6 +19,7 @@ import { overlayServiceMock, themeServiceMock, } from '@kbn/core/public/mocks'; +import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks'; import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; import type { Role, SecurityLicense } from '@kbn/security-plugin-types-common'; import { @@ -43,6 +44,7 @@ const privilegeAPIClient = createPrivilegeAPIClientMock(); const http = httpServiceMock.createStartContract(); const notifications = notificationServiceMock.createStartContract(); const overlays = overlayServiceMock.createStartContract(); +const userProfile = userProfileServiceMock.createStart(); const theme = themeServiceMock.createStartContract(); const i18n = i18nServiceMock.createStartContract(); const logger = loggingSystemMock.createLogger(); @@ -89,6 +91,7 @@ const renderPrivilegeRolesForm = ({ logger, i18n, http, + userProfile, theme, overlays, notifications, diff --git a/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx b/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx index 67973542aae54..d721ff79600c3 100644 --- a/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx +++ b/x-pack/plugins/spaces/public/management/spaces_management_app.test.tsx @@ -192,7 +192,7 @@ describe('spacesManagementApp', () => { css="You have tried to stringify object returned from \`css\` function. It isn't supposed to be used directly (e.g. as value of the \`className\` prop), but rather handed to emotion so it can handle it (e.g. as value of \`css\` prop)." data-test-subj="kbnRedirectAppLink" > - Spaces Edit Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"serverBasePath":"","http":{"basePath":{"basePath":"","serverBasePath":"","assetsHrefBase":""},"anonymousPaths":{},"externalUrl":{},"staticAssets":{}},"overlays":{"banners":{}},"notifications":{"toasts":{}},"theme":{"theme$":{}},"i18n":{},"logger":{"context":[]},"spacesManager":{"onActiveSpaceChange$":{}},"spaceId":"some-space","history":{"action":"PUSH","length":1,"location":{"pathname":"/edit/some-space","search":"","hash":""}},"allowFeatureVisibility":true,"allowSolutionVisibility":true} + Spaces Edit Page: {"capabilities":{"catalogue":{},"management":{},"navLinks":{}},"serverBasePath":"","http":{"basePath":{"basePath":"","serverBasePath":"","assetsHrefBase":""},"anonymousPaths":{},"externalUrl":{},"staticAssets":{}},"overlays":{"banners":{}},"notifications":{"toasts":{}},"userProfile":{},"theme":{"theme$":{}},"i18n":{},"logger":{"context":[]},"spacesManager":{"onActiveSpaceChange$":{}},"spaceId":"some-space","history":{"action":"PUSH","length":1,"location":{"pathname":"/edit/some-space","search":"","hash":""}},"allowFeatureVisibility":true,"allowSolutionVisibility":true} `); diff --git a/x-pack/plugins/spaces/public/management/spaces_management_app.tsx b/x-pack/plugins/spaces/public/management/spaces_management_app.tsx index 13546ef3e77f0..3e72ce63caeb9 100644 --- a/x-pack/plugins/spaces/public/management/spaces_management_app.tsx +++ b/x-pack/plugins/spaces/public/management/spaces_management_app.tsx @@ -82,7 +82,7 @@ export const spacesManagementApp = Object.freeze({ text: title, href: `/`, }; - const { notifications, application, chrome, http, overlays, theme } = coreStart; + const { notifications, application, chrome, http, overlays } = coreStart; chrome.docTitle.change(title); @@ -160,7 +160,8 @@ export const spacesManagementApp = Object.freeze({ http={http} overlays={overlays} notifications={notifications} - theme={theme} + userProfile={coreStart.userProfile} + theme={coreStart.theme} i18n={coreStart.i18n} logger={logger} spacesManager={spacesManager} diff --git a/x-pack/plugins/spaces/public/space_selector/space_selector.tsx b/x-pack/plugins/spaces/public/space_selector/space_selector.tsx index d334ee9efab35..8808aabd490aa 100644 --- a/x-pack/plugins/spaces/public/space_selector/space_selector.tsx +++ b/x-pack/plugins/spaces/public/space_selector/space_selector.tsx @@ -249,7 +249,7 @@ export class SpaceSelector extends Component { } export const renderSpaceSelectorApp = ( - services: Pick, + services: Pick, { element }: Pick, props: Props ) => { diff --git a/x-pack/plugins/spaces/tsconfig.json b/x-pack/plugins/spaces/tsconfig.json index 771f1b2e6139b..83c93cd898f10 100644 --- a/x-pack/plugins/spaces/tsconfig.json +++ b/x-pack/plugins/spaces/tsconfig.json @@ -54,7 +54,8 @@ "@kbn/core-application-browser-mocks", "@kbn/ui-theme", "@kbn/core-chrome-browser", - "@kbn/core-lifecycle-server" + "@kbn/core-lifecycle-server", + "@kbn/core-user-profile-browser-mocks", ], "exclude": [ "target/**/*",