Files
supabase/apps/studio/components/interfaces/Explorer/QueryEditor/QueryResultRenderer.tsx
T
Joshen LimandAli Waseem ce2ed77c02 Add clickhouse migration banner to QueryEditor (#49184)
## Context

Adds the clickhouse migration banner into the QueryEditor for explorer
if the source selected is logs - will apply for both the notebook query
cells and query tab

JFYI i've omitted out the diffing view for now, like what've currently
got for the SQL Editor

Got a separate ticket to look into that, but was thinking of waiting for
[this PR](https://github.com/supabase/supabase/pull/49112) from Charis
to go in first

<img width="1391" height="369" alt="image"
src="https://github.com/user-attachments/assets/5880df99-44b5-4a9f-8ff7-c9d7af3bcb93"
/>
<img width="1054" height="474" alt="image"
src="https://github.com/user-attachments/assets/ef5d225b-3b53-4d6d-ab6c-19804e3358e6"
/>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added guidance in SQL editors to identify and rewrite legacy logs
queries.
* Integrated rewrite suggestions into the query editor’s existing SQL
diff workflow.
* Increased the height of embedded query editors for improved usability.
* Kept rewrite guidance available when no rewrite is needed or an
attempt is unsuccessful.

* **Bug Fixes**
  * Improved spacing for empty query-result messages.

* **Tests**
* Added coverage for rewrite visibility, acceptance, dismissal, and
no-change outcomes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Ali Waseem <waseema393@gmail.com>
2026-08-19 00:16:00 +08:00

35 lines
1.1 KiB
TypeScript

import { type QueryResult } from '../types'
import { QueryResultChart } from './QueryResultChart'
import { QueryResultError } from './QueryResultError'
import { DataGridResults } from '@/components/ui/DataGridResults'
import { type ChartConfig } from '@/data/content/notebooks/notebook-schema'
interface QueryResultRendererProps {
result?: QueryResult
view?: 'table' | 'chart'
chart?: ChartConfig
}
export const QueryResultRenderer = ({ result, view, chart }: QueryResultRendererProps) => {
const { rows, error, autoLimit } = result ?? {}
if (!result) {
return <p className="text-xs text-foreground-lighter py-8">Run the query to see results</p>
}
if (error) {
return <QueryResultError error={error} autoLimit={autoLimit} />
}
if ((rows ?? []).length === 0) {
return <p className="text-xs text-foreground-lighter py-8">Success. No rows returned</p>
}
if (rows && rows.length > 0) {
if (view === 'table') return <DataGridResults rows={rows} />
if (view === 'chart') return <QueryResultChart chart={chart} result={result} />
}
return null
}