Skip to content

Commit

Permalink
[Obs AI Assistant] Update AI Assistant icon for serverless
Browse files Browse the repository at this point in the history
  • Loading branch information
viduni94 committed Dec 4, 2024
1 parent 01de887 commit f68c590
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -54,6 +54,7 @@ export function NavControl() {
plugins: {
start: {
observabilityAIAssistant: { ObservabilityAIAssistantChatServiceContext },
serverless,
},
},
},
Expand Down Expand Up @@ -140,22 +141,41 @@ export function NavControl() {
return (
<>
<EuiToolTip content={buttonLabel}>
<EuiButton
aria-label={buttonLabel}
data-test-subj="observabilityAiAssistantAppNavControlButton"
css={buttonCss}
onClick={() => {
service.conversations.openNewConversation({
messages: [],
});
}}
color="primary"
size="s"
fullWidth={false}
minWidth={0}
>
{chatService.loading ? <EuiLoadingSpinner size="s" /> : <AssistantAvatar size="xs" />}
</EuiButton>
{serverless ? (
<EuiButtonEmpty
aria-label={buttonLabel}
data-test-subj="observabilityAiAssistantAppNavControlButton"
css={css`
padding: 0px 8px;
`}
onClick={() => {
service.conversations.openNewConversation({
messages: [],
});
}}
color="primary"
size="s"
>
{chatService.loading ? <EuiLoadingSpinner size="s" /> : <AssistantAvatar size="xs" />}
</EuiButtonEmpty>
) : (
<EuiButton
aria-label={buttonLabel}
data-test-subj="observabilityAiAssistantAppNavControlButton"
css={buttonCss}
onClick={() => {
service.conversations.openNewConversation({
messages: [],
});
}}
color="primary"
size="s"
fullWidth={false}
minWidth={0}
>
{chatService.loading ? <EuiLoadingSpinner size="s" /> : <AssistantAvatar size="xs" />}
</EuiButton>
)}
</EuiToolTip>
{chatService.value ? (
<ObservabilityAIAssistantChatServiceContext.Provider value={chatService.value}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand All @@ -49,6 +50,7 @@ export interface ObservabilityAIAssistantAppPluginStartDependencies {
triggersActionsUi: TriggersAndActionsUIPublicPluginStart;
data: DataPublicPluginStart;
aiAssistantManagementSelection: AIAssistantManagementSelectionPluginPublicStart;
serverless?: ServerlessPluginStart;
}

export interface ObservabilityAIAssistantAppPluginSetupDependencies {
Expand All @@ -62,4 +64,5 @@ export interface ObservabilityAIAssistantAppPluginSetupDependencies {
ml: MlPluginSetup;
triggersActionsUi: TriggersAndActionsUIPublicPluginSetup;
aiAssistantManagementSelection: AIAssistantManagementSelectionPluginPublicSetup;
serverless?: ServerlessPluginStart;
}

0 comments on commit f68c590

Please sign in to comment.