mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
Part 3 of a 6-PR stack migrating all `next/link` imports in `apps/studio` onto TanStack Router's `Link` (or plain `<a>` for known external URLs) and removing `compat/next/link.tsx`. | Part | PR | Scope | | --- | --- | --- | | 1 | #54304 | `data/prefetchers/PrefetchableLink.tsx` and `components/ui/**` | | 2 | #54305 | `components/layouts/**` and top-level shell components | | **3** | **#54306 ← this PR** | **Database, TableGridEditor, Storage, SQLEditor, BranchManagement, Branching, Functions, Realtime** | | 4 | #54307 | Integrations, Settings, Observability, LogDrains, Issues, Linter, Reports, QueryPerformance, QuerySources, ConfigDrift, DiskManagement, Compute | | 5 | #54308 | Remaining `components/interfaces/**` (Org, Billing, Auth, Support, Home, SignIn, ConnectSheet, etc.) | | 6 | #54309 | Remove `compat/next/link.tsx` shim, Vite alias, and update basePath tests/docs | Migrates `components/interfaces/{Database,TableGridEditor,Storage,SQLEditor,BranchManagement,Branching,Functions,Realtime}/` off `next/link`. **Changed:** - Replaced `next/link` across all 60 importing files in Database, TableGridEditor, Storage, SQLEditor, BranchManagement, Branching, Functions, and Realtime interfaces - Updated legacy permanent-redirect hrefs (`/reports` → `/observability`, `/database/schema` → `/database/schemas`) to their canonical TanStack routes - Dropped legacy `passHref` in `GridHeaderActions.tsx`, removed duplicate `RouterLink` alias in `ChooseFunctionForm.tsx`, and removed `vi.mock('next/link', ...)` in `ReplicationPipelineLayout.test.tsx` Addresses [FE-5108](https://linear.app/supabase/issue/FE-5108/replace-the-nextlink-shim-with-tanstack-link) ## To test - [ ] Check Table Editor, SQL Editor, Database (tables, policies, functions, triggers, replication, backups), Storage (files/analytics/vector buckets), Edge Functions, Branching, and Realtime links - [ ] Verify SQL Editor and Table Editor links with query parameters (`schema`, `content`, `search`) do not double-encode values --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
import { useFlag, useParams } from 'common'
|
|
import { UnlockIcon } from 'lucide-react'
|
|
import { Button, Popover, PopoverContent, PopoverTrigger } from 'ui'
|
|
|
|
import { DynamicLink } from '@/components/ui/DynamicLink'
|
|
import { type Lint } from '@/data/lint/lint-query'
|
|
|
|
export const SecurityDefinerViewPopover = ({
|
|
lint,
|
|
onAutofix,
|
|
}: {
|
|
lint: Lint | null
|
|
onAutofix?: () => void
|
|
}) => {
|
|
const { ref } = useParams()
|
|
const isIssuesInboxEnabled = useFlag('issuesInbox')
|
|
|
|
return (
|
|
<Popover modal={false}>
|
|
<PopoverTrigger asChild>
|
|
<Button variant="warning" icon={<UnlockIcon strokeWidth={1.5} />}>
|
|
Security Definer view
|
|
</Button>
|
|
</PopoverTrigger>
|
|
<PopoverContent className="min-w-[395px] text-sm" align="end">
|
|
<h4 className="flex items-center gap-2">
|
|
<UnlockIcon size={14} /> Secure your view
|
|
</h4>
|
|
<div className="grid gap-2 mt-2 text-foreground-light text-sm">
|
|
<p>
|
|
This view is defined with the Security Definer property, giving it permissions of the
|
|
view's creator (Postgres), rather than the permissions of the querying user.
|
|
</p>
|
|
|
|
<p>Since this view is in the public schema, it is accessible via your project's APIs.</p>
|
|
|
|
<div className="mt-2 flex items-center gap-2">
|
|
{!!onAutofix && (
|
|
<Button variant="secondary" onClick={onAutofix}>
|
|
Autofix
|
|
</Button>
|
|
)}
|
|
<Button asChild>
|
|
<DynamicLink
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
href={
|
|
isIssuesInboxEnabled
|
|
? `/project/${ref}/issues/${lint?.name}`
|
|
: `/project/${ref}/advisors/security?preset=${lint?.level}&id=${lint?.cache_key}`
|
|
}
|
|
>
|
|
Learn more
|
|
</DynamicLink>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</PopoverContent>
|
|
</Popover>
|
|
)
|
|
}
|