From 8e73badaf944eac3d6a23f306fda983c9a6f2e9c Mon Sep 17 00:00:00 2001 From: neptunian Date: Thu, 11 Jul 2024 17:08:27 -0400 Subject: [PATCH 1/3] check for disabled plugin --- .../ai_assistant_selection_page.tsx | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 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..e142231b0553c 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,10 +24,23 @@ import { useAppContext } from '../../app_context'; export function AiAssistantSelectionPage() { const { capabilities, setBreadcrumbs, navigateToApp } = useAppContext(); - - const observabilityAIAssistantEnabled = capabilities.observabilityAIAssistant.show; + const observabilityAIAssistantPluginEnabled = capabilities.observabilityAIAssistant !== undefined; + const observabilityAIAssistantEnabled = capabilities.observabilityAIAssistant?.show; const securityAIAssistantEnabled = capabilities.securitySolutionAssistant?.['ai-assistant']; + const observabilityAIAssistantPluginDisabledMsg = i18n.translate( + 'aiAssistantManagementSelection.aiAssistantSelectionPage.observabilityAi.thisFeatureIsDisabledCallOutLabel', + { + defaultMessage: 'This feature is disabled.', + } + ); + + const observabilityFeatureDisabledInSpaceMsg = i18n.translate( + 'aiAssistantManagementSelection.aiAssistantSelectionPage.observabilityAi.thisFeatureIsDisabledInSpaceCallOutLabel', + { + defaultMessage: 'This feature is disabled and can be enabled from Spaces > Features.', + } + ); useEffect(() => { setBreadcrumbs([ { @@ -75,13 +88,11 @@ export function AiAssistantSelectionPage() { Features.', - } - )} + title={ + !observabilityAIAssistantPluginEnabled + ? observabilityAIAssistantPluginDisabledMsg + : observabilityFeatureDisabledInSpaceMsg + } size="s" /> From 3a14c285d67b66c9bc70770d9b790fdc55641c7a Mon Sep 17 00:00:00 2001 From: neptunian Date: Fri, 12 Jul 2024 12:34:46 -0400 Subject: [PATCH 2/3] change text --- .../public/routes/components/ai_assistant_selection_page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e142231b0553c..39290b69d8605 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 @@ -38,7 +38,7 @@ export function AiAssistantSelectionPage() { const observabilityFeatureDisabledInSpaceMsg = i18n.translate( 'aiAssistantManagementSelection.aiAssistantSelectionPage.observabilityAi.thisFeatureIsDisabledInSpaceCallOutLabel', { - defaultMessage: 'This feature is disabled and can be enabled from Spaces > Features.', + defaultMessage: 'This feature is disabled. It can be enabled from Spaces > Features', } ); useEffect(() => { From b34d53e5e2f5a9c7098c7613d4ee068c98d4db86 Mon Sep 17 00:00:00 2001 From: neptunian Date: Mon, 15 Jul 2024 07:33:01 -0400 Subject: [PATCH 3/3] simplify message --- .../ai_assistant_selection_page.tsx | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 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 39290b69d8605..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,23 +24,9 @@ import { useAppContext } from '../../app_context'; export function AiAssistantSelectionPage() { const { capabilities, setBreadcrumbs, navigateToApp } = useAppContext(); - const observabilityAIAssistantPluginEnabled = capabilities.observabilityAIAssistant !== undefined; const observabilityAIAssistantEnabled = capabilities.observabilityAIAssistant?.show; const securityAIAssistantEnabled = capabilities.securitySolutionAssistant?.['ai-assistant']; - const observabilityAIAssistantPluginDisabledMsg = i18n.translate( - 'aiAssistantManagementSelection.aiAssistantSelectionPage.observabilityAi.thisFeatureIsDisabledCallOutLabel', - { - defaultMessage: 'This feature is disabled.', - } - ); - - const observabilityFeatureDisabledInSpaceMsg = i18n.translate( - 'aiAssistantManagementSelection.aiAssistantSelectionPage.observabilityAi.thisFeatureIsDisabledInSpaceCallOutLabel', - { - defaultMessage: 'This feature is disabled. It can be enabled from Spaces > Features', - } - ); useEffect(() => { setBreadcrumbs([ { @@ -88,11 +74,12 @@ export function AiAssistantSelectionPage() {