From f68c5905770b7f575abd7b23c3fab25b55977c18 Mon Sep 17 00:00:00 2001 From: Viduni Wickramarachchi Date: Tue, 3 Dec 2024 19:54:28 -0500 Subject: [PATCH] [Obs AI Assistant] Update AI Assistant icon for serverless --- .../public/components/nav_control/index.tsx | 54 +++++++++++++------ .../public/types.ts | 3 ++ 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/components/nav_control/index.tsx b/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/components/nav_control/index.tsx index b6095ac595cea..7ab776544ddff 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/components/nav_control/index.tsx +++ b/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/components/nav_control/index.tsx @@ -6,7 +6,7 @@ */ import React, { useEffect, useRef, useState } from 'react'; import { AssistantAvatar, useAbortableAsync } from '@kbn/observability-ai-assistant-plugin/public'; -import { EuiButton, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui'; +import { EuiButton, EuiButtonEmpty, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui'; import { css } from '@emotion/react'; import { v4 } from 'uuid'; import useObservable from 'react-use/lib/useObservable'; @@ -54,6 +54,7 @@ export function NavControl() { plugins: { start: { observabilityAIAssistant: { ObservabilityAIAssistantChatServiceContext }, + serverless, }, }, }, @@ -140,22 +141,41 @@ export function NavControl() { return ( <> - { - service.conversations.openNewConversation({ - messages: [], - }); - }} - color="primary" - size="s" - fullWidth={false} - minWidth={0} - > - {chatService.loading ? : } - + {serverless ? ( + { + service.conversations.openNewConversation({ + messages: [], + }); + }} + color="primary" + size="s" + > + {chatService.loading ? : } + + ) : ( + { + service.conversations.openNewConversation({ + messages: [], + }); + }} + color="primary" + size="s" + fullWidth={false} + minWidth={0} + > + {chatService.loading ? : } + + )} {chatService.value ? ( diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/types.ts b/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/types.ts index 398ef5f3afe4c..059e101936533 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/types.ts +++ b/x-pack/plugins/observability_solution/observability_ai_assistant_app/public/types.ts @@ -31,6 +31,7 @@ import type { AIAssistantManagementSelectionPluginPublicStart, AIAssistantManagementSelectionPluginPublicSetup, } from '@kbn/ai-assistant-management-plugin/public'; +import { ServerlessPluginStart } from '@kbn/serverless/public'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface ObservabilityAIAssistantAppPublicStart {} @@ -49,6 +50,7 @@ export interface ObservabilityAIAssistantAppPluginStartDependencies { triggersActionsUi: TriggersAndActionsUIPublicPluginStart; data: DataPublicPluginStart; aiAssistantManagementSelection: AIAssistantManagementSelectionPluginPublicStart; + serverless?: ServerlessPluginStart; } export interface ObservabilityAIAssistantAppPluginSetupDependencies { @@ -62,4 +64,5 @@ export interface ObservabilityAIAssistantAppPluginSetupDependencies { ml: MlPluginSetup; triggersActionsUi: TriggersAndActionsUIPublicPluginSetup; aiAssistantManagementSelection: AIAssistantManagementSelectionPluginPublicSetup; + serverless?: ServerlessPluginStart; }