import { Loader2 } from 'lucide-react' import { AiIconAnimation, Button, cn, Tooltip, TooltipContent, TooltipTrigger } from 'ui' import type { ClassifiedQuery } from '../QueryInsightsHealth/QueryInsightsHealth.types' import { ISSUE_DOT_COLORS, ISSUE_ICONS } from './QueryInsightsTable.constants' import { formatDuration, getColumnName, getTableName } from './QueryInsightsTable.utils' interface QueryInsightsTableRowProps { item: ClassifiedQuery onRowClick?: () => void onGoToLogs?: () => void onCreateIndex?: () => void onExplain?: () => void onAiSuggestedFix?: () => void isExplainLoading?: boolean } export const QueryInsightsTableRow = ({ item, onRowClick, onGoToLogs, onCreateIndex, onExplain, onAiSuggestedFix, isExplainLoading, }: QueryInsightsTableRowProps) => { const IssueIcon = item.issueType ? ISSUE_ICONS[item.issueType] : null return (
{item.queryType ?? '–'} {getTableName(item.query) && ( <> {' '} in {getTableName(item.query)} > )} {getColumnName(item.query) && ( <> , {getColumnName(item.query)} > )}
{item.hint}