Files
supabase/apps/studio/components/ui/DataTable/DataTableResetButton.tsx
Ivan Vasilov 3c6ef31959 feat: add User Filter to the unified logs (#47879)
Offshoot from https://github.com/supabase/supabase/pull/47743.

[Linear
issue](https://linear.app/supabase/issue/FE-3939/add-user-logs-filter-to-the-logs-page)

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

* **New Features**
* Added a `user` filter to Unified Logs with a user picker (email or
ID).
* Added “View user logs” actions from the Users table to jump to Unified
Logs.
* **Bug Fixes**
* Updated Unified Logs searching so default log-type restrictions no
longer block user-attributed results.
* **UI Updates**
* Unified Logs filter bar and reset behavior now include clearing the
user filter.
* Improved empty-state messaging when the selected user filter isn’t
supported.
  * Refreshed highlighted styling in command list items.
* **Tests**
* Expanded coverage for user filter configuration and query edge cases.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: kemal.earth <606977+kemaldotearth@users.noreply.github.com>
Co-authored-by: kemal <hello@kemal.earth>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-07-17 17:21:55 +08:00

37 lines
1.1 KiB
TypeScript

import { X } from 'lucide-react'
import { Button } from 'ui'
import { useDataTable } from './providers/DataTableProvider'
import { ShortcutTooltip } from '@/components/ui/ShortcutTooltip'
import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
import { useShortcut } from '@/state/shortcuts/useShortcut'
export interface DataTableResetButtonProps {
/** Called alongside `table.resetColumnFilters()` — for filters that live outside TanStack Table's columnFilters state (e.g. a cross-cutting URL param). */
onReset?: () => void
}
export function DataTableResetButton({ onReset }: DataTableResetButtonProps) {
const { table } = useDataTable()
const reset = () => {
table.resetColumnFilters()
onReset?.()
}
useShortcut(SHORTCUT_IDS.DATA_TABLE_RESET_FILTERS, reset, {
registerInCommandMenu: true,
})
return (
<ShortcutTooltip
shortcutId={SHORTCUT_IDS.DATA_TABLE_RESET_FILTERS}
label="Reset filters"
side="left"
>
<Button variant="default" size="tiny" onClick={reset} icon={<X />}>
Reset
</Button>
</ShortcutTooltip>
)
}