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... 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/**/*" 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 && ( + + + + )} +