mirror of
https://github.com/supabase/supabase.git
synced 2026-06-20 11:22:25 +08:00
fix: logs copy shortcuts (#46183)
## TL;DR fixes logs copy shortcuts so selected rows are copied instead of the full results set (keeps the existing full results copy when no rows are selected) ## ref: - closes https://github.com/supabase/supabase/issues/46181 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added keyboard shortcuts to quickly copy selected log rows in JSON, Markdown, and CSV formats. Shortcuts activate only when rows are selected. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46183?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -442,6 +442,21 @@ export const LogTable = ({
|
||||
})
|
||||
}
|
||||
|
||||
useShortcut(SHORTCUT_IDS.RESULTS_COPY_JSON, () => handleCopySelectedRows('json'), {
|
||||
enabled: selectedRowsData.length > 0,
|
||||
conflictBehavior: 'allow',
|
||||
})
|
||||
|
||||
useShortcut(SHORTCUT_IDS.RESULTS_COPY_MARKDOWN, () => handleCopySelectedRows('markdown'), {
|
||||
enabled: selectedRowsData.length > 0,
|
||||
conflictBehavior: 'allow',
|
||||
})
|
||||
|
||||
useShortcut(SHORTCUT_IDS.RESULTS_COPY_CSV, () => handleCopySelectedRows('csv'), {
|
||||
enabled: selectedRowsData.length > 0,
|
||||
conflictBehavior: 'allow',
|
||||
})
|
||||
|
||||
const logsExplorerTableHeader = (
|
||||
<div
|
||||
className={cn(
|
||||
@@ -456,6 +471,7 @@ export const LogTable = ({
|
||||
text={`Results ${data && data.length ? `(${data.length})` : ''}`}
|
||||
results={data}
|
||||
fileName={`supabase-logs-${ref}.csv`}
|
||||
enableCopyShortcuts={selectedRowsData.length === 0}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ interface DownloadResultsButtonProps {
|
||||
align?: 'start' | 'center' | 'end'
|
||||
results: any[]
|
||||
fileName: string
|
||||
enableCopyShortcuts?: boolean
|
||||
onDownloadAsCSV?: () => void
|
||||
onCopyAsMarkdown?: () => void
|
||||
onCopyAsJSON?: () => void
|
||||
@@ -43,6 +44,7 @@ export const DownloadResultsButton = ({
|
||||
align = 'start',
|
||||
results,
|
||||
fileName,
|
||||
enableCopyShortcuts = true,
|
||||
onDownloadAsCSV,
|
||||
onCopyAsMarkdown,
|
||||
onCopyAsJSON,
|
||||
@@ -103,15 +105,18 @@ export const DownloadResultsButton = ({
|
||||
}
|
||||
|
||||
useShortcut(SHORTCUT_IDS.RESULTS_COPY_MARKDOWN, copyAsMarkdown, {
|
||||
enabled: !isEmpty,
|
||||
enabled: !isEmpty && enableCopyShortcuts,
|
||||
conflictBehavior: 'allow',
|
||||
registerInCommandMenu: true,
|
||||
})
|
||||
useShortcut(SHORTCUT_IDS.RESULTS_COPY_JSON, copyAsJSON, {
|
||||
enabled: !isEmpty,
|
||||
enabled: !isEmpty && enableCopyShortcuts,
|
||||
conflictBehavior: 'allow',
|
||||
registerInCommandMenu: true,
|
||||
})
|
||||
useShortcut(SHORTCUT_IDS.RESULTS_COPY_CSV, copyAsCSV, {
|
||||
enabled: !isEmpty,
|
||||
enabled: !isEmpty && enableCopyShortcuts,
|
||||
conflictBehavior: 'allow',
|
||||
registerInCommandMenu: true,
|
||||
})
|
||||
useShortcut(SHORTCUT_IDS.RESULTS_DOWNLOAD_CSV, downloadAsCSV, {
|
||||
|
||||
Reference in New Issue
Block a user