From 3e7b77b9580bcb490e59680beeab7d123d7e1927 Mon Sep 17 00:00:00 2001 From: Sander Philipse <94373878+sphilipse@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:13:37 +0200 Subject: [PATCH] [Search] Add UI kbn feature flag for Inference Endpoints (#195385) This adds a UI feature flag for the inference endpoints plugin. Call this to enable: ``` POST kbn:/internal/kibana/settings/inferenceEndpointsUi:enabled {"value": true} ``` (cherry picked from commit 09ba6b91b5ffd2dbb5ad8ffd91b3d518d8129607) --- x-pack/plugins/search_inference_endpoints/public/index.ts | 2 ++ .../plugins/search_inference_endpoints/public/plugin.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/search_inference_endpoints/public/index.ts b/x-pack/plugins/search_inference_endpoints/public/index.ts index b06f1f64b909d..1c9e267a18bde 100644 --- a/x-pack/plugins/search_inference_endpoints/public/index.ts +++ b/x-pack/plugins/search_inference_endpoints/public/index.ts @@ -17,3 +17,5 @@ export type { SearchInferenceEndpointsPluginSetup, SearchInferenceEndpointsPluginStart, } from './types'; + +export const INFERENCE_ENDPOINTS_UI_FLAG = 'inferenceEndpointsUi:enabled'; diff --git a/x-pack/plugins/search_inference_endpoints/public/plugin.ts b/x-pack/plugins/search_inference_endpoints/public/plugin.ts index ab49281f82e4c..a864b7c0fcdd6 100644 --- a/x-pack/plugins/search_inference_endpoints/public/plugin.ts +++ b/x-pack/plugins/search_inference_endpoints/public/plugin.ts @@ -21,6 +21,7 @@ import { SearchInferenceEndpointsPluginSetup, SearchInferenceEndpointsPluginStart, } from './types'; +import { INFERENCE_ENDPOINTS_UI_FLAG } from '.'; export class SearchInferenceEndpointsPlugin implements Plugin @@ -34,8 +35,11 @@ export class SearchInferenceEndpointsPlugin public setup( core: CoreSetup ): SearchInferenceEndpointsPluginSetup { - if (!this.config.ui?.enabled) return {}; - + if ( + !this.config.ui?.enabled && + !core.uiSettings.get(INFERENCE_ENDPOINTS_UI_FLAG, false) + ) + return {}; core.application.register({ id: PLUGIN_ID, appRoute: '/app/search_inference_endpoints',