Merge pull request #6551 from supabase/feat/rls-link-when-enabled

Add a link to the RLS settings page when RLS is enabled
This commit is contained in:
Joshen Lim authored and GitHub committed 2022-05-04 21:22:01 +08:00
commit 0f34aafdde
2 files changed
+8 -13

No files matched your search

@@ -1,6 +1,6 @@
import { FC } from 'react'
import Link from 'next/link'
import { Badge, Button, IconAlertCircle, Typography } from '@supabase/ui'
import { Button, IconAlertCircle, IconLock } from '@supabase/ui'
import { PostgresTable } from '@supabase/postgres-meta'
import { useStore } from 'hooks'
@@ -16,18 +16,13 @@ const GridHeaderActions: FC<Props> = ({ table }) => {
return (
<div className="space-x-3 flex items-center">
{!table.rls_enabled && (
<Link href={urlToRLSPolicies}>
<Button type="warning" icon={<IconAlertCircle strokeWidth={2} size={14} />}>
RLS not enabled
<Link href={urlToRLSPolicies}>
<Button
type={table.rls_enabled ? 'link' : 'warning'}
icon={table.rls_enabled ? <IconLock strokeWidth={2} size={14} /> : <IconAlertCircle strokeWidth={2} size={14} />}>
RLS {table.rls_enabled ? 'is' : 'not'} enabled
</Button>
</Link>
)}
{/* <Button type="text">
<Typography.Text small code>
Shortcuts
</Typography.Text>
</Button> */}
</Link>
</div>
)
}
@@ -139,7 +139,7 @@ const TableGridEditor: FC<Props> = ({
schema={selectedTable.schema}
table={gridTable}
headerActions={
!isViewSelected && <GridHeaderActions table={selectedTable as PostgresTable} />
!isViewSelected && selectedTable.schema === 'public' && <GridHeaderActions table={selectedTable as PostgresTable} />
}
onAddColumn={onAddColumn}
onEditColumn={onSelectEditColumn}