diff --git a/common/types/config.ts b/common/types/config.ts index ad8e340b..74531362 100644 --- a/common/types/config.ts +++ b/common/types/config.ts @@ -25,6 +25,9 @@ export const configSchema = schema.object({ smartAnomalyDetector: schema.object({ enabled: schema.boolean({ defaultValue: false }), }), + branding: schema.object({ + label: schema.string({ defaultValue: '' }), + }), }); export type ConfigSchema = TypeOf; diff --git a/public/components/ui_action_context_menu.tsx b/public/components/ui_action_context_menu.tsx index 5794f499..0e5b9f14 100644 --- a/public/components/ui_action_context_menu.tsx +++ b/public/components/ui_action_context_menu.tsx @@ -5,14 +5,18 @@ import React, { useState, useRef } from 'react'; import useAsync from 'react-use/lib/useAsync'; -import { EuiButtonIcon, EuiContextMenu, EuiPopover } from '@elastic/eui'; +import { EuiButtonEmpty, EuiContextMenu, EuiPopover } from '@elastic/eui'; +import { i18n } from '@osd/i18n'; import { buildContextMenuForActions } from '../../../../src/plugins/ui_actions/public'; import { AI_ASSISTANT_QUERY_EDITOR_TRIGGER } from '../ui_triggers'; import { getUiActions } from '../services'; -import assistantTriggerIcon from '../assets/assistant_trigger.svg'; -export const ActionContextMenu = () => { +interface Props { + label?: string; +} + +export const ActionContextMenu = (props: Props) => { const uiActions = getUiActions(); const actionsRef = useRef(uiActions.getTriggerActions(AI_ASSISTANT_QUERY_EDITOR_TRIGGER)); const [open, setOpen] = useState(false); @@ -38,12 +42,20 @@ export const ActionContextMenu = () => { return ( setOpen(!open)} - /> + iconSide="right" + flush="both" + > + {props.label || + i18n.translate('dashboardAssistant.branding.assistantActionButton.label', { + defaultMessage: 'AI assistant', + })} + } isOpen={open} panelPaddingSize="none" diff --git a/public/plugin.tsx b/public/plugin.tsx index bcc6d4ff..f220df5d 100644 --- a/public/plugin.tsx +++ b/public/plugin.tsx @@ -258,8 +258,8 @@ export class AssistantPlugin id: 'assistant-query-actions', order: 2000, isEnabled$: () => of(true), - getComponent: () => { - return ; + getSearchBarButton: () => { + return ; }, }, }, diff --git a/server/index.ts b/server/index.ts index 6bbdce05..151657b5 100644 --- a/server/index.ts +++ b/server/index.ts @@ -15,6 +15,7 @@ export const config: PluginConfigDescriptor = { text2viz: true, alertInsight: true, smartAnomalyDetector: true, + branding: true, }, schema: configSchema, };