mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
## Context Previous PR was [here](https://github.com/supabase/supabase/pull/45143) but it got stale with lots of conflicts so figured it'll be easier redo it off the latest master Moves policies page from Auth to Database under an Access Control section along with Roles. This moves all existing files, applies redirects, and updates urls to point to the new route <img width="274" height="412" alt="image" src="https://github.com/user-attachments/assets/7952c185-64ae-4355-ba36-45397efe1787" /> <img width="453" height="471" alt="image" src="https://github.com/user-attachments/assets/04b3dcb3-48a5-4049-9893-d01109fb46a9" /> ## To test - [ ] Verify that policies now live under Database correctly <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a quick navigation shortcut to open **Database > Policies (RLS)**. * **Bug Fixes** * Updated Policies and RLS-related links across the product to open the **Database policies** area (menus, command palette, context actions, alerts, and link-outs). * Added a permanent redirect from the old **auth policies** URL to the new **database policies** URL. * **Documentation** * Updated RLS Dashboard and security checklist instructions to reference **Database > Policies**. * **Tests** * Adjusted automated tests to validate the new Policies route. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { UntrustedSqlFragment } from '@supabase/pg-meta'
|
|
import { Loader2 } from 'lucide-react'
|
|
import { Badge, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
|
|
|
|
import { CodeEditor } from '@/components/ui/CodeEditor/CodeEditor'
|
|
|
|
export const InferredSQLViewer = ({
|
|
sql,
|
|
isLoading = false,
|
|
}: {
|
|
sql: UntrustedSqlFragment | undefined
|
|
isLoading?: boolean
|
|
}) => {
|
|
return (
|
|
<>
|
|
<div className="flex items-center justify-between px-4 py-2">
|
|
<div className="flex items-center gap-x-2">
|
|
<p className="text-sm">Inferred SQL:</p>
|
|
{isLoading && <Loader2 size={14} className="animate-spin text-foreground-lighter" />}
|
|
</div>
|
|
<div className="flex items-center gap-x-2">
|
|
<Tooltip>
|
|
<TooltipTrigger>
|
|
<Badge variant="warning">Generated</Badge>
|
|
</TooltipTrigger>
|
|
<TooltipContent side="bottom" align="end" className="w-64 text-center">
|
|
This query is inferred from client library code with the help of the Assistant and may
|
|
not guarantee correctness.
|
|
</TooltipContent>
|
|
</Tooltip>
|
|
</div>
|
|
</div>
|
|
<div className="h-44 relative">
|
|
{isLoading && !sql ? (
|
|
<div className="flex h-full items-center justify-center bg-surface-100 text-foreground-lighter">
|
|
<Loader2 size={20} className="animate-spin" />
|
|
</div>
|
|
) : (
|
|
<CodeEditor isReadOnly id="inferred-sql" language="pgsql" value={sql ?? ''} />
|
|
)}
|
|
</div>
|
|
</>
|
|
)
|
|
}
|