Skip to content

Conversation

@tianzhou
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings December 23, 2025 16:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the user experience for table results by adding search/filter functionality, execution time tracking, and row numbering to make the data more navigable and informative.

Key changes:

  • Added client-side search/filter functionality with text highlighting for table results
  • Implemented execution time measurement and display
  • Added row numbers to the results table for easier reference

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
frontend/src/components/views/ToolDetailView.tsx Adds state management and timing logic to track execution time and SQL query, passes new props to ResultsTable
frontend/src/components/tool/ResultsTable.tsx Implements search/filter UI with highlighting, row numbers column, and execution metadata display footer

Comment on lines 40 to 42
<mark key={index} className="bg-amber-200/50 text-foreground">
{text.substring(index, index + searchTerm.length)}
</mark>
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The highlighted text uses a key based on the index position, which could cause React rendering issues when the same search term appears multiple times at different positions in the text. Since index represents the position in the string, multiple matches could theoretically have the same key if not handled properly. Consider using a combination of index and a counter, or use the React fragment key pattern with a unique identifier like ${index}-${parts.length}.

Copilot uses AI. Check for mistakes.
</div>
{executedSql && executionTimeMs !== undefined && (
<div className="flex justify-between items-center text-sm text-muted-foreground">
<span>{executedSql}</span>
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The executed SQL query is displayed without any length limit or truncation. For long or complex SQL queries, this could cause layout issues or make the footer unwieldy. Consider truncating long queries with an ellipsis or displaying them in a collapsible section.

Copilot uses AI. Check for mistakes.
Comment on lines +196 to +198
{executedSql && executionTimeMs !== undefined && (
<div className="flex justify-between items-center text-sm text-muted-foreground">
<span>{executedSql}</span>
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition checks if executedSql is truthy, but executedSql is initialized as an empty string. If getSqlPreview() or sql returns an empty string, this footer won't display even though executionTimeMs might be valid. This could hide execution time information for empty queries. Consider checking executionTimeMs !== undefined as the primary condition, or handle the empty SQL case explicitly.

Suggested change
{executedSql && executionTimeMs !== undefined && (
<div className="flex justify-between items-center text-sm text-muted-foreground">
<span>{executedSql}</span>
{executionTimeMs !== undefined && (
<div className="flex justify-between items-center text-sm text-muted-foreground">
{executedSql !== undefined && executedSql !== '' && (
<span>{executedSql}</span>
)}

Copilot uses AI. Check for mistakes.
<div className="border border-border rounded-lg overflow-hidden">
{/* Header */}
<div className="flex bg-muted/50 border-b border-border">
<div className="w-16 px-3 py-2 text-sm font-medium text-foreground flex-shrink-0">
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This empty div creates a blank column header for the row numbers column, but it contains no content or accessible label. While visually it may be intentional to leave it blank, consider adding a visually-hidden label like "Row" or "#" for screen reader users to understand the purpose of this column.

Suggested change
<div className="w-16 px-3 py-2 text-sm font-medium text-foreground flex-shrink-0">
<div className="w-16 px-3 py-2 text-sm font-medium text-foreground flex-shrink-0">
<span className="sr-only">Row</span>

Copilot uses AI. Check for mistakes.
tianzhou and others added 2 commits December 23, 2025 08:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@tianzhou tianzhou merged commit f124824 into main Dec 23, 2025
2 checks passed
@tianzhou tianzhou deleted the editor branch December 24, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants