From 023ee77fad18b8f626169f23d359552da0e8e2dd Mon Sep 17 00:00:00 2001 From: Sandra G Date: Mon, 15 Jul 2024 13:58:02 -0400 Subject: [PATCH] [Obs AI Assistant] Fix AI Assistant Settings when plugin disabled (#188160) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Fixes https://github.com/elastic/kibana/issues/187977 AI Assistant settings page doesn't load when the plugin is disabled. ### Changes - fixes not checking for object before accessing property - simplifies message so it makes sense for all possible states (read only, disabled in space, plugin disabled) ### Testing steps - create a Viewer user - go to Stack Management -> Advanced Settings -> AI Assistant - page should load with message that the feature is disabled Screenshot 2024-07-11 at 4 57 59 PM (cherry picked from commit d4ba87988da61dc793ba5982fa0bbc28034bf449) --- .../routes/components/ai_assistant_selection_page.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/ai_assistant_management/selection/public/routes/components/ai_assistant_selection_page.tsx b/src/plugins/ai_assistant_management/selection/public/routes/components/ai_assistant_selection_page.tsx index 9b0941d86a5d4..24dc00cae84f6 100644 --- a/src/plugins/ai_assistant_management/selection/public/routes/components/ai_assistant_selection_page.tsx +++ b/src/plugins/ai_assistant_management/selection/public/routes/components/ai_assistant_selection_page.tsx @@ -24,8 +24,7 @@ import { useAppContext } from '../../app_context'; export function AiAssistantSelectionPage() { const { capabilities, setBreadcrumbs, navigateToApp } = useAppContext(); - - const observabilityAIAssistantEnabled = capabilities.observabilityAIAssistant.show; + const observabilityAIAssistantEnabled = capabilities.observabilityAIAssistant?.show; const securityAIAssistantEnabled = capabilities.securitySolutionAssistant?.['ai-assistant']; useEffect(() => { @@ -78,8 +77,7 @@ export function AiAssistantSelectionPage() { title={i18n.translate( 'aiAssistantManagementSelection.aiAssistantSelectionPage.observabilityAi.thisFeatureIsDisabledCallOutLabel', { - defaultMessage: - 'This feature is disabled. It can be enabled from Spaces > Features.', + defaultMessage: 'This feature is disabled.', } )} size="s"