-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Agent Builder] Sidebar designs #258547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chrisbmar
merged 14 commits into
elastic:ab-agent-centric-ux-feature-branch
from
chrisbmar:ab-sidebar-designs-13409
Mar 19, 2026
Merged
[Agent Builder] Sidebar designs #258547
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c7da434
sidebar footer and sidebar link component
chrisbmar 1c2c8f1
sidebar header
chrisbmar 03f5ede
sidebar open close
chrisbmar 50941cb
add keyboard shortcut for opening and closing the sidebar
chrisbmar 495aa28
agent selector initial implementation
chrisbmar d560fcc
update agent options styling
chrisbmar 6908e96
fix nav lists for manage and agent settings
chrisbmar dba0bfe
conversation list
chrisbmar a9ab8af
remove comments
chrisbmar b7f06fe
better semantics and hide sidebar when it reaches breakpoint
chrisbmar d3cecf0
fix sidebar link styles
chrisbmar c6d9531
fix conversation list styles
chrisbmar ca17d7c
fix styles
chrisbmar c87856f
Merge branch 'ab-agent-centric-ux-feature-branch' into ab-sidebar-des…
chrisbmar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
180 changes: 180 additions & 0 deletions
180
...ins/shared/agent_builder/public/application/components/common/agent_selector_dropdown.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,180 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import React, { useState } from 'react'; | ||
|
|
||
| import { | ||
| EuiButtonEmpty, | ||
| EuiFlexGroup, | ||
| EuiFlexItem, | ||
| EuiPopover, | ||
| EuiPopoverFooter, | ||
| EuiSelectable, | ||
| } from '@elastic/eui'; | ||
| import type { EuiPopoverProps } from '@elastic/eui'; | ||
| import { css } from '@emotion/react'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { FormattedMessage } from '@kbn/i18n-react'; | ||
| import type { AgentDefinition } from '@kbn/agent-builder-common'; | ||
|
|
||
| import { useUiPrivileges } from '../../hooks/use_ui_privileges'; | ||
| import { useNavigation } from '../../hooks/use_navigation'; | ||
| import { appPaths } from '../../utils/app_paths'; | ||
| import { | ||
| getMaxListHeight, | ||
| selectorPopoverPanelStyles, | ||
| useSelectorListStyles, | ||
| } from '../conversations/conversation_input/input_actions/input_actions.styles'; | ||
| import { useAgentOptions } from '../conversations/conversation_input/input_actions/agent_selector/use_agent_options'; | ||
|
|
||
| const AGENT_OPTION_ROW_HEIGHT = 44; | ||
|
|
||
| const selectAgentAriaLabel = i18n.translate( | ||
| 'xpack.agentBuilder.agentSelectorDropdown.selectAgent.ariaLabel', | ||
| { defaultMessage: 'Select an agent' } | ||
| ); | ||
| const createAgentAriaLabel = i18n.translate( | ||
| 'xpack.agentBuilder.agentSelectorDropdown.createAgent.ariaLabel', | ||
| { defaultMessage: 'Create an agent' } | ||
| ); | ||
| const manageAgentsAriaLabel = i18n.translate( | ||
| 'xpack.agentBuilder.agentSelectorDropdown.manageAgents.ariaLabel', | ||
| { defaultMessage: 'Manage agents' } | ||
| ); | ||
|
|
||
| const agentSelectId = 'agentBuilderAgentSelectorDropdown'; | ||
| const agentListId = `${agentSelectId}_listbox`; | ||
|
|
||
| const AgentListFooter: React.FC = () => { | ||
| const { manageAgents } = useUiPrivileges(); | ||
| const { createAgentBuilderUrl } = useNavigation(); | ||
| const createAgentHref = createAgentBuilderUrl(appPaths.agents.new); | ||
| const manageAgentsHref = createAgentBuilderUrl(appPaths.agents.list); | ||
| return ( | ||
| <EuiPopoverFooter paddingSize="s"> | ||
| <EuiFlexGroup responsive={false} justifyContent="spaceBetween" gutterSize="s"> | ||
| <EuiFlexItem> | ||
| <EuiButtonEmpty | ||
| size="s" | ||
| iconType="gear" | ||
| color="text" | ||
| aria-label={manageAgentsAriaLabel} | ||
| href={manageAgentsHref} | ||
| disabled={!manageAgents} | ||
| > | ||
| <FormattedMessage | ||
| id="xpack.agentBuilder.agentSelectorDropdown.manageAgents" | ||
| defaultMessage="Manage" | ||
| /> | ||
| </EuiButtonEmpty> | ||
| </EuiFlexItem> | ||
| <EuiFlexItem> | ||
| <EuiButtonEmpty | ||
| size="s" | ||
| iconType="plus" | ||
| aria-label={createAgentAriaLabel} | ||
| href={createAgentHref} | ||
| disabled={!manageAgents} | ||
| > | ||
| <FormattedMessage | ||
| id="xpack.agentBuilder.agentSelectorDropdown.createNewAgent" | ||
| defaultMessage="New" | ||
| /> | ||
| </EuiButtonEmpty> | ||
| </EuiFlexItem> | ||
| </EuiFlexGroup> | ||
| </EuiPopoverFooter> | ||
| ); | ||
| }; | ||
|
|
||
| export interface AgentSelectorDropdownProps { | ||
| agents: AgentDefinition[]; | ||
| selectedAgent?: AgentDefinition; | ||
| onAgentChange: (agentId: string) => void; | ||
| anchorPosition?: EuiPopoverProps['anchorPosition']; | ||
| /** Shown in the trigger button when selectedAgent is undefined (e.g. deleted agent) */ | ||
| fallbackLabel?: string; | ||
| } | ||
|
|
||
| export const AgentSelectorDropdown: React.FC<AgentSelectorDropdownProps> = ({ | ||
| agents, | ||
| selectedAgent, | ||
| onAgentChange, | ||
| anchorPosition = 'downLeft', | ||
| fallbackLabel, | ||
| }) => { | ||
| const [isPopoverOpen, setIsPopoverOpen] = useState(false); | ||
|
|
||
| const { agentOptions, renderAgentOption } = useAgentOptions({ | ||
| agents, | ||
| selectedAgentId: selectedAgent?.id, | ||
| }); | ||
|
|
||
| const selectorListStyles = css` | ||
| ${useSelectorListStyles({ listId: agentListId })} | ||
| &#${agentListId} .euiSelectableListItem { | ||
| align-items: flex-start; | ||
| } | ||
| `; | ||
|
|
||
| const listItemsHeight = agentOptions.length * AGENT_OPTION_ROW_HEIGHT; | ||
| const listHeight = Math.min(listItemsHeight, getMaxListHeight({ withFooter: true })); | ||
|
|
||
| const triggerButton = ( | ||
| <EuiButtonEmpty | ||
| size="s" | ||
| iconType="arrowDown" | ||
| iconSide="right" | ||
| flush="both" | ||
| color="text" | ||
| onClick={() => setIsPopoverOpen((v) => !v)} | ||
| > | ||
| {selectedAgent?.name ?? fallbackLabel} | ||
| </EuiButtonEmpty> | ||
| ); | ||
|
|
||
| return ( | ||
| <EuiPopover | ||
| panelProps={{ css: selectorPopoverPanelStyles }} | ||
| panelPaddingSize="none" | ||
| button={triggerButton} | ||
| isOpen={isPopoverOpen} | ||
| anchorPosition={anchorPosition} | ||
| closePopover={() => setIsPopoverOpen(false)} | ||
| > | ||
| <EuiSelectable | ||
| id={agentSelectId} | ||
| aria-label={selectAgentAriaLabel} | ||
| options={agentOptions} | ||
| onChange={(_options, _event, changedOption) => { | ||
| const { checked, key: agentId } = changedOption; | ||
| if (checked === 'on' && agentId) { | ||
| onAgentChange(agentId); | ||
| setIsPopoverOpen(false); | ||
| } | ||
| }} | ||
| singleSelection | ||
| renderOption={(option) => renderAgentOption({ agent: option.agent })} | ||
| height={listHeight} | ||
| listProps={{ | ||
| id: agentListId, | ||
| isVirtualized: true, | ||
| rowHeight: AGENT_OPTION_ROW_HEIGHT, | ||
| onFocusBadge: false, | ||
| css: selectorListStyles, | ||
| }} | ||
| > | ||
| {(list) => ( | ||
| <> | ||
| {list} | ||
| <AgentListFooter /> | ||
| </> | ||
| )} | ||
| </EuiSelectable> | ||
| </EuiPopover> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,8 +7,6 @@ | |
|
|
||
| import { useEuiTheme } from '@elastic/eui'; | ||
| import { css } from '@emotion/react'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; | ||
| import React from 'react'; | ||
| import { Conversation } from './conversation'; | ||
| import { ConversationHeader } from './conversation_header/conversation_header'; | ||
|
|
@@ -20,68 +18,43 @@ import { conversationBackgroundStyles, headerHeight } from './conversation.style | |
| export const AgentBuilderConversationsView: React.FC<{}> = () => { | ||
| const { euiTheme } = useEuiTheme(); | ||
|
|
||
| const mainStyles = css` | ||
| border: none; | ||
| const containerStyles = css` | ||
| display: flex; | ||
| flex-direction: column; | ||
| height: var(--kbn-application--content-height); | ||
| ${conversationBackgroundStyles(euiTheme)} | ||
| `; | ||
|
|
||
| const headerStyles = css` | ||
| justify-content: center; | ||
| flex-shrink: 0; | ||
| height: ${headerHeight}px; | ||
| display: flex; | ||
| align-items: center; | ||
| padding: ${euiTheme.size.m}; | ||
| `; | ||
|
|
||
| const contentStyles = css` | ||
| width: 100%; | ||
| height: 100%; | ||
| flex: 1; | ||
| max-block-size: calc(var(--kbn-application--content-height) - ${headerHeight}px); | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| padding: 0 ${euiTheme.size.base} ${euiTheme.size.base} ${euiTheme.size.base}; | ||
| `; | ||
|
|
||
| const labels = { | ||
| header: i18n.translate('xpack.agentBuilder.conversationsView.header', { | ||
| defaultMessage: 'Conversation header', | ||
| }), | ||
| content: i18n.translate('xpack.agentBuilder.conversationsView.content', { | ||
| defaultMessage: 'Conversation content', | ||
| }), | ||
| }; | ||
|
|
||
| return ( | ||
| <RoutedConversationsProvider> | ||
| <SendMessageProvider> | ||
| <AgentBuilderTourProvider> | ||
| <KibanaPageTemplate | ||
| offset={0} | ||
| restrictWidth={false} | ||
| data-test-subj="agentBuilderPageConversations" | ||
| grow={false} | ||
| panelled={false} | ||
| mainProps={{ | ||
| css: mainStyles, | ||
| }} | ||
| responsive={[]} | ||
| > | ||
| <KibanaPageTemplate.Header | ||
| css={headerStyles} | ||
| bottomBorder={false} | ||
| aria-label={labels.header} | ||
| paddingSize="m" | ||
| responsive={false} | ||
| > | ||
|
Comment on lines
-54
to
-71
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These components should not be here anymore, they now live in the |
||
| <div css={containerStyles} data-test-subj="agentBuilderPageConversations"> | ||
| <div css={headerStyles}> | ||
| <ConversationHeader /> | ||
| </KibanaPageTemplate.Header> | ||
| <KibanaPageTemplate.Section | ||
| paddingSize="none" | ||
| grow | ||
| contentProps={{ | ||
| css: contentStyles, | ||
| }} | ||
| aria-label={labels.content} | ||
| > | ||
| </div> | ||
| <div css={contentStyles}> | ||
| <Conversation /> | ||
| </KibanaPageTemplate.Section> | ||
| </KibanaPageTemplate> | ||
| </div> | ||
| </div> | ||
| </AgentBuilderTourProvider> | ||
| </SendMessageProvider> | ||
| </RoutedConversationsProvider> | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just moved from another location, not new