The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Chore/table header simplification (#29963)
Terry Sutton7c28989d83fe
diff --git a/apps/studio/components/grid/components/grid/Grid.tsx b/apps/studio/components/grid/components/grid/Grid.tsxindex 6e2a755930c..a48ce79e7c8 100644--- a/apps/studio/components/grid/components/grid/Grid.tsx+++ b/apps/studio/components/grid/components/grid/Grid.tsx@@ -228,7 +228,7 @@ export const Grid = memo(className="flex flex-col items-center justify-center col-span-full"><p className="text-sm text-light">- The filters applied has returned no results from this table+ The filters applied have returned no results from this table</p><div className="flex items-center space-x-2 mt-4"><Button type="default" onClick={() => removeAllFilters()}>diff --git a/apps/studio/components/grid/components/grid/SelectColumn.tsx b/apps/studio/components/grid/components/grid/SelectColumn.tsxindex 4297778799a..7d5fd336c21 100644--- a/apps/studio/components/grid/components/grid/SelectColumn.tsx+++ b/apps/studio/components/grid/components/grid/SelectColumn.tsx@@ -1,6 +1,6 @@import * as Tooltip from '@radix-ui/react-tooltip'import { Maximize2 } from 'lucide-react'-import { ChangeEvent, InputHTMLAttributes, SyntheticEvent } from 'react'+import { ChangeEvent, InputHTMLAttributes, SyntheticEvent, useEffect, useRef } from 'react'import {CalculatedColumn,RenderCellProps,@@ -144,10 +144,9 @@ function SelectCellFormatter({<Buttontype="text"size="tiny"- className="rdg-row__select-column__edit-action"+ className="px-1 rdg-row__select-column__edit-action"icon={<Maximize2 />}onClick={onEditClick}- style={{ padding: '3px' }}/></Tooltip.Trigger><Tooltip.Portal>@@ -183,6 +182,19 @@ function SelectCellHeader({'aria-label': ariaLabel,'aria-labelledby': ariaLabelledBy,}: SelectCellHeaderProps) {+ const state = useTrackedState()+ const { selectedRows, allRowsSelected } = state+ const inputRef = useRef<HTMLInputElement>(null)++ // indeterminate state === some rows are selected but not all+ const isIndeterminate = selectedRows.size > 0 && !allRowsSelected++ useEffect(() => {+ if (inputRef.current) {+ inputRef.current.indeterminate = isIndeterminate+ }+ }, [isIndeterminate])+function handleChange(e: ChangeEvent<HTMLInputElement>) {onChange(e.target.checked, (e.nativeEvent as MouseEvent).shiftKey)}@@ -190,6 +202,7 @@ function SelectCellHeader({return (<div className="sb-grid-select-cell__header"><input+ ref={inputRef}aria-label={ariaLabel}aria-labelledby={ariaLabelledBy}tabIndex={tabIndex}diff --git a/apps/studio/components/grid/components/header/Header.tsx b/apps/studio/components/grid/components/header/Header.tsxindex 92284848f54..8c27ee6a097 100644--- a/apps/studio/components/grid/components/header/Header.tsx+++ b/apps/studio/components/grid/components/header/Header.tsx@@ -1,16 +1,17 @@-import * as Tooltip from '@radix-ui/react-tooltip'import { PermissionAction } from '@supabase/shared-types/out/constants'import clsx from 'clsx'import saveAs from 'file-saver'-import { ArrowUp, ChevronDown, Download, FileText, Trash, X } from 'lucide-react'+import { ArrowUp, ChevronDown, FileText, Trash } from 'lucide-react'import Papa from 'papaparse'import { ReactNode, useState } from 'react'import { toast } from 'sonner'import { useDispatch, useTrackedState } from 'components/grid/store/Store'import type { Filter, Sort, SupaTable } from 'components/grid/types'+import { Markdown } from 'components/interfaces/Markdown'import { formatTableRowsToSQL } from 'components/interfaces/TableGridEditor/TableEntity.utils'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'+import { ButtonTooltip } from 'components/ui/ButtonTooltip'import { useTableRowsCountQuery } from 'data/table-rows/table-rows-count-query'import { fetchAllTableRows, useTableRowsQuery } from 'data/table-rows/table-rows-query'import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'@@ -27,10 +28,10 @@ import {DropdownMenuContent,DropdownMenuItem,DropdownMenuTrigger,+ Separator,} from 'ui'import FilterPopover from './filter/FilterPopover'import { SortPopover } from './sort'-import { Markdown } from 'components/interfaces/Markdown'// [Joshen] CSV exports require this guard as a fail-safe if the table is// just too large for a browser to keep all the rows in memory before@@ -64,7 +65,7 @@ const Header = ({return (<div>- <div className="flex h-10 items-center justify-between bg-dash-sidebar px-5 py-1.5 gap-2 overflow-x-auto">+ <div className="flex h-10 items-center justify-between bg-dash-sidebar px-1.5 py-1.5 gap-2 overflow-x-auto">{customHeader ? (<>{customHeader}</>) : (@@ -113,7 +114,7 @@ const DefaultHeader = ({ table, onAddColumn, onAddRow, onImportData }: DefaultHe</div>{canAddNew && (<>- <div className="h-[20px] w-px border-r border-control"></div>+ <div className="h-[20px] w-px border-r border-control" /><div className="flex items-center gap-2">{canCreateColumns && (<DropdownMenu>@@ -376,82 +377,63 @@ const RowHeader = ({ table, sorts, filters }: RowHeaderProps) => {})return (- <div className="flex items-center gap-4">- <div className="flex items-center gap-3">- <Button type="default" className="px-1" icon={<X />} onClick={deselectRows} />- <span className="text-xs text-foreground">- {allRowsSelected- ? `All rows in table selected`- : selectedRows.size > 1- ? `${selectedRows.size} rows selected`- : `${selectedRows.size} row selected`}- </span>- {!allRowsSelected && totalRows > allRows.length && (- <Button type="link" onClick={() => onSelectAllRows()}>- Select all rows in table- </Button>- )}- </div>- <div className="h-[20px] border-r border-strong" />- <div className="flex items-center gap-2">- <DropdownMenu>- <DropdownMenuTrigger>- <Button- type="primary"- size="tiny"- icon={<Download />}- loading={isExporting}- disabled={isExporting}- >- Export- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent className="w-40">- <DropdownMenuItem onClick={onRowsExportCSV}>- <span className="text-foreground-light">Export to CSV</span>- </DropdownMenuItem>- <DropdownMenuItem onClick={onRowsExportSQL}>Export to SQL</DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>-- {editable && (- <Tooltip.Root delayDuration={0}>- <Tooltip.Trigger asChild>+ <div className="flex items-center gap-x-2">+ {editable && (+ <>+ <ButtonTooltip+ type="default"+ size="tiny"+ icon={<Trash />}+ onClick={onRowsDelete}+ disabled={allRowsSelected && isImpersonatingRole}+ tooltip={{+ content: {+ side: 'bottom',+ text:+ allRowsSelected && isImpersonatingRole+ ? 'Table truncation is not supported when impersonating a role'+ : undefined,+ },+ }}+ >+ {allRowsSelected+ ? `Delete all rows in table`+ : selectedRows.size > 1+ ? `Delete ${selectedRows.size} rows`+ : `Delete ${selectedRows.size} row`}+ </ButtonTooltip>+ <DropdownMenu>+ <DropdownMenuTrigger asChild><Buttontype="default"size="tiny"- icon={<Trash />}- onClick={onRowsDelete}- disabled={allRowsSelected && isImpersonatingRole}+ iconRight={<ChevronDown />}+ loading={isExporting}+ disabled={isExporting}>- {allRowsSelected- ? `Delete all rows in table`- : selectedRows.size > 1- ? `Delete ${selectedRows.size} rows`- : `Delete ${selectedRows.size} row`}+ Export</Button>- </Tooltip.Trigger>-- {allRowsSelected && isImpersonatingRole && (- <Tooltip.Portal>- <Tooltip.Content side="bottom">- <Tooltip.Arrow className="radix-tooltip-arrow" />- <div- className={[- 'rounded bg-alternative py-1 px-2 leading-none shadow',- 'border border-background',- ].join(' ')}- >- <span className="text-xs text-foreground">- Table truncation is not supported when impersonating a role- </span>- </div>- </Tooltip.Content>- </Tooltip.Portal>- )}- </Tooltip.Root>- )}- </div>+ </DropdownMenuTrigger>+ <DropdownMenuContent className="w-40">+ <DropdownMenuItem onClick={onRowsExportCSV}>+ <span className="text-foreground-light">Export to CSV</span>+ </DropdownMenuItem>+ <DropdownMenuItem onClick={onRowsExportSQL}>Export to SQL</DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>++ {!allRowsSelected && totalRows > allRows.length && (+ <>+ <div className="h-6 ml-0.5">+ <Separator orientation="vertical" />+ </div>+ <Button type="text" onClick={() => onSelectAllRows()}>+ Select all rows in table+ </Button>+ </>+ )}+ </>+ )}</div>)}diff --git a/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyRow.tsx b/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyRow.tsxindex 9944a44b4c4..d6607237fea 100644--- a/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyRow.tsx+++ b/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyRow.tsx@@ -11,6 +11,7 @@ import { Edit, MoreVertical, Trash } from 'lucide-react'import {Badge,Button,+ cn,DropdownMenu,DropdownMenuContent,DropdownMenuItem,@@ -45,8 +46,9 @@ const PolicyRow = ({return (<Panel.Content- className={['flex border-overlay', 'w-full space-x-4 border-b py-4 lg:items-center'].join(- ' '+ className={cn(+ 'flex border-overlay',+ 'w-full last:border-0 space-x-4 border-b py-4 lg:items-center')}><div className="flex grow flex-col space-y-1">diff --git a/apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx b/apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsxindex d007c019e02..68a397a6be9 100644--- a/apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx+++ b/apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx@@ -1,4 +1,3 @@-import * as Tooltip from '@radix-ui/react-tooltip'import type { PostgresTable } from '@supabase/postgres-meta'import { PermissionAction } from '@supabase/shared-types/out/constants'import { useParams } from 'common'@@ -7,9 +6,11 @@ import Link from 'next/link'import { useState } from 'react'import { toast } from 'sonner'+import { useTrackedState } from 'components/grid/store/Store'import { getEntityLintDetails } from 'components/interfaces/TableGridEditor/TableEntity.utils'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'import APIDocsButton from 'components/ui/APIDocsButton'+import { ButtonTooltip } from 'components/ui/ButtonTooltip'import { useDatabasePoliciesQuery } from 'data/database-policies/database-policies-query'import { useDatabasePublicationsQuery } from 'data/database-publications/database-publications-query'import { useDatabasePublicationUpdateMutation } from 'data/database-publications/database-publications-update-mutation'@@ -20,7 +21,16 @@ import { useTableUpdateMutation } from 'data/tables/table-update-mutation'import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'-import { Button, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, Popover_Shadcn_, cn } from 'ui'+import {+ Button,+ PopoverContent_Shadcn_,+ PopoverTrigger_Shadcn_,+ Popover_Shadcn_,+ TooltipContent_Shadcn_,+ TooltipTrigger_Shadcn_,+ Tooltip_Shadcn_,+ cn,+} from 'ui'import ConfirmModal from 'ui-patterns/Dialogs/ConfirmDialog'import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'import { RoleImpersonationPopover } from '../RoleImpersonationSelector'@@ -64,6 +74,10 @@ const GridHeaderActions = ({ table, entityType }: GridHeaderActionsProps) => {const [open, setOpen] = useState(false)const [rlsConfirmModalOpen, setRlsConfirmModalOpen] = useState(false)+ const state = useTrackedState()+ const { selectedRows } = state+ const showHeaderActions = selectedRows.size === 0+const projectRef = project?.refconst { data } = useDatabasePoliciesQuery({projectRef: project?.ref,@@ -157,258 +171,234 @@ const GridHeaderActions = ({ table, entityType }: GridHeaderActionsProps) => {return (<>- <div className="flex items-center gap-2">- {isReadOnly && (- <Tooltip.Root delayDuration={0}>- <Tooltip.Trigger className="w-full">- <div className="border border-strong rounded bg-overlay-hover px-3 py-1 text-xs">- Viewing as read-only- </div>- </Tooltip.Trigger>- <Tooltip.Portal>- <Tooltip.Content side="bottom">- <Tooltip.Arrow className="radix-tooltip-arrow" />- <div- className={[- 'rounded bg-alternative py-1 px-2 leading-none shadow',- 'border border-background',- ].join(' ')}- >- <span className="text-xs text-foreground">- You need additional permissions to manage your project's data- </span>+ {showHeaderActions && (+ <div className="flex items-center gap-x-2">+ {isReadOnly && (+ <Tooltip_Shadcn_>+ <TooltipTrigger_Shadcn_ asChild>+ <div className="border border-strong rounded bg-overlay-hover px-3 py-1 text-xs">+ Viewing as read-only</div>- </Tooltip.Content>- </Tooltip.Portal>- </Tooltip.Root>- )}-- {isTable ? (- (table as PostgresTable).rls_enabled ? (- <>- {policies.length < 1 && !isLocked ? (- <Tooltip.Root delayDuration={0}>- <Tooltip.Trigger asChild className="w-full">- <Button- asChild- type="default"- className="group"- icon={<PlusCircle strokeWidth={1.5} className="text-foreground-muted" />}+ </TooltipTrigger_Shadcn_>+ <TooltipContent_Shadcn_ side="bottom">+ You need additional permissions to manage your project's data+ </TooltipContent_Shadcn_>+ </Tooltip_Shadcn_>+ )}+ {isTable ? (+ (table as PostgresTable).rls_enabled ? (+ <>+ {policies.length < 1 && !isLocked ? (+ <ButtonTooltip+ asChild+ type="default"+ className="group"+ icon={<PlusCircle strokeWidth={1.5} className="text-foreground-muted" />}+ tooltip={{+ content: {+ side: 'bottom',+ className: 'w-[280px]',+ text: 'RLS is enabled for this table, but no policies are set. Select queries may return 0 results.',+ },+ }}+ >+ <Link+ passHref+ href={`/project/${projectRef}/auth/policies?search=${table.id}&schema=${table.schema}`}>- <Link- passHref- href={`/project/${projectRef}/auth/policies?search=${table.id}&schema=${table.schema}`}- >- Add RLS policy- </Link>- </Button>- </Tooltip.Trigger>- <Tooltip.Portal>- <Tooltip.Content side="bottom">- <Tooltip.Arrow className="radix-tooltip-arrow" />- <div- className={[- 'rounded bg-alternative py-1 px-2 leading-none shadow',- 'border border-background',- ].join(' ')}- >- <div className="text-xs text-foreground p-1 leading-relaxed">- <p>RLS is enabled for this table, but no policies are set. </p>- <p>Select queries may return 0 results.</p>+ Add RLS policy+ </Link>+ </ButtonTooltip>+ ) : (+ <Button+ asChild+ type={policies.length < 1 && !isLocked ? 'warning' : 'default'}+ className="group"+ icon={+ isLocked || policies.length > 0 ? (+ <div+ className={cn(+ 'flex items-center justify-center rounded-full bg-border-stronger h-[16px]',+ policies.length > 9 ? ' px-1' : 'w-[16px]',+ ''+ )}+ >+ <span className="text-[11px] text-foreground font-mono text-center">+ {policies.length}+ </span></div>- </div>- </Tooltip.Content>- </Tooltip.Portal>- </Tooltip.Root>- ) : (- <Button- asChild- type={policies.length < 1 && !isLocked ? 'warning' : 'default'}- className="group"- icon={- isLocked || policies.length > 0 ? (- <div- className={cn(- 'flex items-center justify-center rounded-full bg-border-stronger h-[16px]',- policies.length > 9 ? ' px-1' : 'w-[16px]',- ''- )}- >- <span className="text-[11px] text-foreground font-mono text-center">- {policies.length}- </span>- </div>- ) : (- <PlusCircle strokeWidth={1.5} />- )- }- >- <Link- passHref- href={`/project/${projectRef}/auth/policies?search=${table.id}&schema=${table.schema}`}+ ) : (+ <PlusCircle strokeWidth={1.5} />+ )+ }>- Auth {policies.length > 1 ? 'policies' : 'policy'}- </Link>- </Button>- )}- </>- ) : (+ <Link+ passHref+ href={`/project/${projectRef}/auth/policies?search=${table.id}&schema=${table.schema}`}+ >+ Auth {policies.length > 1 ? 'policies' : 'policy'}+ </Link>+ </Button>+ )}+ </>+ ) : (+ <Popover_Shadcn_ open={open} onOpenChange={() => setOpen(!open)} modal={false}>+ <PopoverTrigger_Shadcn_ asChild>+ <Button type="warning" icon={<Lock strokeWidth={1.5} />}>+ RLS disabled+ </Button>+ </PopoverTrigger_Shadcn_>+ <PopoverContent_Shadcn_ className="min-w-[395px] text-sm" align="end">+ <h3 className="flex items-center gap-2">+ <Lock size={16} /> Row Level Security (RLS)+ </h3>+ <div className="grid gap-2 mt-4 text-foreground-light text-sm">+ <p>+ You can restrict and control who can read, write and update data in this table+ using Row Level Security.+ </p>+ <p>+ With RLS enabled, anonymous users will not be able to read/write data in the+ table.+ </p>+ {!isLocked && (+ <div className="mt-2">+ <Button+ type="default"+ onClick={() => setRlsConfirmModalOpen(!rlsConfirmModalOpen)}+ >+ Enable RLS for this table+ </Button>+ </div>+ )}+ </div>+ </PopoverContent_Shadcn_>+ </Popover_Shadcn_>+ )+ ) : null}+ {isView && viewHasLints && (<Popover_Shadcn_ open={open} onOpenChange={() => setOpen(!open)} modal={false}><PopoverTrigger_Shadcn_ asChild>- <Button type="warning" icon={<Lock strokeWidth={1.5} />}>- RLS disabled+ <Button type="warning" icon={<Unlock strokeWidth={1.5} />}>+ Security Definer view</Button></PopoverTrigger_Shadcn_><PopoverContent_Shadcn_ className="min-w-[395px] text-sm" align="end"><h3 className="flex items-center gap-2">- <Lock size={16} /> Row Level Security (RLS)+ <Unlock size={16} /> Secure your View</h3><div className="grid gap-2 mt-4 text-foreground-light text-sm"><p>- You can restrict and control who can read, write and update data in this table- using Row Level Security.+ 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>- With RLS enabled, anonymous users will not be able to read/write data in the- table.+ Since this view is in the public schema, it is accessible via your project's+ APIs.</p>- {!isLocked && (- <div className="mt-2">- <Button- type="default"- onClick={() => setRlsConfirmModalOpen(!rlsConfirmModalOpen)}++ <div className="mt-2">+ <Button type="default" asChild>+ <Link+ target="_blank"+ href={`/project/${ref}/advisors/security?preset=${matchingViewLint?.level}&id=${matchingViewLint?.cache_key}`}>- Enable RLS for this table- </Button>- </div>- )}+ Learn more+ </Link>+ </Button>+ </div></div></PopoverContent_Shadcn_></Popover_Shadcn_>- )- ) : null}-- {isView && viewHasLints && (- <Popover_Shadcn_ open={open} onOpenChange={() => setOpen(!open)} modal={false}>- <PopoverTrigger_Shadcn_ asChild>- <Button type="warning" icon={<Unlock strokeWidth={1.5} />}>- Security Definer view- </Button>- </PopoverTrigger_Shadcn_>- <PopoverContent_Shadcn_ className="min-w-[395px] text-sm" align="end">- <h3 className="flex items-center gap-2">- <Unlock size={16} /> Secure your View- </h3>- <div className="grid gap-2 mt-4 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">- <Button type="default" asChild>- <Link- target="_blank"- href={`/project/${ref}/advisors/security?preset=${matchingViewLint?.level}&id=${matchingViewLint?.cache_key}`}- >- Learn more- </Link>- </Button>- </div>- </div>- </PopoverContent_Shadcn_>- </Popover_Shadcn_>- )}-- {isMaterializedView && materializedViewHasLints && (- <Popover_Shadcn_ open={open} onOpenChange={() => setOpen(!open)} modal={false}>- <PopoverTrigger_Shadcn_ asChild>- <Button type="warning" icon={<Unlock strokeWidth={1.5} />}>- Security Definer view- </Button>- </PopoverTrigger_Shadcn_>- <PopoverContent_Shadcn_ className="min-w-[395px] text-sm" align="end">- <h3 className="flex items-center gap-2">- <Unlock size={16} /> Secure your View- </h3>- <div className="grid gap-2 mt-4 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>+ )}+ {isMaterializedView && materializedViewHasLints && (+ <Popover_Shadcn_ open={open} onOpenChange={() => setOpen(!open)} modal={false}>+ <PopoverTrigger_Shadcn_ asChild>+ <Button type="warning" icon={<Unlock strokeWidth={1.5} />}>+ Security Definer view+ </Button>+ </PopoverTrigger_Shadcn_>+ <PopoverContent_Shadcn_ className="min-w-[395px] text-sm" align="end">+ <h3 className="flex items-center gap-2">+ <Unlock size={16} /> Secure your View+ </h3>+ <div className="grid gap-2 mt-4 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>+ <p>+ Since this view is in the public schema, it is accessible via your project's+ APIs.+ </p>- <div className="mt-2">- <Button type="default" asChild>- <Link- target="_blank"- href={`/project/${ref}/advisors/security?preset=${matchingMaterializedViewLint?.level}&id=${matchingMaterializedViewLint?.cache_key}`}- >- Learn more- </Link>- </Button>+ <div className="mt-2">+ <Button type="default" asChild>+ <Link+ target="_blank"+ href={`/project/${ref}/advisors/security?preset=${matchingMaterializedViewLint?.level}&id=${matchingMaterializedViewLint?.cache_key}`}+ >+ Learn more+ </Link>+ </Button>+ </div></div>- </div>- </PopoverContent_Shadcn_>- </Popover_Shadcn_>- )}-- {isForeignTable && entityType.schema === 'public' && (- <Popover_Shadcn_ open={open} onOpenChange={() => setOpen(!open)} modal={false}>- <PopoverTrigger_Shadcn_ asChild>- <Button type="warning" icon={<Unlock strokeWidth={1.5} />}>- Foreign table is accessible via your project's APIs- </Button>- </PopoverTrigger_Shadcn_>- <PopoverContent_Shadcn_ className="min-w-[395px] text-sm" align="end">- <h3 className="flex items-center gap-2">- <Unlock size={16} /> Secure Foreign table- </h3>- <div className="grid gap-2 mt-4 text-foreground-light text-sm">- <p>- Foreign tables do not enforce RLS. Move them to a private schema not exposed to- Postgrest or disable Postgrest.- </p>+ </PopoverContent_Shadcn_>+ </Popover_Shadcn_>+ )}+ {isForeignTable && entityType.schema === 'public' && (+ <Popover_Shadcn_ open={open} onOpenChange={() => setOpen(!open)} modal={false}>+ <PopoverTrigger_Shadcn_ asChild>+ <Button type="warning" icon={<Unlock strokeWidth={1.5} />}>+ Foreign table is accessible via your project's APIs+ </Button>+ </PopoverTrigger_Shadcn_>+ <PopoverContent_Shadcn_ className="min-w-[395px] text-sm" align="end">+ <h3 className="flex items-center gap-2">+ <Unlock size={16} /> Secure Foreign table+ </h3>+ <div className="grid gap-2 mt-4 text-foreground-light text-sm">+ <p>+ Foreign tables do not enforce RLS. Move them to a private schema not exposed to+ Postgrest or disable Postgrest.+ </p>- <div className="mt-2">- <Button type="default" asChild>- <Link target="_blank" href="https://github.com/orgs/supabase/discussions/21647">- Learn more- </Link>- </Button>+ <div className="mt-2">+ <Button type="default" asChild>+ <Link+ target="_blank"+ href="https://github.com/orgs/supabase/discussions/21647"+ >+ Learn more+ </Link>+ </Button>+ </div></div>- </div>- </PopoverContent_Shadcn_>- </Popover_Shadcn_>- )}-- <RoleImpersonationPopover serviceRoleLabel="postgres" />-- {isTable && realtimeEnabled && (- <Button- type="default"- icon={- <MousePointer2- strokeWidth={1.5}- className={isRealtimeEnabled ? 'text-brand' : 'text-foreground-muted'}- />- }- onClick={() => setShowEnableRealtime(true)}- >- Realtime {isRealtimeEnabled ? 'on' : 'off'}- </Button>- )}-- {doesHaveAutoGeneratedAPIDocs && <APIDocsButton section={['entities', table.name]} />}- </div>-+ </PopoverContent_Shadcn_>+ </Popover_Shadcn_>+ )}+ <RoleImpersonationPopover serviceRoleLabel="postgres" />+ {isTable && realtimeEnabled && (+ <Button+ type="default"+ icon={+ <MousePointer2+ strokeWidth={1.5}+ className={isRealtimeEnabled ? 'text-brand' : 'text-foreground-muted'}+ />+ }+ onClick={() => setShowEnableRealtime(true)}+ >+ Realtime {isRealtimeEnabled ? 'on' : 'off'}+ </Button>+ )}+ {doesHaveAutoGeneratedAPIDocs && <APIDocsButton section={['entities', table.name]} />}+ </div>+ )}<ConfirmationModalvisible={showEnableRealtime}loading={isTogglingRealtime}@@ -434,7 +424,6 @@ const GridHeaderActions = ({ table, entityType }: GridHeaderActionsProps) => {)}</div></ConfirmationModal>-{entityType?.type === ENTITY_TYPE.TABLE && (<ConfirmModaldanger={(table as PostgresTable).rls_enabled}diff --git a/apps/studio/styles/grid.scss b/apps/studio/styles/grid.scssindex 3b4c378004e..b9def4926a9 100644--- a/apps/studio/styles/grid.scss+++ b/apps/studio/styles/grid.scss@@ -174,6 +174,15 @@background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='hsl(0, 0%, 100%)'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E") !important;}+ [type='checkbox']:indeterminate {+ @apply bg-foreground;+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='hsl(0, 0%, 100%)'%3E%3Crect x='3' y='7' width='10' height='2'/%3E%3C/svg%3E") !important;++ [data-theme='dark'] & {+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='hsl(0, 0%, 0%)'%3E%3Crect x='3' y='7' width='10' height='2'/%3E%3C/svg%3E") !important;+ }+ }+[type='checkbox'] {@apply cursor-pointer rounded border border-solid;