Files
supabase/apps/studio/routes/project/$ref/logs/dedicated-pooler-logs.tsx
Alaister YoungandAlaister Young 96e4543ea9 [FE-3106] (part 9) – refactor(studio): move logs and observability page bodies (#53218)
Moves the `/logs/*` and `/observability/*` page bodies into their route
files and deletes the pages (FE-3106). Part 9 of the stack.

**Depends on:** #53217

**Changed:**
- `routes/project/$ref/logs/**` – 20 page bodies inlined. `logs/index`
keeps its `withAuth` wrapper; `replication-logs` redirects with
`<Navigate search hash>`; the Logs Explorer save navigates with `search:
{ queryId }` (never a query inside `to`)
- `routes/project/$ref/observability/**` – 12 page bodies inlined; chart
highlight actions navigate with `search` params
- `components/interfaces/Observability/DatabaseReport.hooks.ts` – the
database report's URL hooks move out of the page (with their test)
- `components/ui/Charts/ComposedChartHandler.tsx` – imports
`UpdateDateRange` from `ChartHighlightActions` instead of a page

**Removed:**
- 32 page files

Addresses
[FE-3106](https://linear.app/supabase/issue/FE-3106/move-page-bodies-into-route-files-and-delete-pages).

## To test

- Logs Explorer: run a multi-line query, save it – the URL keeps
newlines and the saved query reopens
- Each log source (Postgres, Auth, Edge, Storage, Realtime, …) – same
layout and title
- Observability reports – charts render; highlighting a range links to
the right logs page

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-17 16:24:24 +09:00

41 lines
1.3 KiB
TypeScript

import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { useEffect } from 'react'
import { LogoLoader } from 'ui'
import { LogsTableName } from '@/components/interfaces/Settings/Logs/Logs.constants'
import { LogsPreviewer } from '@/components/interfaces/Settings/Logs/LogsPreviewer'
import { useCheckEntitlements } from '@/hooks/misc/useCheckEntitlements'
export const Route = createFileRoute('/project/$ref/logs/dedicated-pooler-logs')({
component: LogPage,
staticData: { logsLayoutTitle: 'Dedicated Pooler Logs' },
})
function LogPage() {
const navigate = useNavigate()
const { ref } = Route.useParams()
const { hasAccess: hasDedicatedPooler, isLoading: isLoadingEntitlement } =
useCheckEntitlements('dedicated_pooler')
useEffect(() => {
// Redirect to pooler logs if org is not entitled to dedicated pooler
if (!isLoadingEntitlement && !hasDedicatedPooler) {
void navigate({ to: '/project/$ref/logs/pooler-logs', params: { ref } })
}
}, [hasDedicatedPooler, isLoadingEntitlement, ref, navigate])
// Prevent showing logs while checking entitlement
if (isLoadingEntitlement || !hasDedicatedPooler) {
return <LogoLoader />
}
return (
<LogsPreviewer
projectRef={ref}
condensedLayout={true}
tableName={LogsTableName.PGBOUNCER}
queryType={'pgbouncer'}
/>
)
}