Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Preparation for High Contrast Mode, Security domains (#202609) #203493

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 6 additions & 66 deletions oas_docs/bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -5883,18 +5883,6 @@
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
"operationId": "get-dashboards-dashboard",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"description": "The page number to return. Default is \"1\".",
"in": "query",
Expand All @@ -5921,7 +5909,7 @@
"responses": {
"200": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -6070,18 +6058,6 @@
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
"operationId": "delete-dashboards-dashboard-id",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"description": "A required header to protect against CSRF attacks",
"in": "header",
Expand Down Expand Up @@ -6113,18 +6089,6 @@
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
"operationId": "get-dashboards-dashboard-id",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"description": "A unique identifier for the dashboard.",
"in": "path",
Expand All @@ -6138,7 +6102,7 @@
"responses": {
"200": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -6773,18 +6737,6 @@
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
"operationId": "post-dashboards-dashboard-id",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"description": "A required header to protect against CSRF attacks",
"in": "header",
Expand All @@ -6807,7 +6759,7 @@
],
"requestBody": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -7342,7 +7294,7 @@
"responses": {
"200": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -7949,18 +7901,6 @@
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
"operationId": "put-dashboards-dashboard-id",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"description": "A required header to protect against CSRF attacks",
"in": "header",
Expand All @@ -7983,7 +7923,7 @@
],
"requestBody": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -8512,7 +8452,7 @@
"responses": {
"200": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down
40 changes: 0 additions & 40 deletions oas_docs/output/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7638,14 +7638,6 @@ paths:
description: This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
operationId: get-dashboards-dashboard
parameters:
- description: The version of the API to use
in: header
name: elastic-api-version
schema:
default: '2023-10-31'
enum:
- '2023-10-31'
type: string
- description: The page number to return. Default is "1".
in: query
name: page
Expand Down Expand Up @@ -7768,14 +7760,6 @@ paths:
description: This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
operationId: delete-dashboards-dashboard-id
parameters:
- description: The version of the API to use
in: header
name: elastic-api-version
schema:
default: '2023-10-31'
enum:
- '2023-10-31'
type: string
- description: A required header to protect against CSRF attacks
in: header
name: kbn-xsrf
Expand All @@ -7798,14 +7782,6 @@ paths:
description: This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
operationId: get-dashboards-dashboard-id
parameters:
- description: The version of the API to use
in: header
name: elastic-api-version
schema:
default: '2023-10-31'
enum:
- '2023-10-31'
type: string
- description: A unique identifier for the dashboard.
in: path
name: id
Expand Down Expand Up @@ -8269,14 +8245,6 @@ paths:
description: This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
operationId: post-dashboards-dashboard-id
parameters:
- description: The version of the API to use
in: header
name: elastic-api-version
schema:
default: '2023-10-31'
enum:
- '2023-10-31'
type: string
- description: A required header to protect against CSRF attacks
in: header
name: kbn-xsrf
Expand Down Expand Up @@ -9110,14 +9078,6 @@ paths:
description: This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
operationId: put-dashboards-dashboard-id
parameters:
- description: The version of the API to use
in: header
name: elastic-api-version
schema:
default: '2023-10-31'
enum:
- '2023-10-31'
type: string
- description: A required header to protect against CSRF attacks
in: header
name: kbn-xsrf
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-mock-idp-plugin/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const plugin: PluginInitializer<
]);

ReactDOM.render(
<KibanaThemeProvider theme={coreStart.theme}>
<KibanaThemeProvider {...coreStart}>
<KibanaContextProvider services={coreStart}>
<I18nProvider>
<LoginPage />
Expand All @@ -69,7 +69,7 @@ export const plugin: PluginInitializer<
order: 4000 + 1, // Make sure it comes after the user menu
mount: (element: HTMLElement) => {
ReactDOM.render(
<KibanaThemeProvider theme={coreStart.theme}>
<KibanaThemeProvider {...coreStart}>
<KibanaContextProvider services={coreStart}>
<I18nProvider>
<RoleSwitcher />
Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-mock-idp-plugin/public/reload_page_toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -26,6 +27,7 @@ export const DATA_TEST_SUBJ_PAGE_RELOAD_BUTTON = 'pageReloadButton';
*/
export const createReloadPageToast = (options: {
user: Pick<AuthenticatedUser, 'roles'>;
userProfile: UserProfileService;
theme: ThemeServiceStart;
i18n: I18nStart;
}): ToastInput => {
Expand All @@ -43,7 +45,7 @@ export const createReloadPageToast = (options: {
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>,
{ i18n: options.i18n, theme: options.theme }
options
),
color: 'success',
toastLifeTimeMs: 0x7fffffff, // Do not auto-hide toast since page is in an unknown state
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-mock-idp-plugin/public/role_switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const RoleSwitcher = () => {
services.notifications.toasts.add(
createReloadPageToast({
user: authenticateUserState.value,
userProfile: services.userProfile,
theme: services.theme,
i18n: services.i18n,
})
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-mock-idp-plugin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
"@kbn/mock-idp-utils",
"@kbn/cloud-plugin",
"@kbn/es",
"@kbn/core-user-profile-browser",
]
}
6 changes: 4 additions & 2 deletions packages/kbn-user-profile-components/src/services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -47,6 +48,7 @@ export interface UserProfilesKibanaDependencies {
core: {
notifications: NotificationsStart;
theme: ThemeServiceStart;
userProfile: UserProfileService;
i18n: I18nStart;
};
security: {
Expand All @@ -70,7 +72,7 @@ export const UserProfilesKibanaProvider: FC<PropsWithChildren<UserProfilesKibana
...services
}) => {
const {
core: { notifications, i18n, theme },
core: { notifications, ...startServices },
security: { userProfiles: userProfileApiClient },
toMountPoint: toMountPointUtility,
} = services;
Expand All @@ -86,7 +88,7 @@ export const UserProfilesKibanaProvider: FC<PropsWithChildren<UserProfilesKibana
notifications.toasts.addSuccess(
{
title,
text: text ? toMountPointUtility(text, { i18n, theme }) : undefined,
text: text ? toMountPointUtility(text, startServices) : undefined,
},
toastOptions
);
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-user-profile-components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@kbn/react-kibana-mount",
"@kbn/core-i18n-browser",
"@kbn/test-jest-helpers",
"@kbn/core-user-profile-browser",
],
"exclude": [
"target/**/*",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/security/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ export const plugin: PluginInitializer<
> = (initializerContext: PluginInitializerContext) => new SecurityPlugin(initializerContext);

// services needed for rendering React using shared modules
export type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme'>;
export type StartServices = Pick<CoreStart, 'analytics' | 'i18n' | 'theme' | 'userProfile'>;
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand All @@ -214,6 +217,7 @@ function getProps({
history: scopedHistoryMock.create(),
spacesApiUi,
buildFlavor,
userProfile: userProfileMock,
theme: themeMock,
i18n: i18nMock,
analytics: analyticsMock,
Expand Down
Loading
Loading