mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 19:35:06 +03:00
- Route execution through useExecuteSQLEditorQuery (Postgres vs logs endpoint). - Add a "Logs" entry to the source selector; when selected, swap the Postgres role control for a time picker (defaults to last 24h) and run against logs. - Make inline generation (Cmd+Shift+K) and the AI debug action prepend the ClickHouse logs schema so the assistant writes logs SQL. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
20 lines
813 B
TypeScript
20 lines
813 B
TypeScript
import { proxy, useSnapshot } from 'valtio'
|
|
|
|
import { getDefaultLogsTimeRange } from '@/components/interfaces/SQLEditor/sqlEditorLogs'
|
|
|
|
// Time range used when the SQL Editor runs against the logs source. Module-level
|
|
// so the picker (UtilityActions) and execution (SQLEditor) share one source of
|
|
// truth without threading props. Defaults to the last 24 hours.
|
|
const initialRange = getDefaultLogsTimeRange(new Date())
|
|
|
|
export const sqlEditorLogsState = proxy({
|
|
iso_timestamp_start: initialRange.iso_timestamp_start,
|
|
iso_timestamp_end: initialRange.iso_timestamp_end,
|
|
setTimeRange: (start: string, end: string) => {
|
|
sqlEditorLogsState.iso_timestamp_start = start
|
|
sqlEditorLogsState.iso_timestamp_end = end
|
|
},
|
|
})
|
|
|
|
export const useSqlEditorLogsStateSnapshot = () => useSnapshot(sqlEditorLogsState)
|