mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 16:03:49 +00:00
fix(ui): preserve disabled agent tooltip reason
This commit is contained in:
@@ -506,9 +506,11 @@ describe('ReviewNotesSendMenuContent', () => {
|
||||
|
||||
const tree = render()
|
||||
const item = findByType(tree, 'DropdownMenuItem')
|
||||
const stateDot = findByType(item, 'AgentStateDot')
|
||||
|
||||
expect(item.props.disabled).toBe(true)
|
||||
expect(item.props.title).toBe('Agent needs permission')
|
||||
expect(stateDot.props.title).toBeNull()
|
||||
;(item.props.onSelect as () => void)()
|
||||
expect(harness.sendNotesToActiveAgentSession).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
@@ -247,6 +247,7 @@ function AgentTargetMenuItem({
|
||||
const tabTitle = target.tabTitle.trim()
|
||||
const state = asDotState(agent?.state ?? 'idle', agent?.entry.workingMode)
|
||||
const timeAgo = agent ? formatAgentRelativeTime(agent, now) : null
|
||||
const disabledReason = target.status === 'disabled' ? target.disabledReason : undefined
|
||||
const secondaryParts = [
|
||||
agentStateLabel(state),
|
||||
...(timeAgo ? [timeAgo] : []),
|
||||
@@ -259,10 +260,16 @@ function AgentTargetMenuItem({
|
||||
// Why: surface the ineligibility reason (permission/stale/no-terminal) as a
|
||||
// hover tooltip rather than inline text, matching DashboardAgentRow's
|
||||
// title-attribute treatment of the same disabledReason.
|
||||
title={target.status === 'disabled' ? target.disabledReason : undefined}
|
||||
title={disabledReason}
|
||||
className="min-w-[240px] gap-2 rounded-[7px] px-2 py-1.5 text-[12px] leading-5 font-medium"
|
||||
>
|
||||
<AgentStateDot state={state} size="sm" className="shrink-0" />
|
||||
{/* Why: the ancestor's actionable disabled reason must win on every hit area. */}
|
||||
<AgentStateDot
|
||||
state={state}
|
||||
size="sm"
|
||||
className="shrink-0"
|
||||
title={disabledReason ? null : undefined}
|
||||
/>
|
||||
<AgentIcon agent={agentTypeToIconAgent(target.agentType ?? agent?.agentType)} size={14} />
|
||||
<span className="grid min-w-0 flex-1 text-left">
|
||||
<span className="truncate">
|
||||
|
||||
Reference in New Issue
Block a user