From edaea05538e71cf24c5929a49ecf6be3fb6708d4 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Thu, 15 Jun 2023 14:30:01 +0200 Subject: [PATCH 1/3] add drift to security getting start and observability overview --- .../public/components/chat/chat.tsx | 4 +- x-pack/plugins/observability/kibana.jsonc | 4 +- .../public/application/index.tsx | 69 ++++++++++--------- .../public/pages/overview/overview.tsx | 3 + x-pack/plugins/observability/public/plugin.ts | 2 + x-pack/plugins/security_solution/kibana.jsonc | 3 +- .../security_solution/public/app/app.tsx | 40 ++++++----- .../public/overview/pages/landing.tsx | 2 + 8 files changed, 74 insertions(+), 53 deletions(-) diff --git a/x-pack/plugins/cloud_integrations/cloud_chat/public/components/chat/chat.tsx b/x-pack/plugins/cloud_integrations/cloud_chat/public/components/chat/chat.tsx index f58c5d0834ae2..1a11542699ed3 100644 --- a/x-pack/plugins/cloud_integrations/cloud_chat/public/components/chat/chat.tsx +++ b/x-pack/plugins/cloud_integrations/cloud_chat/public/components/chat/chat.tsx @@ -37,10 +37,10 @@ export const Chat = ({ onHide = () => {}, onReady, onResize }: Props) => { } const { isReady, isResized, style } = config; - const { bottom, height, right } = style; + const { right } = style; const buttonCSS = css` - bottom: calc(${bottom} + ${height}); + bottom: ${euiThemeVars.euiSizeXS}; position: fixed; right: calc(${right} + ${euiThemeVars.euiSizeXS}); visibility: ${isReady && isResized ? 'visible' : 'hidden'}; diff --git a/x-pack/plugins/observability/kibana.jsonc b/x-pack/plugins/observability/kibana.jsonc index c60511b3ec6a5..a69ffbd0234f6 100644 --- a/x-pack/plugins/observability/kibana.jsonc +++ b/x-pack/plugins/observability/kibana.jsonc @@ -29,8 +29,8 @@ "unifiedSearch", "visualizations" ], - "optionalPlugins": ["discover", "home", "licensing", "usageCollection"], - "requiredBundles": ["data", "kibanaReact", "kibanaUtils", "unifiedSearch"], + "optionalPlugins": ["discover", "home", "licensing", "usageCollection", "cloud"], + "requiredBundles": ["data", "kibanaReact", "kibanaUtils", "unifiedSearch", "cloudChat"], "extraPublicDirs": ["common"] } } diff --git a/x-pack/plugins/observability/public/application/index.tsx b/x-pack/plugins/observability/public/application/index.tsx index b04dfca154d6b..ea0294f1eca77 100644 --- a/x-pack/plugins/observability/public/application/index.tsx +++ b/x-pack/plugins/observability/public/application/index.tsx @@ -85,43 +85,50 @@ export const renderApp = ({ const ApplicationUsageTrackingProvider = usageCollection?.components.ApplicationUsageTrackingProvider ?? React.Fragment; + const CloudProvider = plugins.cloud?.CloudContextProvider ?? React.Fragment; + ReactDOM.render( - - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + , diff --git a/x-pack/plugins/observability/public/pages/overview/overview.tsx b/x-pack/plugins/observability/public/pages/overview/overview.tsx index 5212897a5c53c..a938cdc98023e 100644 --- a/x-pack/plugins/observability/public/pages/overview/overview.tsx +++ b/x-pack/plugins/observability/public/pages/overview/overview.tsx @@ -11,6 +11,7 @@ import { BoolQuery } from '@kbn/es-query'; import { i18n } from '@kbn/i18n'; import { AlertConsumers } from '@kbn/rule-data-utils'; import { useBreadcrumbs, useFetcher } from '@kbn/observability-shared-plugin/public'; +import { Chat } from '@kbn/cloud-chat-plugin/public'; import { useKibana } from '../../utils/kibana_react'; import { LoadingObservability } from '../../components/loading_observability'; @@ -240,6 +241,8 @@ export function OverviewPage() { {isDataAssistantFlyoutVisible ? ( setIsDataAssistantFlyoutVisible(false)} /> ) : null} + + ); } diff --git a/x-pack/plugins/observability/public/plugin.ts b/x-pack/plugins/observability/public/plugin.ts index f0b515f554973..fd6300eff8caa 100644 --- a/x-pack/plugins/observability/public/plugin.ts +++ b/x-pack/plugins/observability/public/plugin.ts @@ -26,6 +26,7 @@ import type { DiscoverStart } from '@kbn/discover-plugin/public'; import type { EmbeddableStart } from '@kbn/embeddable-plugin/public'; import type { HomePublicPluginSetup, HomePublicPluginStart } from '@kbn/home-plugin/public'; import type { ChartsPluginStart } from '@kbn/charts-plugin/public'; +import type { CloudStart } from '@kbn/cloud-plugin/public'; import type { ObservabilitySharedPluginSetup, ObservabilitySharedPluginStart, @@ -117,6 +118,7 @@ export interface ObservabilityPublicPluginsStart { usageCollection: UsageCollectionSetup; unifiedSearch: UnifiedSearchPublicPluginStart; home?: HomePublicPluginStart; + cloud?: CloudStart; } export type ObservabilityPublicStart = ReturnType; diff --git a/x-pack/plugins/security_solution/kibana.jsonc b/x-pack/plugins/security_solution/kibana.jsonc index b279ea77e0bac..f24dffb58edc6 100644 --- a/x-pack/plugins/security_solution/kibana.jsonc +++ b/x-pack/plugins/security_solution/kibana.jsonc @@ -68,7 +68,8 @@ "usageCollection", "lists", "ml", - "unifiedSearch" + "unifiedSearch", + "cloudChat" ], "extraPublicDirs": [ "common" diff --git a/x-pack/plugins/security_solution/public/app/app.tsx b/x-pack/plugins/security_solution/public/app/app.tsx index a0e582b6b7ac2..290d7092cb836 100644 --- a/x-pack/plugins/security_solution/public/app/app.tsx +++ b/x-pack/plugins/security_solution/public/app/app.tsx @@ -142,23 +142,29 @@ const SecurityAppComponent: React.FC = ({ setHeaderActionMenu, store, theme$, -}) => ( - - { + const CloudProvider = services.cloud?.CloudContextProvider ?? React.Fragment; + + return ( + - {children} - - -); + + + {children} + + + + ); +}; export const SecurityApp = memo(SecurityAppComponent); diff --git a/x-pack/plugins/security_solution/public/overview/pages/landing.tsx b/x-pack/plugins/security_solution/public/overview/pages/landing.tsx index c12eae3e0a7b5..71dd89fe0ba7f 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/landing.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/landing.tsx @@ -7,6 +7,7 @@ import React, { memo } from 'react'; import useObservable from 'react-use/lib/useObservable'; +import { Chat } from '@kbn/cloud-chat-plugin/public'; import { SpyRoute } from '../../common/utils/route/spy_routes'; import { SecurityPageName } from '../../../common/constants'; import { LandingPageComponent } from '../../common/components/landing_page'; @@ -24,6 +25,7 @@ export const LandingPage = memo(() => { )} + ); From 83b74bb4bc2b17ded84881427a891e90f897e044 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 15 Jun 2023 12:38:56 +0000 Subject: [PATCH 2/3] [CI] Auto-commit changed files from 'node scripts/lint_ts_projects --fix' --- x-pack/plugins/observability/tsconfig.json | 4 +++- x-pack/plugins/security_solution/tsconfig.json | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/observability/tsconfig.json b/x-pack/plugins/observability/tsconfig.json index 4adbf40cd1d94..77f668338ba35 100644 --- a/x-pack/plugins/observability/tsconfig.json +++ b/x-pack/plugins/observability/tsconfig.json @@ -75,7 +75,9 @@ "@kbn/ui-actions-plugin", "@kbn/field-types", "@kbn/safer-lodash-set", - "@kbn/core-http-server" + "@kbn/core-http-server", + "@kbn/cloud-chat-plugin", + "@kbn/cloud-plugin" ], "exclude": [ "target/**/*" diff --git a/x-pack/plugins/security_solution/tsconfig.json b/x-pack/plugins/security_solution/tsconfig.json index 46ba02332e5c3..a4d2e2873a072 100644 --- a/x-pack/plugins/security_solution/tsconfig.json +++ b/x-pack/plugins/security_solution/tsconfig.json @@ -160,6 +160,7 @@ "@kbn/url-state", "@kbn/ml-anomaly-utils", "@kbn/field-formats-plugin", - "@kbn/dev-proc-runner" + "@kbn/dev-proc-runner", + "@kbn/cloud-chat-plugin" ] } From ba2e2beb2d9a788a05ca1c25399bda86d8736a3b Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Thu, 15 Jun 2023 17:12:07 +0200 Subject: [PATCH 3/3] =?UTF-8?q?add=20tests=20(they=20don=E2=80=99t=20run?= =?UTF-8?q?=20on=20ci=20yet)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- x-pack/test/cloud_integration/config.ts | 10 ++++++++- x-pack/test/cloud_integration/tests/chat.ts | 25 +++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/x-pack/test/cloud_integration/config.ts b/x-pack/test/cloud_integration/config.ts index efa0096e5a199..6ce2950753394 100644 --- a/x-pack/test/cloud_integration/config.ts +++ b/x-pack/test/cloud_integration/config.ts @@ -95,7 +95,15 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { 'dateFormat:tz': 'UTC', }, }, - apps: kibanaFunctionalConfig.get('apps'), + apps: { + ...kibanaFunctionalConfig.get('apps'), + observability: { + pathname: '/app/observability', + }, + security: { + pathname: '/app/security', + }, + }, screenshots: { directory: resolve(__dirname, 'screenshots') }, junit: { diff --git a/x-pack/test/cloud_integration/tests/chat.ts b/x-pack/test/cloud_integration/tests/chat.ts index 25bb869805d12..1f50386a8dcf9 100644 --- a/x-pack/test/cloud_integration/tests/chat.ts +++ b/x-pack/test/cloud_integration/tests/chat.ts @@ -21,7 +21,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('chat widget is present on integrations page', async () => { - PageObjects.common.navigateToUrl('integrations', 'browse', { + await PageObjects.common.navigateToUrl('integrations', 'browse', { useActualUrl: true, shouldUseHashForSubUrl: false, }); @@ -29,16 +29,37 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('chat widget is present on home getting_started page', async () => { - PageObjects.common.navigateToUrl('home', '/getting_started', { + await PageObjects.common.navigateToUrl('home', '/getting_started', { useActualUrl: true, shouldUseHashForSubUrl: true, }); await testSubjects.existOrFail('cloud-chat'); }); + it('chat widget is present on management page', async () => { + await PageObjects.common.navigateToApp('management'); + await testSubjects.existOrFail('cloud-chat'); + }); + it('chat widget is present on management page', async () => { PageObjects.common.navigateToApp('management'); await testSubjects.existOrFail('cloud-chat'); }); + + it('chat widget is present on observability/overview page', async () => { + await PageObjects.common.navigateToUrl('observability', '/overview', { + useActualUrl: true, + shouldUseHashForSubUrl: true, + }); + await testSubjects.existOrFail('cloud-chat'); + }); + + it('chat widget is present on security/get_started page', async () => { + await PageObjects.common.navigateToUrl('security', '/get_started', { + useActualUrl: true, + shouldUseHashForSubUrl: true, + }); + await testSubjects.existOrFail('cloud-chat'); + }); }); }