Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Standardize page layouts across all database pages

Joshen Lim5d9cb05f8211
diff --git a/studio/components/interfaces/Database/Extensions/ExtensionCard.tsx b/studio/components/interfaces/Database/Extensions/ExtensionCard.tsx
index e1b8e396fde..9e349b287fc 100644
--- a/studio/components/interfaces/Database/Extensions/ExtensionCard.tsx
+++ b/studio/components/interfaces/Database/Extensions/ExtensionCard.tsx
@@ -73,13 +73,13 @@ const ExtensionCard = ({ extension }: ExtensionCardProps) => {
<div
className={[
'border-panel-border-light bg-panel-header-light dark:bg-panel-header-dark',
- 'flex justify-between w-full border-b p-4 px-6 dark:border-panel-border-dark',
+ 'flex justify-between w-full border-b py-3 px-4 dark:border-panel-border-dark',
].join(' ')}
>
- <div className="flex items-center gap-1">
+ <div className="flex items-center gap-1 max-w-[85%]">
<h3
title={extension.name}
- className="h-5 m-0 text-base uppercase truncate cursor-pointer text-scale-1200"
+ className="h-5 m-0 text-sm uppercase truncate cursor-pointer text-scale-1200"
>
{extension.name}
</h3>
@@ -122,11 +122,11 @@ const ExtensionCard = ({ extension }: ExtensionCardProps) => {
'bg-panel-secondary-light dark:bg-panel-secondary-dark flex h-full flex-col justify-between',
].join(' ')}
>
- <div className="p-4 px-6">
+ <div className="py-3 px-4">
<p className="text-sm text-scale-1100 capitalize-sentence">{extension.comment}</p>
</div>
{isOn && extension.schema && (
- <div className="p-4 px-6">
+ <div className="py-3 px-4">
<div className="flex items-center flex-grow space-x-2 text-sm text-scale-1100">
<span>Schema:</span>
<Badge>{`${extension.schema}`}</Badge>
diff --git a/studio/components/interfaces/Database/Extensions/Extensions.tsx b/studio/components/interfaces/Database/Extensions/Extensions.tsx
index 5a958585e20..7837d60db08 100644
--- a/studio/components/interfaces/Database/Extensions/Extensions.tsx
+++ b/studio/components/interfaces/Database/Extensions/Extensions.tsx
@@ -39,7 +39,7 @@ const Extensions = () => {
}, [filter])
return (
- <div className="p-4">
+ <>
<div className="mb-4">
<div className="flex items-center justify-between">
<Input
@@ -76,7 +76,7 @@ const Extensions = () => {
{enabledExtensions.length > 0 && (
<div className="space-y-4">
<h4 className="text-lg">Enabled extensions</h4>
- <div className="mb-4 grid grid-cols-1 gap-6 md:grid-cols-2 xl:grid-cols-3">
+ <div className="mb-4 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3">
{enabledExtensions.map((extension) => (
<ExtensionCard key={extension.name} extension={extension} />
))}
@@ -87,7 +87,7 @@ const Extensions = () => {
{disabledExtensions.length > 0 && (
<div className="space-y-4">
<h4 className="text-lg">Available extensions</h4>
- <div className="mb-4 grid grid-cols-1 gap-6 md:grid-cols-2 xl:grid-cols-3">
+ <div className="mb-4 grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3">
{disabledExtensions.map((extension) => (
<ExtensionCard key={extension.name} extension={extension} />
))}
@@ -95,7 +95,7 @@ const Extensions = () => {
</div>
)}
</div>
- </div>
+ </>
)
}
diff --git a/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx b/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx
index 0ec8addd118..744ae63c80d 100644
--- a/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx
+++ b/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx
@@ -1,15 +1,17 @@
import * as Tooltip from '@radix-ui/react-tooltip'
import { PostgresFunction, PostgresSchema } from '@supabase/postgres-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
-import { includes, map as lodashMap, noop, partition, uniqBy } from 'lodash'
+import { noop, partition } from 'lodash'
import { observer } from 'mobx-react-lite'
import { useState } from 'react'
-import { Button, IconLoader, IconLock, IconSearch, Input, Listbox } from 'ui'
+import { Button, IconLock, IconSearch, Input, Listbox } from 'ui'
import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'
import Table from 'components/to-be-cleaned/Table'
+import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
import { useCheckPermissions, useStore } from 'hooks'
import FunctionList from './FunctionList'
+import AlertError from 'components/ui/AlertError'
interface FunctionsListProps {
createFunction: () => void
@@ -39,29 +41,14 @@ const FunctionsList = ({
const isLocked = protectedSchemas.some((s) => s.id === schema?.id)
const functions = meta.functions.list()
- const filteredFunctions = functions.filter(
- (x: PostgresFunction) =>
- x.schema === selectedSchema && includes(x.name?.toLowerCase(), filterString.toLowerCase())
- )
- const filteredFunctionSchemas = lodashMap(uniqBy(filteredFunctions, 'schema'), 'schema')
-
- console.log({ functions, filteredFunctions })
if (meta.functions.isLoading) {
- return (
- <div className="flex h-full w-full items-center justify-center space-x-2">
- <IconLoader className="animate-spin" size={14} />
- <p>Loading functions...</p>
- </div>
- )
+ return <GenericSkeletonLoader />
}
if (meta.functions.hasError) {
return (
- <p className="px-6 py-4">
- <p>Error connecting to API</p>
- <p>{`${meta.functions.error?.message ?? 'Unknown error'}`}</p>
- </p>
+ <AlertError error={meta.functions.error} subject="Failed to retrieve database functions" />
)
}
@@ -86,8 +73,8 @@ const FunctionsList = ({
</ProductEmptyState>
</div>
) : (
- <div className="w-full space-y-4 py-4">
- <div className="flex items-center justify-between px-4">
+ <div className="w-full space-y-4">
+ <div className="flex items-center justify-between">
<div className="flex items-center space-x-4">
<div className="w-[260px]">
<Listbox
@@ -173,7 +160,7 @@ const FunctionsList = ({
</div>
<Table
- className="table-fixed px-4"
+ className="table-fixed"
head={
<>
<Table.th key="name" className="w-1/3 space-x-4">
diff --git a/studio/components/interfaces/Database/Tables/TableList.tsx b/studio/components/interfaces/Database/Tables/TableList.tsx
index 31b8079ffa3..4e4cc3bc7e8 100644
--- a/studio/components/interfaces/Database/Tables/TableList.tsx
+++ b/studio/components/interfaces/Database/Tables/TableList.tsx
@@ -17,9 +17,8 @@ import {
Listbox,
} from 'ui'
-import NoSearchResults from 'components/to-be-cleaned/NoSearchResults'
import Table from 'components/to-be-cleaned/Table'
-import ShimmeringLoader from 'components/ui/ShimmeringLoader'
+import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
import { useCheckPermissions, useStore } from 'hooks'
interface TableListProps {
@@ -155,174 +154,174 @@ const TableList = ({
)}
</div>
- {isLoading ? (
- <div className="py-4 space-y-2">
- <ShimmeringLoader />
- <ShimmeringLoader className="w-3/4" />
- <ShimmeringLoader className="w-1/2" />
- </div>
- ) : (
- <div className="my-4 w-full">
- <Table
- head={[
- <Table.th key="name">Name</Table.th>,
- <Table.th key="description" className="hidden lg:table-cell">
- Description
- </Table.th>,
- <Table.th key="rows" className="hidden xl:table-cell">
- Rows (Estimated)
- </Table.th>,
- <Table.th key="size" className="hidden xl:table-cell">
- Size (Estimated)
- </Table.th>,
- <Table.th key="realtime" className="hidden xl:table-cell text-center">
- Realtime Enabled
- </Table.th>,
- <Table.th key="buttons"></Table.th>,
- ]}
- body={
- <>
- {tables.length === 0 && filterString.length === 0 && (
- <Table.tr key={selectedSchema}>
- <Table.td colSpan={6}>
- <p className="text-sm text-scale-1200">No tables created yet</p>
- <p className="text-sm text-light">
- There are no tables found in the schema "{selectedSchema}"
- </p>
- </Table.td>
- </Table.tr>
- )}
- {tables.length === 0 && filterString.length > 0 && (
- <Table.tr key={selectedSchema}>
- <Table.td colSpan={6}>
- <p className="text-sm text-scale-1200">No results found</p>
- <p className="text-sm text-light">
- Your search for "{filterString}" did not return any results
- </p>
- </Table.td>
- </Table.tr>
- )}
- {tables.length > 0 &&
- tables.map((x: any, i: any) => (
- <Table.tr key={x.id}>
- <Table.td>
- <p title={x.name}>{x.name}</p>
- </Table.td>
- <Table.td className="hidden max-w-sm truncate lg:table-cell break-all whitespace-normal">
- {x.comment !== null ? (
- <p title={x.comment}>{x.comment}</p>
- ) : (
- <p className="text-scale-800">No description</p>
- )}
- </Table.td>
- <Table.td className="hidden xl:table-cell">
- <code className="text-sm">{x.live_rows_estimate ?? x.live_row_count}</code>
- </Table.td>
- <Table.td className="hidden xl:table-cell">
- <code className="text-sm">{x.size}</code>
+ <div className="my-4">
+ {isLoading ? (
+ <GenericSkeletonLoader />
+ ) : (
+ <div className="w-full">
+ <Table
+ head={[
+ <Table.th key="name">Name</Table.th>,
+ <Table.th key="description" className="hidden lg:table-cell">
+ Description
+ </Table.th>,
+ <Table.th key="rows" className="hidden xl:table-cell">
+ Rows (Estimated)
+ </Table.th>,
+ <Table.th key="size" className="hidden xl:table-cell">
+ Size (Estimated)
+ </Table.th>,
+ <Table.th key="realtime" className="hidden xl:table-cell text-center">
+ Realtime Enabled
+ </Table.th>,
+ <Table.th key="buttons"></Table.th>,
+ ]}
+ body={
+ <>
+ {tables.length === 0 && filterString.length === 0 && (
+ <Table.tr key={selectedSchema}>
+ <Table.td colSpan={6}>
+ <p className="text-sm text-scale-1200">No tables created yet</p>
+ <p className="text-sm text-light">
+ There are no tables found in the schema "{selectedSchema}"
+ </p>
</Table.td>
- <Table.td className="hidden xl:table-cell text-center">
- {(realtimePublication?.tables ?? []).find(
- (table: any) => table.id === x.id
- ) && (
- <div className="flex justify-center">
- <IconCheck strokeWidth={2} />
- </div>
- )}
+ </Table.tr>
+ )}
+ {tables.length === 0 && filterString.length > 0 && (
+ <Table.tr key={selectedSchema}>
+ <Table.td colSpan={6}>
+ <p className="text-sm text-scale-1200">No results found</p>
+ <p className="text-sm text-light">
+ Your search for "{filterString}" did not return any results
+ </p>
</Table.td>
- <Table.td>
- <div className="flex justify-end gap-2">
- <Button
- type="default"
- iconRight={<IconColumns />}
- className="whitespace-nowrap hover:border-gray-500"
- style={{ paddingTop: 3, paddingBottom: 3 }}
- onClick={() => onOpenTable(x)}
- >
- {x.columns?.length} columns
- </Button>
+ </Table.tr>
+ )}
+ {tables.length > 0 &&
+ tables.map((x: any, i: any) => (
+ <Table.tr key={x.id}>
+ <Table.td>
+ <p title={x.name}>{x.name}</p>
+ </Table.td>
+ <Table.td className="hidden max-w-sm truncate lg:table-cell break-all whitespace-normal">
+ {x.comment !== null ? (
+ <p title={x.comment}>{x.comment}</p>
+ ) : (
+ <p className="text-scale-800">No description</p>
+ )}
+ </Table.td>
+ <Table.td className="hidden xl:table-cell">
+ <code className="text-sm">
+ {x.live_rows_estimate ?? x.live_row_count}
+ </code>
+ </Table.td>
+ <Table.td className="hidden xl:table-cell">
+ <code className="text-sm">{x.size}</code>
+ </Table.td>
+ <Table.td className="hidden xl:table-cell text-center">
+ {(realtimePublication?.tables ?? []).find(
+ (table: any) => table.id === x.id
+ ) && (
+ <div className="flex justify-center">
+ <IconCheck strokeWidth={2} />
+ </div>
+ )}
+ </Table.td>
+ <Table.td>
+ <div className="flex justify-end gap-2">
+ <Button
+ type="default"
+ iconRight={<IconColumns />}
+ className="whitespace-nowrap hover:border-gray-500"
+ style={{ paddingTop: 3, paddingBottom: 3 }}
+ onClick={() => onOpenTable(x)}
+ >
+ {x.columns?.length} columns
+ </Button>
- <Tooltip.Root delayDuration={0}>
- <Tooltip.Trigger>
- <Button
- type="text"
- icon={<IconEdit3 />}
- style={{ padding: 5 }}
- disabled={!canUpdateTables || isLocked}
- onClick={() => onEditTable(x)}
- />
- </Tooltip.Trigger>
- {!canUpdateTables && (
- <Tooltip.Portal>
- <Tooltip.Content side="bottom">
- <Tooltip.Arrow className="radix-tooltip-arrow" />
- <div
- className={[
- 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
- 'border border-scale-200',
- ].join(' ')}
- >
- <span className="text-xs text-scale-1200">
- You need additional permissions to edit tables
- </span>
- </div>
- </Tooltip.Content>
- </Tooltip.Portal>
- )}
- </Tooltip.Root>
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Trigger>
+ <Button
+ type="text"
+ icon={<IconEdit3 />}
+ style={{ padding: 5 }}
+ disabled={!canUpdateTables || isLocked}
+ onClick={() => onEditTable(x)}
+ />
+ </Tooltip.Trigger>
+ {!canUpdateTables && (
+ <Tooltip.Portal>
+ <Tooltip.Content side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200',
+ ].join(' ')}
+ >
+ <span className="text-xs text-scale-1200">
+ You need additional permissions to edit tables
+ </span>
+ </div>
+ </Tooltip.Content>
+ </Tooltip.Portal>
+ )}
+ </Tooltip.Root>
- <Tooltip.Root delayDuration={0}>
- <Tooltip.Trigger>
- <Button
- type="text"
- icon={<IconTrash />}
- style={{ padding: 5 }}
- disabled={!canUpdateTables || isLocked}
- onClick={() => onDeleteTable(x)}
- />
- </Tooltip.Trigger>
- {!canUpdateTables && (
- <Tooltip.Portal>
- <Tooltip.Content side="bottom">
- <Tooltip.Arrow className="radix-tooltip-arrow" />
- <div
- className={[
- 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
- 'border border-scale-200',
- ].join(' ')}
- >
- <span className="text-xs text-scale-1200">
- You need additional permissions to delete tables
- </span>
- </div>
- </Tooltip.Content>
- </Tooltip.Portal>
- )}
- </Tooltip.Root>
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Trigger>
+ <Button
+ type="text"
+ icon={<IconTrash />}
+ style={{ padding: 5 }}
+ disabled={!canUpdateTables || isLocked}
+ onClick={() => onDeleteTable(x)}
+ />
+ </Tooltip.Trigger>
+ {!canUpdateTables && (
+ <Tooltip.Portal>
+ <Tooltip.Content side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200',
+ ].join(' ')}
+ >
+ <span className="text-xs text-scale-1200">
+ You need additional permissions to delete tables
+ </span>
+ </div>
+ </Tooltip.Content>
+ </Tooltip.Portal>
+ )}
+ </Tooltip.Root>
- {/* <Button
- type="text"
- icon={<IconEdit3 />}
- style={{ padding: 5 }}
- disabled={isLocked}
- onClick={() => onEditTable(x)}
- />
- <Button
- type="text"
- icon={<IconTrash />}
- style={{ padding: 5 }}
- disabled={isLocked}
- onClick={() => onDeleteTable(x)}
- /> */}
- </div>
- </Table.td>
- </Table.tr>
- ))}
- </>
- }
- />
- </div>
- )}
+ {/* <Button
+ type="text"
+ icon={<IconEdit3 />}
+ style={{ padding: 5 }}
+ disabled={isLocked}
+ onClick={() => onEditTable(x)}
+ />
+ <Button
+ type="text"
+ icon={<IconTrash />}
+ style={{ padding: 5 }}
+ disabled={isLocked}
+ onClick={() => onDeleteTable(x)}
+ /> */}
+ </div>
+ </Table.td>
+ </Table.tr>
+ ))}
+ </>
+ }
+ />
+ </div>
+ )}
+ </div>
</>
)
}
diff --git a/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx b/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx
index 85d303b6fcf..0f5bd314851 100644
--- a/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx
+++ b/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx
@@ -1,14 +1,16 @@
import * as Tooltip from '@radix-ui/react-tooltip'
import { PostgresSchema } from '@supabase/postgres-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
-import { includes, map as lodashMap, noop, partition, uniqBy } from 'lodash'
+import { noop, partition } from 'lodash'
import { observer } from 'mobx-react-lite'
import { useState } from 'react'
-import { Button, IconLoader, IconLock, IconSearch, Input, Listbox } from 'ui'
+import { Button, IconLock, IconSearch, Input, Listbox } from 'ui'
import AlphaPreview from 'components/to-be-cleaned/AlphaPreview'
import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'
import Table from 'components/to-be-cleaned/Table'
+import AlertError from 'components/ui/AlertError'
+import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
import { useCheckPermissions, useStore } from 'hooks'
import TriggerList from './TriggerList'
@@ -35,28 +37,14 @@ const TriggersList = ({
const isLocked = protectedSchemas.some((s) => s.id === schema?.id)
const triggers = meta.triggers.list()
- const filteredTriggers = triggers.filter((x: any) =>
- includes(x.name.toLowerCase(), filterString.toLowerCase())
- )
- const filteredTriggerSchemas = lodashMap(uniqBy(filteredTriggers, 'schema'), 'schema')
const canCreateTriggers = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'triggers')
if (meta.triggers.isLoading) {
- return (
- <div className="flex h-full w-full items-center justify-center space-x-2">
- <IconLoader className="animate-spin" size={14} />
- <p className="text-sm text-scale-1000">Loading triggers...</p>
- </div>
- )
+ return <GenericSkeletonLoader />
}
if (meta.triggers.hasError) {
- return (
- <div className="px-6 py-4 text-scale-1000">
- <p>Error connecting to API</p>
- <p>{`${meta.triggers.error?.message ?? 'Unknown error'}`}</p>
- </div>
- )
+ return <AlertError error={meta.triggers.error} subject="Failed to retrieve database triggers" />
}
return (
@@ -80,8 +68,8 @@ const TriggersList = ({
</ProductEmptyState>
</div>
) : (
- <div className="w-full space-y-4 py-4">
- <div className="flex items-center justify-between px-6">
+ <div className="w-full space-y-4">
+ <div className="flex items-center justify-between">
<div className="flex items-center space-x-4">
<div className="w-[260px]">
<Listbox
@@ -165,7 +153,7 @@ const TriggersList = ({
</div>
<Table
- className="table-fixed px-6"
+ className="table-fixed"
head={
<>
<Table.th key="name" className="w-[25%] space-x-4">
diff --git a/studio/pages/project/[ref]/database/backups/pitr.tsx b/studio/pages/project/[ref]/database/backups/pitr.tsx
index 955beed6827..8f717a99719 100644
--- a/studio/pages/project/[ref]/database/backups/pitr.tsx
+++ b/studio/pages/project/[ref]/database/backups/pitr.tsx
@@ -1,5 +1,4 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
-import clsx from 'clsx'
import { observer } from 'mobx-react-lite'
import { useRouter } from 'next/router'
import { Tabs } from 'ui'
@@ -8,12 +7,13 @@ import BackupsError from 'components/interfaces/Database/Backups/BackupsError'
import { PITRNotice, PITRSelection } from 'components/interfaces/Database/Backups/PITR'
import { DatabaseLayout } from 'components/layouts'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import Loading from 'components/ui/Loading'
import NoPermission from 'components/ui/NoPermission'
import UpgradeToPro from 'components/ui/UpgradeToPro'
+import { useProjectSubscriptionV2Query } from 'data/subscriptions/project-subscription-v2-query'
import { useCheckPermissions, useStore } from 'hooks'
import { NextPageWithLayout } from 'types'
-import { useProjectSubscriptionV2Query } from 'data/subscriptions/project-subscription-v2-query'
const DatabasePhysicalBackups: NextPageWithLayout = () => {
const router = useRouter()
@@ -21,32 +21,31 @@ const DatabasePhysicalBackups: NextPageWithLayout = () => {
const ref = project?.ref ?? 'default'
return (
- <div
- className={clsx(
- 'mx-auto flex flex-col px-5 pt-6 pb-14',
- 'lg:pt-8 lg:px-14 1xl:px-28 2xl:px-32 h-full'
- )}
- >
- <div className="space-y-6">
- <h3 className="text-xl text-scale-1200">Backups</h3>
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ <div className="space-y-6">
+ <h3 className="text-xl text-scale-1200">Backups</h3>
- <Tabs
- type="underlined"
- size="small"
- activeId="pitr"
- onChange={(id: any) => {
- if (id === 'scheduled') router.push(`/project/${ref}/database/backups/scheduled`)
- }}
- >
- <Tabs.Panel id="scheduled" label="Scheduled backups" />
- <Tabs.Panel id="pitr" label="Point in Time" />
- </Tabs>
+ <Tabs
+ type="underlined"
+ size="small"
+ activeId="pitr"
+ onChange={(id: any) => {
+ if (id === 'scheduled') router.push(`/project/${ref}/database/backups/scheduled`)
+ }}
+ >
+ <Tabs.Panel id="scheduled" label="Scheduled backups" />
+ <Tabs.Panel id="pitr" label="Point in Time" />
+ </Tabs>
- <div className="space-y-8">
- <PITR />
+ <div className="space-y-8">
+ <PITR />
+ </div>
+ </div>
</div>
- </div>
- </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
)
}
diff --git a/studio/pages/project/[ref]/database/backups/scheduled.tsx b/studio/pages/project/[ref]/database/backups/scheduled.tsx
index d32e43d89d2..9b4da62a687 100644
--- a/studio/pages/project/[ref]/database/backups/scheduled.tsx
+++ b/studio/pages/project/[ref]/database/backups/scheduled.tsx
@@ -1,16 +1,16 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
-import clsx from 'clsx'
import { observer } from 'mobx-react-lite'
import { useRouter } from 'next/router'
+import { IconInfo, Tabs } from 'ui'
import { BackupsList } from 'components/interfaces/Database'
import { DatabaseLayout } from 'components/layouts'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import InformationBox from 'components/ui/InformationBox'
import NoPermission from 'components/ui/NoPermission'
import { useCheckPermissions, useStore } from 'hooks'
import { NextPageWithLayout } from 'types'
-import { IconInfo, Tabs } from 'ui'
const DatabaseScheduledBackups: NextPageWithLayout = () => {
const router = useRouter()
@@ -23,65 +23,64 @@ const DatabaseScheduledBackups: NextPageWithLayout = () => {
const canReadScheduledBackups = useCheckPermissions(PermissionAction.READ, 'back_ups')
return (
- <div
- className={clsx(
- 'mx-auto flex flex-col px-5 pt-6 pb-14',
- 'lg:pt-8 lg:px-14 1xl:px-28 2xl:px-32 h-full'
- )}
- >
- <div className="space-y-6">
- <h3 className="text-xl text-scale-1200">Backups</h3>
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ <div className="space-y-6">
+ <h3 className="text-xl text-scale-1200">Backups</h3>
- <Tabs
- type="underlined"
- size="small"
- activeId="scheduled"
- onChange={(id: any) => {
- if (id === 'pitr') router.push(`/project/${ref}/database/backups/pitr`)
- }}
- >
- <Tabs.Panel id="scheduled" label="Scheduled backups" />
- <Tabs.Panel id="pitr" label="Point in Time" />
- </Tabs>
+ <Tabs
+ type="underlined"
+ size="small"
+ activeId="scheduled"
+ onChange={(id: any) => {
+ if (id === 'pitr') router.push(`/project/${ref}/database/backups/pitr`)
+ }}
+ >
+ <Tabs.Panel id="scheduled" label="Scheduled backups" />
+ <Tabs.Panel id="pitr" label="Point in Time" />
+ </Tabs>
- <div className="space-y-4">
- {!isPitrEnabled && (
- <p className="text-sm text-scale-1100">
- Projects are backed up daily around midnight of your project's region and can be
- restored at any time.
- </p>
- )}
+ <div className="space-y-4">
+ {!isPitrEnabled && (
+ <p className="text-sm text-scale-1100">
+ Projects are backed up daily around midnight of your project's region and can be
+ restored at any time.
+ </p>
+ )}
- {isPitrEnabled && (
- <InformationBox
- hideCollapse
- defaultVisibility
- icon={<IconInfo strokeWidth={2} />}
- title="Point-In-Time-Recovery (PITR) enabled"
- description={
- <div>
- Your project uses PITR and full daily backups are no longer taken. They're not
- needed, as PITR supports a superset of functionality, in terms of the granular
- recovery that can be performed.{' '}
- <a
- className="text-brand transition-colors hover:text-brand-600"
- href="https://supabase.com/docs/guides/platform/backups"
- >
- Learn more
- </a>
- </div>
- }
- />
- )}
+ {isPitrEnabled && (
+ <InformationBox
+ hideCollapse
+ defaultVisibility
+ icon={<IconInfo strokeWidth={2} />}
+ title="Point-In-Time-Recovery (PITR) enabled"
+ description={
+ <div>
+ Your project uses PITR and full daily backups are no longer taken. They're not
+ needed, as PITR supports a superset of functionality, in terms of the granular
+ recovery that can be performed.{' '}
+ <a
+ className="text-brand transition-colors hover:text-brand-600"
+ href="https://supabase.com/docs/guides/platform/backups"
+ >
+ Learn more
+ </a>
+ </div>
+ }
+ />
+ )}
- {canReadScheduledBackups ? (
- <BackupsList />
- ) : (
- <NoPermission resourceText="view scheduled backups" />
- )}
+ {canReadScheduledBackups ? (
+ <BackupsList />
+ ) : (
+ <NoPermission resourceText="view scheduled backups" />
+ )}
+ </div>
+ </div>
</div>
- </div>
- </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
)
}
diff --git a/studio/pages/project/[ref]/database/extensions.tsx b/studio/pages/project/[ref]/database/extensions.tsx
index 68e98897a2b..c77cb2ee46a 100644
--- a/studio/pages/project/[ref]/database/extensions.tsx
+++ b/studio/pages/project/[ref]/database/extensions.tsx
@@ -1,11 +1,12 @@
-import { observer } from 'mobx-react-lite'
import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { observer } from 'mobx-react-lite'
-import { NextPageWithLayout } from 'types'
-import { useCheckPermissions } from 'hooks'
-import { DatabaseLayout } from 'components/layouts'
import { Extensions } from 'components/interfaces/Database'
+import { DatabaseLayout } from 'components/layouts'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import NoPermission from 'components/ui/NoPermission'
+import { useCheckPermissions } from 'hooks'
+import { NextPageWithLayout } from 'types'
const DatabaseExtensions: NextPageWithLayout = () => {
const canReadExtensions = useCheckPermissions(
@@ -16,7 +17,15 @@ const DatabaseExtensions: NextPageWithLayout = () => {
return <NoPermission isFullPage resourceText="view database extensions" />
}
- return <Extensions />
+ return (
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ <Extensions />
+ </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
+ )
}
DatabaseExtensions.getLayout = (page) => <DatabaseLayout title="Database">{page}</DatabaseLayout>
diff --git a/studio/pages/project/[ref]/database/functions.tsx b/studio/pages/project/[ref]/database/functions.tsx
index 5f8d6472281..8c92972e199 100644
--- a/studio/pages/project/[ref]/database/functions.tsx
+++ b/studio/pages/project/[ref]/database/functions.tsx
@@ -9,6 +9,7 @@ import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectConte
import NoPermission from 'components/ui/NoPermission'
import { useCheckPermissions, useStore } from 'hooks'
import { NextPageWithLayout } from 'types'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
const FunctionsPage: NextPageWithLayout = () => {
const { meta } = useStore()
@@ -50,11 +51,17 @@ const FunctionsPage: NextPageWithLayout = () => {
return (
<>
- <FunctionsList
- createFunction={createFunction}
- editFunction={editFunction}
- deleteFunction={deleteFunction}
- />
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ <FunctionsList
+ createFunction={createFunction}
+ editFunction={editFunction}
+ deleteFunction={deleteFunction}
+ />
+ </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
<CreateFunction
func={selectedFunction}
visible={showCreateFunctionForm}
diff --git a/studio/pages/project/[ref]/database/hooks/index.tsx b/studio/pages/project/[ref]/database/hooks.tsx
similarity index 92%
rename from studio/pages/project/[ref]/database/hooks/index.tsx
rename to studio/pages/project/[ref]/database/hooks.tsx
index 86ccc236c4b..c7477d9d259 100644
--- a/studio/pages/project/[ref]/database/hooks/index.tsx
+++ b/studio/pages/project/[ref]/database/hooks.tsx
@@ -14,6 +14,7 @@ import NoPermission from 'components/ui/NoPermission'
import { useHooksEnableMutation } from 'data/database/hooks-enable-mutation'
import { useCheckPermissions, useStore } from 'hooks'
import { NextPageWithLayout } from 'types'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
const HooksPage: NextPageWithLayout = () => {
const { meta, ui } = useStore()
@@ -102,13 +103,14 @@ const HooksPage: NextPageWithLayout = () => {
}
return (
- <div
- className={clsx(
- 'mx-auto flex flex-col px-5 pt-6 pb-14',
- 'lg:pt-8 lg:px-14 1xl:px-28 2xl:px-32 h-full'
- )}
- >
- <HooksList createHook={createHook} editHook={editHook} deleteHook={deleteHook} />
+ <>
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ <HooksList createHook={createHook} editHook={editHook} deleteHook={deleteHook} />
+ </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
<EditHookPanel
visible={showCreateHookForm}
selectedHook={selectedHook}
@@ -119,7 +121,7 @@ const HooksPage: NextPageWithLayout = () => {
selectedHook={selectedHook}
onClose={() => setShowDeleteHookForm(false)}
/>
- </div>
+ </>
)
}
diff --git a/studio/pages/project/[ref]/database/indexes.tsx b/studio/pages/project/[ref]/database/indexes.tsx
index 27514ae048d..97c834a167e 100644
--- a/studio/pages/project/[ref]/database/indexes.tsx
+++ b/studio/pages/project/[ref]/database/indexes.tsx
@@ -1,19 +1,17 @@
-import clsx from 'clsx'
-
import Indexes from 'components/interfaces/Database/Indexes/Indexes'
import { DatabaseLayout } from 'components/layouts'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import { NextPageWithLayout } from 'types'
const IndexesPage: NextPageWithLayout = () => {
return (
- <div
- className={clsx(
- 'mx-auto flex flex-col px-5 pt-6 pb-14',
- 'lg:pt-8 lg:px-14 1xl:px-28 2xl:px-32 h-full'
- )}
- >
- <Indexes />
- </div>
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ <Indexes />
+ </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
)
}
diff --git a/studio/pages/project/[ref]/database/migrations.tsx b/studio/pages/project/[ref]/database/migrations.tsx
index a7a19f82a4c..9d7fc9bc9a0 100644
--- a/studio/pages/project/[ref]/database/migrations.tsx
+++ b/studio/pages/project/[ref]/database/migrations.tsx
@@ -1,19 +1,17 @@
-import clsx from 'clsx'
-
import Migrations from 'components/interfaces/Database/Migrations/Migrations'
import { DatabaseLayout } from 'components/layouts'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import { NextPageWithLayout } from 'types'
const MigrationsPage: NextPageWithLayout = () => {
return (
- <div
- className={clsx(
- 'mx-auto flex flex-col px-5 pt-6 pb-14',
- 'lg:pt-8 lg:px-14 1xl:px-28 2xl:px-32 h-full'
- )}
- >
- <Migrations />
- </div>
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ <Migrations />
+ </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
)
}
diff --git a/studio/pages/project/[ref]/database/replication.tsx b/studio/pages/project/[ref]/database/replication.tsx
index 7972deedd7a..ecd30cd2c89 100644
--- a/studio/pages/project/[ref]/database/replication.tsx
+++ b/studio/pages/project/[ref]/database/replication.tsx
@@ -7,6 +7,7 @@ import { NextPageWithLayout } from 'types'
import { DatabaseLayout } from 'components/layouts'
import { PublicationsList, PublicationsTables } from 'components/interfaces/Database'
import NoPermission from 'components/ui/NoPermission'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
// [Joshen] Technically, best that we have these as separate URLs
// makes it easier to manage state, but foresee that this page might
@@ -29,16 +30,20 @@ const DatabaseReplication: NextPageWithLayout = () => {
}
return (
- <div className="p-4">
- {selectedPublicationId === undefined ? (
- <PublicationsList onSelectPublication={setSelectedPublicationId} />
- ) : (
- <PublicationsTables
- selectedPublication={selectedPublication}
- onSelectBack={() => setSelectedPublicationId(undefined)}
- />
- )}
- </div>
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ {selectedPublicationId === undefined ? (
+ <PublicationsList onSelectPublication={setSelectedPublicationId} />
+ ) : (
+ <PublicationsTables
+ selectedPublication={selectedPublication}
+ onSelectBack={() => setSelectedPublicationId(undefined)}
+ />
+ )}
+ </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
)
}
diff --git a/studio/pages/project/[ref]/database/roles/index.tsx b/studio/pages/project/[ref]/database/roles.tsx
similarity index 60%
rename from studio/pages/project/[ref]/database/roles/index.tsx
rename to studio/pages/project/[ref]/database/roles.tsx
index ef584cc1668..ba495a30cd0 100644
--- a/studio/pages/project/[ref]/database/roles/index.tsx
+++ b/studio/pages/project/[ref]/database/roles.tsx
@@ -1,19 +1,18 @@
-import { observer } from 'mobx-react-lite'
-import { DatabaseLayout } from 'components/layouts'
import { RolesList } from 'components/interfaces/Database'
+import { DatabaseLayout } from 'components/layouts'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
+import { observer } from 'mobx-react-lite'
import { NextPageWithLayout } from 'types'
-import clsx from 'clsx'
const DatabaseRoles: NextPageWithLayout = () => {
return (
- <div
- className={clsx(
- 'mx-auto flex flex-col px-5 pt-6 pb-14',
- 'lg:pt-8 lg:px-14 1xl:px-28 2xl:px-32'
- )}
- >
- <RolesList />
- </div>
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ <RolesList />
+ </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
)
}
diff --git a/studio/pages/project/[ref]/database/tables.tsx b/studio/pages/project/[ref]/database/tables.tsx
index 16e49895958..a37cf910e14 100644
--- a/studio/pages/project/[ref]/database/tables.tsx
+++ b/studio/pages/project/[ref]/database/tables.tsx
@@ -3,16 +3,17 @@ import { useQueryClient } from '@tanstack/react-query'
import { isUndefined } from 'lodash'
import { observer } from 'mobx-react-lite'
import { useEffect, useState } from 'react'
+import { Modal } from 'ui'
import { ColumnList, TableList } from 'components/interfaces/Database'
import { SidePanelEditor } from 'components/interfaces/TableGridEditor'
import { DatabaseLayout } from 'components/layouts'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import ConfirmationModal from 'components/ui/ConfirmationModal'
import { sqlKeys } from 'data/sql/keys'
import { useStore } from 'hooks'
import { NextPageWithLayout } from 'types'
-import { Modal } from 'ui'
const DatabaseTables: NextPageWithLayout = () => {
const { meta, ui } = useStore()
@@ -142,26 +143,31 @@ const DatabaseTables: NextPageWithLayout = () => {
return (
<>
- <div className="p-4">
- {isUndefined(selectedTable) ? (
- <TableList
- selectedSchema={selectedSchema}
- onSelectSchema={setSelectedSchema}
- onAddTable={onAddTable}
- onEditTable={onEditTable}
- onDeleteTable={onDeleteTable}
- onOpenTable={setSelectedTable}
- />
- ) : (
- <ColumnList
- selectedTable={selectedTable}
- onAddColumn={onAddColumn}
- onEditColumn={onEditColumn}
- onDeleteColumn={onDeleteColumn}
- onSelectBack={() => setSelectedTable(undefined)}
- />
- )}
- </div>
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ {isUndefined(selectedTable) ? (
+ <TableList
+ selectedSchema={selectedSchema}
+ onSelectSchema={setSelectedSchema}
+ onAddTable={onAddTable}
+ onEditTable={onEditTable}
+ onDeleteTable={onDeleteTable}
+ onOpenTable={setSelectedTable}
+ />
+ ) : (
+ <ColumnList
+ selectedTable={selectedTable}
+ onAddColumn={onAddColumn}
+ onEditColumn={onEditColumn}
+ onDeleteColumn={onDeleteColumn}
+ onSelectBack={() => setSelectedTable(undefined)}
+ />
+ )}
+ </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
+
<ConfirmationModal
danger
visible={isDeleting && !isUndefined(selectedTableToDelete)}
@@ -179,6 +185,7 @@ const DatabaseTables: NextPageWithLayout = () => {
</p>
</Modal.Content>
</ConfirmationModal>
+
<ConfirmationModal
danger
visible={isDeleting && !isUndefined(selectedColumnToDelete)}
@@ -194,6 +201,7 @@ const DatabaseTables: NextPageWithLayout = () => {
</p>
</Modal.Content>
</ConfirmationModal>
+
<SidePanelEditor
sidePanelKey={sidePanelKey}
selectedSchema={selectedSchema}
diff --git a/studio/pages/project/[ref]/database/triggers.tsx b/studio/pages/project/[ref]/database/triggers.tsx
index f139c3cd7da..773879b5715 100644
--- a/studio/pages/project/[ref]/database/triggers.tsx
+++ b/studio/pages/project/[ref]/database/triggers.tsx
@@ -9,6 +9,7 @@ import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectConte
import NoPermission from 'components/ui/NoPermission'
import { useCheckPermissions, useStore } from 'hooks'
import { NextPageWithLayout } from 'types'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
const TriggersPage: NextPageWithLayout = () => {
const { meta } = useStore()
@@ -51,11 +52,17 @@ const TriggersPage: NextPageWithLayout = () => {
return (
<>
- <TriggersList
- createTrigger={createTrigger}
- editTrigger={editTrigger}
- deleteTrigger={deleteTrigger}
- />
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ <TriggersList
+ createTrigger={createTrigger}
+ editTrigger={editTrigger}
+ deleteTrigger={deleteTrigger}
+ />
+ </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
<CreateTrigger
trigger={selectedTrigger}
visible={showCreateTriggerForm}
diff --git a/studio/pages/project/[ref]/database/wrappers/index.tsx b/studio/pages/project/[ref]/database/wrappers/index.tsx
index 6744e65b284..9e5d30a93ea 100644
--- a/studio/pages/project/[ref]/database/wrappers/index.tsx
+++ b/studio/pages/project/[ref]/database/wrappers/index.tsx
@@ -1,12 +1,12 @@
-import clsx from 'clsx'
-import { observer } from 'mobx-react-lite'
import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { observer } from 'mobx-react-lite'
-import { NextPageWithLayout } from 'types'
-import { useCheckPermissions } from 'hooks'
-import { DatabaseLayout } from 'components/layouts'
import { Wrappers } from 'components/interfaces/Database'
+import { DatabaseLayout } from 'components/layouts'
+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import NoPermission from 'components/ui/NoPermission'
+import { useCheckPermissions } from 'hooks'
+import { NextPageWithLayout } from 'types'
const DatabaseWrappers: NextPageWithLayout = () => {
const canReadWrappers = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_READ, 'tables')
@@ -19,14 +19,11 @@ const DatabaseWrappers: NextPageWithLayout = () => {
DatabaseWrappers.getLayout = (page) => (
<DatabaseLayout title="Wrappers">
- <div
- className={clsx(
- 'mx-auto flex flex-col px-5 pt-6 pb-14',
- 'lg:pt-8 lg:px-14 1xl:px-28 2xl:px-32 h-full'
- )}
- >
- {page}
- </div>
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">{page}</div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
</DatabaseLayout>
)