From 2cbb98b1ce99401d0505d95ab81ec9447c349d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20FOUCRET?= Date: Fri, 13 Oct 2023 10:44:54 +0200 Subject: [PATCH 1/4] [ELSER Model Deployment] Remove useless check (#168781) --- .../lib/ml/ml_model_deployment_common.ts | 21 ------------------- .../lib/ml/start_ml_model_deployment.ts | 9 +------- .../server/lib/ml/start_ml_model_download.ts | 9 +------- 3 files changed, 2 insertions(+), 37 deletions(-) diff --git a/x-pack/plugins/enterprise_search/server/lib/ml/ml_model_deployment_common.ts b/x-pack/plugins/enterprise_search/server/lib/ml/ml_model_deployment_common.ts index 59498b4d8587a..84af615841eaf 100644 --- a/x-pack/plugins/enterprise_search/server/lib/ml/ml_model_deployment_common.ts +++ b/x-pack/plugins/enterprise_search/server/lib/ml/ml_model_deployment_common.ts @@ -5,16 +5,12 @@ * 2.0. */ -import { ELASTIC_MODEL_DEFINITIONS } from '@kbn/ml-trained-models-utils'; - import { ElasticsearchResponseError, isNotFoundException, isResourceNotFoundException, } from '../../utils/identify_exceptions'; -export const acceptableModelNames = Object.keys(ELASTIC_MODEL_DEFINITIONS); - export function isNotFoundExceptionError(error: unknown): boolean { return ( isResourceNotFoundException(error as ElasticsearchResponseError) || @@ -23,20 +19,3 @@ export function isNotFoundExceptionError(error: unknown): boolean { error?.statusCode === 404 ); } - -export function throwIfNotAcceptableModelName(modelName: string) { - if (!acceptableModelNames.includes(modelName)) { - const notFoundError: ElasticsearchResponseError = { - meta: { - body: { - error: { - type: 'resource_not_found_exception', - }, - }, - statusCode: 404, - }, - name: 'ResponseError', - }; - throw notFoundError; - } -} diff --git a/x-pack/plugins/enterprise_search/server/lib/ml/start_ml_model_deployment.ts b/x-pack/plugins/enterprise_search/server/lib/ml/start_ml_model_deployment.ts index 75bac93c2d200..4f65dbf9ced64 100644 --- a/x-pack/plugins/enterprise_search/server/lib/ml/start_ml_model_deployment.ts +++ b/x-pack/plugins/enterprise_search/server/lib/ml/start_ml_model_deployment.ts @@ -12,10 +12,7 @@ import { MlTrainedModels } from '@kbn/ml-plugin/server'; import { MlModelDeploymentStatus, MlModelDeploymentState } from '../../../common/types/ml'; import { getMlModelDeploymentStatus } from './get_ml_model_deployment_status'; -import { - isNotFoundExceptionError, - throwIfNotAcceptableModelName, -} from './ml_model_deployment_common'; +import { isNotFoundExceptionError } from './ml_model_deployment_common'; export const startMlModelDeployment = async ( modelName: string, @@ -25,10 +22,6 @@ export const startMlModelDeployment = async ( throw new Error('Machine Learning is not enabled'); } - // before anything else, check our model name - // to ensure we only allow those names we want - throwIfNotAcceptableModelName(modelName); - try { // try and get the deployment status of the model first // and see if it's already deployed or deploying... diff --git a/x-pack/plugins/enterprise_search/server/lib/ml/start_ml_model_download.ts b/x-pack/plugins/enterprise_search/server/lib/ml/start_ml_model_download.ts index 4d7f3c21e1210..ffa51acc5bd32 100644 --- a/x-pack/plugins/enterprise_search/server/lib/ml/start_ml_model_download.ts +++ b/x-pack/plugins/enterprise_search/server/lib/ml/start_ml_model_download.ts @@ -11,10 +11,7 @@ import { MlTrainedModels } from '@kbn/ml-plugin/server'; import { MlModelDeploymentState, MlModelDeploymentStatus } from '../../../common/types/ml'; import { getMlModelDeploymentStatus } from './get_ml_model_deployment_status'; -import { - isNotFoundExceptionError, - throwIfNotAcceptableModelName, -} from './ml_model_deployment_common'; +import { isNotFoundExceptionError } from './ml_model_deployment_common'; export const startMlModelDownload = async ( modelName: string, @@ -24,10 +21,6 @@ export const startMlModelDownload = async ( throw new Error('Machine Learning is not enabled'); } - // before anything else, check our model name - // to ensure we only allow those names we want - throwIfNotAcceptableModelName(modelName); - try { // try and get the deployment status of the model first // and see if it's already deployed or deploying... From 05975c8d5358ee80bdb95cfccedb803740ca6394 Mon Sep 17 00:00:00 2001 From: David Roberts Date: Fri, 13 Oct 2023 09:46:33 +0100 Subject: [PATCH 2/4] [ML] Enable all ES side ML features for the ES3 project type (#168646) The aim here is to enable the Elasticsearch APIs for all ML features in the ES3 serverless project type, while still leaving the UI support for anomaly detection and data frame analytics unavailable in this project type. Therefore, the only changes in this PR are to the ES config options supplied during tests. If we ever want to enable the UI support for anomaly detection and data frame analytics in the ES3 project type then a followup PR will be needed. --- .../api_integration/test_suites/search/config.feature_flags.ts | 2 +- .../api_integration/test_suites/search/config.ts | 2 +- .../functional/test_suites/search/config.examples.ts | 2 +- .../functional/test_suites/search/config.feature_flags.ts | 2 +- .../functional/test_suites/search/config.screenshots.ts | 2 +- x-pack/test_serverless/functional/test_suites/search/config.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/test_serverless/api_integration/test_suites/search/config.feature_flags.ts b/x-pack/test_serverless/api_integration/test_suites/search/config.feature_flags.ts index d56585c4634f9..ad5a651179e32 100644 --- a/x-pack/test_serverless/api_integration/test_suites/search/config.feature_flags.ts +++ b/x-pack/test_serverless/api_integration/test_suites/search/config.feature_flags.ts @@ -24,5 +24,5 @@ export default createTestConfig({ // include settings from project controller // https://github.com/elastic/project-controller/blob/main/internal/project/esproject/config/elasticsearch.yml - esServerArgs: ['xpack.ml.ad.enabled=false', 'xpack.ml.dfa.enabled=false'], + esServerArgs: [], }); diff --git a/x-pack/test_serverless/api_integration/test_suites/search/config.ts b/x-pack/test_serverless/api_integration/test_suites/search/config.ts index 7afde0944020c..4d0445a99a3e6 100644 --- a/x-pack/test_serverless/api_integration/test_suites/search/config.ts +++ b/x-pack/test_serverless/api_integration/test_suites/search/config.ts @@ -17,5 +17,5 @@ export default createTestConfig({ // include settings from project controller // https://github.com/elastic/project-controller/blob/main/internal/project/esproject/config/elasticsearch.yml - esServerArgs: ['xpack.ml.ad.enabled=false', 'xpack.ml.dfa.enabled=false'], + esServerArgs: [], }); diff --git a/x-pack/test_serverless/functional/test_suites/search/config.examples.ts b/x-pack/test_serverless/functional/test_suites/search/config.examples.ts index 67c77ac423844..0d30d29ab2a9f 100644 --- a/x-pack/test_serverless/functional/test_suites/search/config.examples.ts +++ b/x-pack/test_serverless/functional/test_suites/search/config.examples.ts @@ -23,5 +23,5 @@ export default createTestConfig({ // include settings from project controller // https://github.com/elastic/project-controller/blob/main/internal/project/esproject/config/elasticsearch.yml - esServerArgs: ['xpack.ml.ad.enabled=false', 'xpack.ml.dfa.enabled=false'], + esServerArgs: [], }); diff --git a/x-pack/test_serverless/functional/test_suites/search/config.feature_flags.ts b/x-pack/test_serverless/functional/test_suites/search/config.feature_flags.ts index 9d9663be9230f..dc109ec9705f9 100644 --- a/x-pack/test_serverless/functional/test_suites/search/config.feature_flags.ts +++ b/x-pack/test_serverless/functional/test_suites/search/config.feature_flags.ts @@ -24,5 +24,5 @@ export default createTestConfig({ // include settings from project controller // https://github.com/elastic/project-controller/blob/main/internal/project/esproject/config/elasticsearch.yml - esServerArgs: ['xpack.ml.ad.enabled=false', 'xpack.ml.dfa.enabled=false'], + esServerArgs: [], }); diff --git a/x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts b/x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts index 3a8966904b5c9..f146583710057 100644 --- a/x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts +++ b/x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts @@ -19,5 +19,5 @@ export default createTestConfig({ // include settings from project controller // https://github.com/elastic/project-controller/blob/main/internal/project/esproject/config/elasticsearch.yml - esServerArgs: ['xpack.ml.ad.enabled=false', 'xpack.ml.dfa.enabled=false'], + esServerArgs: [], }); diff --git a/x-pack/test_serverless/functional/test_suites/search/config.ts b/x-pack/test_serverless/functional/test_suites/search/config.ts index 5e0168a7c530d..c2171c532bf23 100644 --- a/x-pack/test_serverless/functional/test_suites/search/config.ts +++ b/x-pack/test_serverless/functional/test_suites/search/config.ts @@ -17,5 +17,5 @@ export default createTestConfig({ // include settings from project controller // https://github.com/elastic/project-controller/blob/main/internal/project/esproject/config/elasticsearch.yml - esServerArgs: ['xpack.ml.ad.enabled=false', 'xpack.ml.dfa.enabled=false'], + esServerArgs: [], }); From c000a25f41474df052d6fefe187916455e515e24 Mon Sep 17 00:00:00 2001 From: Panagiota Mitsopoulou Date: Fri, 13 Oct 2023 11:18:43 +0200 Subject: [PATCH 3/4] use RedirectAppLinks from @kbn/shared-ux-link-redirect-app (#167696) Fixes https://github.com/elastic/kibana/issues/164368 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/plugins/observability/public/application/index.tsx | 6 +++--- x-pack/plugins/observability/tsconfig.json | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/observability/public/application/index.tsx b/x-pack/plugins/observability/public/application/index.tsx index 2d251ac71660e..40724d6db5b9f 100644 --- a/x-pack/plugins/observability/public/application/index.tsx +++ b/x-pack/plugins/observability/public/application/index.tsx @@ -14,8 +14,9 @@ import { Router, Routes, Route } from '@kbn/shared-ux-router'; import { AppMountParameters, APP_WRAPPER_CLASS, CoreStart } from '@kbn/core/public'; import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; import type { LazyObservabilityPageTemplateProps } from '@kbn/observability-shared-plugin/public'; -import { KibanaContextProvider, RedirectAppLinks } from '@kbn/kibana-react-plugin/public'; +import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; +import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app'; import { Storage } from '@kbn/kibana-utils-plugin/public'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { ObservabilityAIAssistantProvider } from '@kbn/observability-ai-assistant-plugin/public'; @@ -111,8 +112,7 @@ export const renderApp = ({ diff --git a/x-pack/plugins/observability/tsconfig.json b/x-pack/plugins/observability/tsconfig.json index a3d803b89bb97..d5123d9b5c86b 100644 --- a/x-pack/plugins/observability/tsconfig.json +++ b/x-pack/plugins/observability/tsconfig.json @@ -90,7 +90,8 @@ "@kbn/deeplinks-observability", "@kbn/core-application-common", "@kbn/react-kibana-mount", - "@kbn/react-kibana-context-theme" + "@kbn/react-kibana-context-theme", + "@kbn/shared-ux-link-redirect-app" ], "exclude": [ "target/**/*" From 3f061a5de289ebc1847d9d8726e509118561c750 Mon Sep 17 00:00:00 2001 From: Achyut Jhunjhunwala Date: Fri, 13 Oct 2023 11:38:44 +0200 Subject: [PATCH 4/4] [APM] Move feedback button outside the react portal in serverless (#168350) ## Summary Closes https://github.com/elastic/kibana/issues/168016 The PR moves the Feedback button outside the Action Portal in Serverless Mode ## Serverless ### Before ![serverless-feedback-before](https://github.com/elastic/kibana/assets/7416358/05569109-7235-474d-a14e-91edd4e69a16) ### After ![serverless-feedback-after](https://github.com/elastic/kibana/assets/7416358/ac990c8c-f496-45c3-9b2c-69863a34f2fe) ## Stateful Both before and After is same ![Stateful](https://github.com/elastic/kibana/assets/7416358/39e21959-dc49-4410-9619-4725643ce8bf) --- .../public/application/app.tsx | 27 ++++------ .../observability_onboarding/public/plugin.ts | 9 ++++ .../public/routes/templates/custom_logs.tsx | 51 +++++++++++++------ .../public/routes/templates/system_logs.tsx | 43 ++++++++++++---- 4 files changed, 87 insertions(+), 43 deletions(-) diff --git a/x-pack/plugins/observability_onboarding/public/application/app.tsx b/x-pack/plugins/observability_onboarding/public/application/app.tsx index 93a62f5f378e3..fc791436e3887 100644 --- a/x-pack/plugins/observability_onboarding/public/application/app.tsx +++ b/x-pack/plugins/observability_onboarding/public/application/app.tsx @@ -24,7 +24,6 @@ import { Router, Routes, Route } from '@kbn/shared-ux-router'; import { euiDarkVars, euiLightVars } from '@kbn/ui-theme'; import React from 'react'; import ReactDOM from 'react-dom'; -import { RouteComponentProps, RouteProps } from 'react-router-dom'; import { ConfigSchema } from '..'; import { customLogsRoutes } from '../components/app/custom_logs'; import { systemLogsRoutes } from '../components/app/system_logs'; @@ -37,16 +36,6 @@ import { baseRoutes, routes } from '../routes'; import { CustomLogs } from '../routes/templates/custom_logs'; import { SystemLogs } from '../routes/templates/system_logs'; -export type BreadcrumbTitle< - T extends { [K in keyof T]?: string | undefined } = {} -> = string | ((props: RouteComponentProps) => string) | null; - -export interface RouteDefinition< - T extends { [K in keyof T]?: string | undefined } = any -> extends RouteProps { - breadcrumb: BreadcrumbTitle; -} - export const onBoardingTitle = i18n.translate( 'xpack.observability_onboarding.breadcrumbs.onboarding', { @@ -157,6 +146,8 @@ export function ObservabilityOnboardingAppRoot({ const i18nCore = core.i18n; const plugins = { ...deps }; + const renderFeedbackLinkAsPortal = !config.serverless.enabled; + return ( - - - + {renderFeedbackLinkAsPortal && ( + + + + )} diff --git a/x-pack/plugins/observability_onboarding/public/plugin.ts b/x-pack/plugins/observability_onboarding/public/plugin.ts index 05806059b12e3..1a4982eab0859 100644 --- a/x-pack/plugins/observability_onboarding/public/plugin.ts +++ b/x-pack/plugins/observability_onboarding/public/plugin.ts @@ -28,6 +28,7 @@ import type { ObservabilityOnboardingConfig } from '../server'; import { PLUGIN_ID } from '../common'; import { ObservabilityOnboardingLocatorDefinition } from './locators/onboarding_locator/locator_definition'; import { ObservabilityOnboardingPluginLocators } from './locators'; +import { ConfigSchema } from '.'; export type ObservabilityOnboardingPluginSetup = void; export type ObservabilityOnboardingPluginStart = void; @@ -44,6 +45,14 @@ export interface ObservabilityOnboardingPluginStartDeps { observability: ObservabilityPublicStart; } +export interface ObservabilityOnboardingPluginContextValue { + core: CoreStart; + plugins: ObservabilityOnboardingPluginSetupDeps; + data: DataPublicPluginStart; + observability: ObservabilityPublicStart; + config: ConfigSchema; +} + export class ObservabilityOnboardingPlugin implements Plugin< diff --git a/x-pack/plugins/observability_onboarding/public/routes/templates/custom_logs.tsx b/x-pack/plugins/observability_onboarding/public/routes/templates/custom_logs.tsx index c2a18238943d2..411eb2b8e79e1 100644 --- a/x-pack/plugins/observability_onboarding/public/routes/templates/custom_logs.tsx +++ b/x-pack/plugins/observability_onboarding/public/routes/templates/custom_logs.tsx @@ -9,6 +9,8 @@ import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { useBreadcrumbs } from '@kbn/observability-shared-plugin/public'; import React, { ComponentType, useRef, useState } from 'react'; +import { useKibana } from '@kbn/kibana-react-plugin/public'; +import { ObservabilityOnboardingPluginContextValue } from '../../plugin'; import { breadcrumbsApp } from '../../application/app'; import { Provider as WizardProvider } from '../../components/app/custom_logs'; import { @@ -16,6 +18,7 @@ import { FilmstripTransition, TransitionState, } from '../../components/shared/filmstrip_transition'; +import { ObservabilityOnboardingHeaderActionMenu } from '../../components/app/header_action_menu'; interface Props { children: React.ReactNode; @@ -43,6 +46,12 @@ function AnimatedTransitionsWizard({ children }: Props) { const [title, setTitle] = useState(); const TransitionComponent = useRef(() => null); + const { + services: { config }, + } = useKibana(); + + const isServerless = config.serverless.enabled; + function onChangeStep({ direction, stepTitle, @@ -68,21 +77,33 @@ function AnimatedTransitionsWizard({ children }: Props) { - -

- {title - ? title - : i18n.translate( - 'xpack.observability_onboarding.title.collectCustomLogs', - { - defaultMessage: 'Stream log files to Elastic', - } - )} -

-
+ + + +

+ {title + ? title + : i18n.translate( + 'xpack.observability_onboarding.title.collectCustomLogs', + { + defaultMessage: 'Stream log files to Elastic', + } + )} +

+
+
+ {isServerless && ( + + + + )} +
(); + + const isServerless = config.serverless.enabled; return ( - -

- {i18n.translate( - 'xpack.observability_onboarding.title.collectSystemLogs', - { defaultMessage: 'Install shipper to collect system logs' } - )} -

-
+ + + +

+ {i18n.translate( + 'xpack.observability_onboarding.title.collectSystemLogs', + { defaultMessage: 'Install shipper to collect system logs' } + )} +

+
+
+ {isServerless && ( + + + + )} +