mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
fix: address review feedback on execute status, file links, and login flags
This commit is contained in:
1 parent
421387793b
commit
801a4cd112
5 files changed
+81
-13
No files matched your search
@@ -197,7 +197,9 @@ export function ExecuteToolPart({ part, isWaitingPermission, onFileClick }: Exec
|
||||
() => (displayOutput === output ? parseOutput(output) : undefined),
|
||||
[displayOutput, output],
|
||||
)
|
||||
const failed = part.state.status === 'error' || metadata.error === true
|
||||
const failed = part.state.status === 'error'
|
||||
|| metadata.error === true
|
||||
|| (part.state.status === 'completed' && calls.some((call) => call.status === 'error'))
|
||||
const status = part.state.status
|
||||
|
||||
const statusLabel = (() => {
|
||||
|
||||
@@ -20,17 +20,19 @@ export function FileReferenceText({ text, onFileClick }: FileReferenceTextProps)
|
||||
}
|
||||
|
||||
segments.push(
|
||||
<span
|
||||
<button
|
||||
key={`ref-${index}`}
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
onFileClick?.(ref.filePath)
|
||||
}}
|
||||
className="text-primary hover:text-primary-hover cursor-pointer underline decoration-dotted"
|
||||
className="inline p-0 m-0 bg-transparent border-0 font-[inherit] text-left text-primary hover:text-primary-hover cursor-pointer underline decoration-dotted"
|
||||
title={`Click to open ${ref.filePath}`}
|
||||
aria-label={`Open ${ref.filePath}`}
|
||||
>
|
||||
{ref.fullMatch}
|
||||
</span>,
|
||||
</button>,
|
||||
)
|
||||
|
||||
lastIndex = ref.endIndex
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { MemoryRouter } from 'react-router-dom'
|
||||
import type { PermissionRequest, SessionMessageAssistantTool } from '@opencode-manager/shared/opencode'
|
||||
@@ -332,7 +332,10 @@ describe('ToolCallPart execute renderer', () => {
|
||||
|
||||
expect(screen.getByText('cua-driver.list_windows [app=TextEdit]')).toBeInTheDocument()
|
||||
expect(screen.getByText('cua-driver.click [x=10]')).toBeInTheDocument()
|
||||
expect(screen.getByText('✗')).toBeInTheDocument()
|
||||
|
||||
const errorRow = screen.getByRole('button', { name: /cua-driver\.click/ })
|
||||
expect(within(errorRow).getByText('✗')).toBeInTheDocument()
|
||||
expect(screen.getByText(/Failed/)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders line-numbered code and output sections when expanded', () => {
|
||||
@@ -423,7 +426,9 @@ describe('ToolCallPart execute renderer', () => {
|
||||
renderWithProviders(<ToolCallPart part={part} messageID="msg_1" onFileClick={onFileClick} />)
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /read \[path=src\/app.ts\]/ }))
|
||||
fireEvent.click(screen.getByTitle('Click to open src/app.ts'))
|
||||
const reference = screen.getByRole('button', { name: 'Open src/app.ts' })
|
||||
expect(reference).toHaveAttribute('title', 'Click to open src/app.ts')
|
||||
fireEvent.click(reference)
|
||||
|
||||
expect(onFileClick).toHaveBeenCalledWith('src/app.ts')
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user