The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Chore/standardize UI in database pages (#18300)
Joshen Limdd7a681dd7e9
diff --git a/studio/components/interfaces/Database/EnumeratedTypes/EnumeratedTypes.tsx b/studio/components/interfaces/Database/EnumeratedTypes/EnumeratedTypes.tsxindex 81082d6fb38..cfee5a7bdd0 100644--- a/studio/components/interfaces/Database/EnumeratedTypes/EnumeratedTypes.tsx+++ b/studio/components/interfaces/Database/EnumeratedTypes/EnumeratedTypes.tsx@@ -1,14 +1,4 @@import { useState } from 'react'--import SchemaSelector from 'components/ui/SchemaSelector'-import {- EnumeratedType,- useEnumeratedTypesQuery,-} from 'data/enumerated-types/enumerated-types-query'-import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'-import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'-import AlertError from 'components/ui/AlertError'-import Table from 'components/to-be-cleaned/Table'import {Button,DropdownMenu,@@ -17,13 +7,25 @@ import {DropdownMenuTrigger,IconEdit,IconMoreVertical,- IconPlus,IconSearch,IconTrash,Input,} from 'ui'-import DeleteEnumeratedTypeModal from './DeleteEnumeratedTypeModal'++import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'+import Table from 'components/to-be-cleaned/Table'+import AlertError from 'components/ui/AlertError'+import SchemaSelector from 'components/ui/SchemaSelector'+import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'+import { useSchemasQuery } from 'data/database/schemas-query'+import {+ EnumeratedType,+ useEnumeratedTypesQuery,+} from 'data/enumerated-types/enumerated-types-query'+import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'+import ProtectedSchemaWarning from '../ProtectedSchemaWarning'import CreateEnumeratedTypeSidePanel from './CreateEnumeratedTypeSidePanel'+import DeleteEnumeratedTypeModal from './DeleteEnumeratedTypeModal'import EditEnumeratedTypeSidePanel from './EditEnumeratedTypeSidePanel'const EnumeratedTypes = () => {@@ -34,6 +36,11 @@ const EnumeratedTypes = () => {const [selectedTypeToEdit, setSelectedTypeToEdit] = useState<EnumeratedType>()const [selectedTypeToDelete, setSelectedTypeToDelete] = useState<EnumeratedType>()+ const { data: schemas } = useSchemasQuery({+ projectRef: project?.ref,+ connectionString: project?.connectionString,+ })+const { data, error, isLoading, isError, isSuccess } = useEnumeratedTypesQuery({projectRef: project?.ref,connectionString: project?.connectionString,@@ -45,9 +52,15 @@ const EnumeratedTypes = () => {): (data ?? []).filter((x) => x.schema === selectedSchema)+ const protectedSchemas = (schemas ?? []).filter((schema) =>+ EXCLUDED_SCHEMAS.includes(schema?.name ?? '')+ )+ const schema = schemas?.find((schema) => schema.name === selectedSchema)+ const isLocked = protectedSchemas.some((s) => s.id === schema?.id)+return (- <>- <div className="flex items-center justify-between mb-4">+ <div className="space-y-4">+ <div className="flex items-center justify-between"><div className="flex items-center space-x-2"><SchemaSelectorclassName="w-[260px]"@@ -59,7 +72,7 @@ const EnumeratedTypes = () => {<Inputsize="small"value={search}- className="w-[250px]"+ className="w-64"onChange={(e) => setSearch(e.target.value)}placeholder="Search for a type"icon={<IconSearch size={14} />}@@ -70,6 +83,8 @@ const EnumeratedTypes = () => {</Button></div>+ {isLocked && <ProtectedSchemaWarning schema={selectedSchema} entity="enumerated types" />}+{isLoading && <GenericSkeletonLoader />}{isError && (@@ -115,36 +130,38 @@ const EnumeratedTypes = () => {<Table.td>{type.name}</Table.td><Table.td>{type.enums.join(', ')}</Table.td><Table.td>- <div className="flex justify-end items-center space-x-2">- <DropdownMenu>- <DropdownMenuTrigger>- <Button- asChild- type="default"- icon={<IconMoreVertical />}- className="px-1"- >- <span></span>- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent side="bottom" align="end" className="w-32">- <DropdownMenuItem- className="space-x-2"- onClick={() => setSelectedTypeToEdit(type)}- >- <IconEdit size="tiny" />- <p>Update type</p>- </DropdownMenuItem>- <DropdownMenuItem- className="space-x-2"- onClick={() => setSelectedTypeToDelete(type)}- >- <IconTrash stroke="red" size="tiny" />- <p>Delete type</p>- </DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu>- </div>+ {!isLocked && (+ <div className="flex justify-end items-center space-x-2">+ <DropdownMenu>+ <DropdownMenuTrigger>+ <Button+ asChild+ type="default"+ icon={<IconMoreVertical />}+ className="px-1"+ >+ <span></span>+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent side="bottom" align="end" className="w-32">+ <DropdownMenuItem+ className="space-x-2"+ onClick={() => setSelectedTypeToEdit(type)}+ >+ <IconEdit size="tiny" />+ <p>Update type</p>+ </DropdownMenuItem>+ <DropdownMenuItem+ className="space-x-2"+ onClick={() => setSelectedTypeToDelete(type)}+ >+ <IconTrash stroke="red" size="tiny" />+ <p>Delete type</p>+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ )}</Table.td></Table.tr>))}@@ -169,7 +186,7 @@ const EnumeratedTypes = () => {selectedEnumeratedType={selectedTypeToDelete}onClose={() => setSelectedTypeToDelete(undefined)}/>- </>+ </div>)}diff --git a/studio/components/interfaces/Database/Extensions/Extensions.tsx b/studio/components/interfaces/Database/Extensions/Extensions.tsxindex 308249f1b64..54fe02020af 100644--- a/studio/components/interfaces/Database/Extensions/Extensions.tsx+++ b/studio/components/interfaces/Database/Extensions/Extensions.tsx@@ -3,7 +3,7 @@ import { isNull, partition } from 'lodash'import { observer } from 'mobx-react-lite'import Link from 'next/link'import { useEffect, useState } from 'react'-import { Button, IconAlertCircle, IconBookOpen, IconSearch, Input } from 'ui'+import { Button, IconAlertCircle, IconExternalLink, IconSearch, Input } from 'ui'import { useParams } from 'common/hooks'import InformationBox from 'components/ui/InformationBox'@@ -44,9 +44,10 @@ const Extensions = () => {<div className="flex items-center justify-between"><Inputsize="small"- placeholder={'Filter'}+ placeholder="Search for an extension"value={filterString}onChange={(e) => setFilterString(e.target.value)}+ className="w-64"icon={<IconSearch size="tiny" />}/>{!canUpdateExtensions ? (@@ -58,11 +59,11 @@ const Extensions = () => {</div>) : (<Link passHref href="https://supabase.com/docs/guides/database/extensions">- <a target="_blank" rel="noreferrer">- <Button type="default" iconRight={<IconBookOpen />}>- Learn more about extensions- </Button>- </a>+ <Button asChild type="default" icon={<IconExternalLink />}>+ <a target="_blank" rel="noreferrer">+ Documentation+ </a>+ </Button></Link>)}</div>diff --git a/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx b/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsxindex ac3afabf983..aae38169fcd 100644--- a/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx+++ b/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx@@ -55,7 +55,7 @@ const FunctionList = ({if (_functions.length === 0 && filterString.length === 0) {return (<Table.tr key={schema}>- <Table.td colSpan={4}>+ <Table.td colSpan={5}><p className="text-sm text-foreground">No functions created yet</p><p className="text-sm text-light">There are no functions found in the schema "{schema}"@@ -68,7 +68,7 @@ const FunctionList = ({if (_functions.length === 0 && filterString.length > 0) {return (<Table.tr key={schema}>- <Table.td colSpan={4}>+ <Table.td colSpan={5}><p className="text-sm text-foreground">No results found</p><p className="text-sm text-light">Your search for "{filterString}" did not return any resultsdiff --git a/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx b/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsxindex 5c30bcd2918..2d6bc20475f 100644--- a/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx+++ b/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx@@ -15,6 +15,8 @@ import { useSchemasQuery } from 'data/database/schemas-query'import { useCheckPermissions, useStore } from 'hooks'import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'import FunctionList from './FunctionList'+import SchemaSelector from 'components/ui/SchemaSelector'+import ProtectedSchemaWarning from '../../ProtectedSchemaWarning'interface FunctionsListProps {createFunction: () => void@@ -41,7 +43,7 @@ const FunctionsList = ({projectRef: project?.ref,connectionString: project?.connectionString,})- const [protectedSchemas, openSchemas] = partition(schemas ?? [], (schema) =>+ const [protectedSchemas] = partition(schemas ?? [], (schema) =>EXCLUDED_SCHEMAS.includes(schema?.name ?? ''))const schema = schemas?.find((schema) => schema.name === selectedSchema)@@ -83,57 +85,19 @@ const FunctionsList = ({<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- size="small"- value={selectedSchema}- onChange={setSelectedSchema}- icon={isLocked && <IconLock size={14} strokeWidth={2} />}- >- <Listbox.Option- disabled- key="normal-schemas"- value="normal-schemas"- label="Schemas"- >- <p className="text-sm">Schemas</p>- </Listbox.Option>- {/* @ts-ignore */}- {openSchemas.map((schema) => (- <Listbox.Option- key={schema.id}- value={schema.name}- label={schema.name}- addOnBefore={() => <span className="text-foreground-lighter">schema</span>}- >- <span className="text-foreground text-sm">{schema.name}</span>- </Listbox.Option>- ))}- <Listbox.Option- disabled- key="protected-schemas"- value="protected-schemas"- label="Protected schemas"- >- <p className="text-sm">Protected schemas</p>- </Listbox.Option>- {protectedSchemas.map((schema) => (- <Listbox.Option- key={schema.id}- value={schema.name}- label={schema.name}- addOnBefore={() => <span className="text-foreground-lighter">schema</span>}- >- <span className="text-foreground text-sm">{schema.name}</span>- </Listbox.Option>- ))}- </Listbox>- </div>+ <SchemaSelector+ className="w-[260px]"+ size="small"+ showError={false}+ selectedSchemaName={selectedSchema}+ onSelectSchema={setSelectedSchema}+ /><Input- placeholder="Filter by name"+ placeholder="Search for a function"size="small"icon={<IconSearch size="tiny" />}value={filterString}+ className="w-64"onChange={(e) => setFilterString(e.target.value)}/></div>@@ -166,6 +130,8 @@ const FunctionsList = ({</Tooltip.Root></div>+ {isLocked && <ProtectedSchemaWarning schema={selectedSchema} entity="functions" />}+<TableclassName="table-fixed"head={diff --git a/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsx b/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsxindex f6b5951efbb..f17a9405678 100644--- a/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsx+++ b/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsx@@ -83,6 +83,7 @@ const HooksList = ({size="small"icon={<IconSearch size="tiny" />}value={filterString}+ className="w-64"onChange={(e) => setFilterString(e.target.value)}/><div className="flex items-center space-x-2">diff --git a/studio/components/interfaces/Database/Indexes/Indexes.tsx b/studio/components/interfaces/Database/Indexes/Indexes.tsxindex 0b10e00ceec..23561e482ea 100644--- a/studio/components/interfaces/Database/Indexes/Indexes.tsx+++ b/studio/components/interfaces/Database/Indexes/Indexes.tsx@@ -28,6 +28,7 @@ import { useSchemasQuery } from 'data/database/schemas-query'import { useExecuteSqlMutation } from 'data/sql/execute-sql-mutation'import { useStore } from 'hooks'import CreateIndexSidePanel from './CreateIndexSidePanel'+import SchemaSelector from 'components/ui/SchemaSelector'const Indexes = () => {const { ui } = useStore()@@ -96,26 +97,26 @@ const Indexes = () => {<><div className="pb-8"><div className="flex items-center justify-between mb-6">- <div>- <h3 className="mb-1 text-xl text-foreground">Database Indexes</h3>+ <div className="space-y-1">+ <h3 className="text-xl text-foreground">Database Indexes</h3><div className="text-sm text-foreground-lighter">Improve query performance against your database</div></div><div className="flex items-center space-x-2"><Link href="https://supabase.com/docs/guides/database/query-optimization">- <a target="_blank" rel="noreferrer">- <Button type="default" icon={<IconExternalLink strokeWidth={1.5} />}>+ <Button asChild type="default" icon={<IconExternalLink strokeWidth={1.5} />}>+ <a target="_blank" rel="noreferrer">Documentation- </Button>- </a>+ </a>+ </Button></Link><Link href="https://supabase.com/docs/guides/database/extensions/index_advisor">- <a target="_blank" rel="noreferrer">- <Button type="default" icon={<IconExternalLink strokeWidth={1.5} />}>+ <Button asChild type="default" icon={<IconExternalLink strokeWidth={1.5} />}>+ <a target="_blank" rel="noreferrer">Optimization with index_advisor- </Button>- </a>+ </a>+ </Button></Link></div></div>@@ -130,28 +131,18 @@ const Indexes = () => {</div>)}{isSuccessSchemas && (- <Listbox- size="small"- value={selectedSchema}- onChange={setSelectedSchema}+ <SchemaSelectorclassName="w-[260px]"- >- {(schemas ?? []).map((schema) => (- <Listbox.Option- key={schema.name}- value={schema.name}- label={schema.name}- addOnBefore={() => <span className="text-foreground-lighter">schema</span>}- >- {schema.name}- </Listbox.Option>- ))}- </Listbox>+ size="small"+ showError={false}+ selectedSchemaName={selectedSchema}+ onSelectSchema={setSelectedSchema}+ />)}<Inputsize="small"value={search}- className="w-[250px]"+ className="w-64"onChange={(e) => setSearch(e.target.value)}placeholder="Search for an index"icon={<IconSearch size={14} />}diff --git a/studio/components/interfaces/Database/ProtectedSchemaWarning.tsx b/studio/components/interfaces/Database/ProtectedSchemaWarning.tsxnew file mode 100644index 00000000000..32ba97de4bc--- /dev/null+++ b/studio/components/interfaces/Database/ProtectedSchemaWarning.tsx@@ -0,0 +1,82 @@+import { useState } from 'react'+import {+ AlertDescription_Shadcn_,+ AlertTitle_Shadcn_,+ Alert_Shadcn_,+ Button,+ IconAlertCircle,+ Modal,+} from 'ui'++import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'++export const ProtectedSchemaModal = ({+ visible,+ onClose,+}: {+ visible: boolean+ onClose: () => void+}) => {+ return (+ <Modal+ size="medium"+ visible={visible}+ header="Schemas managed by Supabase"+ customFooter={+ <div className="flex items-center justify-end space-x-2">+ <Button type="default" onClick={() => onClose()}>+ Understood+ </Button>+ </div>+ }+ onCancel={() => onClose()}+ >+ <Modal.Content className="py-4 space-y-2">+ <p className="text-sm">+ The following schemas are managed by Supabase and are currently protected from write+ access through the dashboard.+ </p>+ <div className="flex flex-wrap gap-1">+ {EXCLUDED_SCHEMAS.map((schema) => (+ <code key={schema} className="text-xs">+ {schema}+ </code>+ ))}+ </div>+ <p className="text-sm !mt-4">+ These schemas are critical to the functionality of your Supabase project and hence we+ highly recommend not altering them.+ </p>+ <p className="text-sm">+ You can, however, still interact with those schemas through the SQL Editor although we+ advise you only do so if you know what you are doing.+ </p>+ </Modal.Content>+ </Modal>+ )+}++const ProtectedSchemaWarning = ({ schema, entity }: { schema: string; entity: string }) => {+ const [showModal, setShowModal] = useState(false)++ return (+ <>+ <Alert_Shadcn_>+ <IconAlertCircle strokeWidth={2} />+ <AlertTitle_Shadcn_>Currently viewing {entity} from a protected schema</AlertTitle_Shadcn_>+ <AlertDescription_Shadcn_>+ <p className="mb-2">+ The <code className="text-xs">{schema}</code> schema is managed by Supabase and is+ read-only through the dashboard.+ </p>+ <Button type="default" size="tiny" onClick={() => setShowModal(true)}>+ Learn more+ </Button>+ </AlertDescription_Shadcn_>+ </Alert_Shadcn_>+ <ProtectedSchemaModal visible={showModal} onClose={() => setShowModal(false)} />+ </>+ )+}++export default ProtectedSchemaWarningdiff --git a/studio/components/interfaces/Database/Tables/ColumnList.tsx b/studio/components/interfaces/Database/Tables/ColumnList.tsxindex 7bef9790a04..d71422c71c8 100644--- a/studio/components/interfaces/Database/Tables/ColumnList.tsx+++ b/studio/components/interfaces/Database/Tables/ColumnList.tsx@@ -4,22 +4,28 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'import { noop } from 'lodash'import { observer } from 'mobx-react-lite'import { useState } from 'react'--import NoSearchResults from 'components/to-be-cleaned/NoSearchResults'-import Table from 'components/to-be-cleaned/Table'-import { useCheckPermissions, useStore } from 'hooks'-import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'import {Button,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,IconChevronLeft,IconChevronRight,- IconEdit3,+ IconEdit,+ IconMoreVertical,IconPlus,IconSearch,IconTrash,Input,} from 'ui'+import NoSearchResults from 'components/to-be-cleaned/NoSearchResults'+import Table from 'components/to-be-cleaned/Table'+import { useCheckPermissions } from 'hooks'+import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'+import ProtectedSchemaWarning from '../ProtectedSchemaWarning'+interface ColumnListProps {selectedTable: PostgresTableonSelectBack: () => void@@ -35,7 +41,6 @@ const ColumnList = ({onEditColumn = noop,onDeleteColumn = noop,}: ColumnListProps) => {- const { meta } = useStore()const [filterString, setFilterString] = useState<string>('')const columns =(filterString.length === 0@@ -46,8 +51,8 @@ const ColumnList = ({const canUpdateColumns = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'columns')return (- <>- <div className="mb-4 flex items-center space-x-2">+ <div className="space-y-4">+ <div className="flex items-center space-x-2"><div className="flex items-center space-x-2"><h3 className="mb-1 text-xl text-foreground">Database Tables</h3><IconChevronRight strokeWidth={1.5} className="text-light" />@@ -55,62 +60,58 @@ const ColumnList = ({</div></div>- <div className="mb-4">- <div className="flex items-center justify-between">- <div className="flex items-center">- <div className="flex items-center mr-4">- <Button- type="outline"- className="mr-4"- onClick={() => onSelectBack()}- icon={<IconChevronLeft size="small" />}- style={{ padding: '5px' }}- />- </div>- <div>- <Input- size="small"- placeholder="Filter columns"- value={filterString}- onChange={(e: any) => setFilterString(e.target.value)}- icon={<IconSearch size="tiny" />}- />- </div>- </div>- {!isLocked && (- <div>- <Tooltip.Root delayDuration={0}>- <Tooltip.Trigger>- <Button- disabled={!canUpdateColumns}- icon={<IconPlus />}- onClick={() => onAddColumn()}- >- New column- </Button>- </Tooltip.Trigger>- {!canUpdateColumns && (- <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-foreground">- You need additional permissions to create columns- </span>- </div>- </Tooltip.Content>- </Tooltip.Portal>- )}- </Tooltip.Root>- </div>- )}+ <div className="flex items-center justify-between">+ <div className="flex items-center space-x-4">+ <Button+ type="outline"+ onClick={() => onSelectBack()}+ icon={<IconChevronLeft size="small" />}+ style={{ padding: '5px' }}+ />+ <Input+ size="small"+ placeholder="Filter columns"+ value={filterString}+ onChange={(e: any) => setFilterString(e.target.value)}+ icon={<IconSearch size="tiny" />}+ /></div>+ {!isLocked && (+ <div>+ <Tooltip.Root delayDuration={0}>+ <Tooltip.Trigger>+ <Button+ disabled={!canUpdateColumns}+ icon={<IconPlus />}+ onClick={() => onAddColumn()}+ >+ New column+ </Button>+ </Tooltip.Trigger>+ {!canUpdateColumns && (+ <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-foreground">+ You need additional permissions to create columns+ </span>+ </div>+ </Tooltip.Content>+ </Tooltip.Portal>+ )}+ </Tooltip.Root>+ </div>+ )}</div>++ {isLocked && <ProtectedSchemaWarning schema={selectedTable.schema} entity="columns" />}+{columns.length === 0 ? (<NoSearchResults />) : (@@ -147,73 +148,82 @@ const ColumnList = ({<Table.td className="font-mono text-xs"><code className="text-xs">{x.format}</code></Table.td>- <Table.td className="px-4 py-3 pr-2">- <div className="flex justify-end gap-2">- <Tooltip.Root delayDuration={0}>- <Tooltip.Trigger>- <Button+ <Table.td className="text-right">+ {!isLocked && (+ <DropdownMenu>+ <DropdownMenuTrigger>+ <Button asChild type="default" icon={<IconMoreVertical />} className="px-1">+ <span />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent side="bottom" align="end" className="w-32">+ <DropdownMenuItem+ disabled={!canUpdateColumns}onClick={() => onEditColumn(x)}- icon={<IconEdit3 />}- style={{ padding: 5 }}- type="text"- disabled={!canUpdateColumns || isLocked}- />- </Tooltip.Trigger>- {!canUpdateColumns && (- <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-foreground">- You need additional permissions to edit columns- </span>- </div>- </Tooltip.Content>- </Tooltip.Portal>- )}- </Tooltip.Root>+ >+ <Tooltip.Root delayDuration={0}>+ <Tooltip.Trigger className="flex items-center space-x-2">+ <IconEdit size="tiny" />+ <p>Edit column</p>+ </Tooltip.Trigger>+ {!canUpdateColumns && (+ <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-foreground">+ Additional permissions required to edit column+ </span>+ </div>+ </Tooltip.Content>+ </Tooltip.Portal>+ )}+ </Tooltip.Root>+ </DropdownMenuItem>- <Tooltip.Root delayDuration={0}>- <Tooltip.Trigger>- <Button- onClick={() => onDeleteColumn(x)}- icon={<IconTrash />}- style={{ padding: 5 }}- type="text"+ <DropdownMenuItemdisabled={!canUpdateColumns || isLocked}- />- </Tooltip.Trigger>- {!canUpdateColumns && (- <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-foreground">- You need additional permissions to delete columns- </span>- </div>- </Tooltip.Content>- </Tooltip.Portal>- )}- </Tooltip.Root>- </div>+ onClick={() => onDeleteColumn(x)}+ >+ <Tooltip.Root delayDuration={0}>+ <Tooltip.Trigger className="flex items-center space-x-2">+ <IconTrash stroke="red" size="tiny" />+ <p>Delete column</p>+ </Tooltip.Trigger>+ {!canUpdateColumns && (+ <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-foreground">+ Additional permissions required to edit column+ </span>+ </div>+ </Tooltip.Content>+ </Tooltip.Portal>+ )}+ </Tooltip.Root>+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ )}</Table.td></Table.tr>))}/></div>)}- </>+ </div>)}diff --git a/studio/components/interfaces/Database/Tables/TableList.tsx b/studio/components/interfaces/Database/Tables/TableList.tsxindex 3de74dded2f..95985d1b08a 100644--- a/studio/components/interfaces/Database/Tables/TableList.tsx+++ b/studio/components/interfaces/Database/Tables/TableList.tsx@@ -8,7 +8,8 @@ import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectConteimport NoSearchResults from 'components/to-be-cleaned/NoSearchResults'import Table from 'components/to-be-cleaned/Table'import AlertError from 'components/ui/AlertError'-import ShimmeringLoader, { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'+import SchemaSelector from 'components/ui/SchemaSelector'+import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'import { useSchemasQuery } from 'data/database/schemas-query'import { useTablesQuery } from 'data/tables/tables-query'import { useCheckPermissions, useStore } from 'hooks'@@ -16,16 +17,21 @@ import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'import { useTableEditorStateSnapshot } from 'state/table-editor'import {Button,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,IconCheck,IconColumns,- IconEdit3,- IconLock,+ IconEdit,+ IconMoreVertical,IconPlus,IconSearch,IconTrash,+ IconX,Input,- Listbox,} from 'ui'+import ProtectedSchemaWarning from '../ProtectedSchemaWarning'interface TableListProps {onAddTable: () => void@@ -47,15 +53,11 @@ const TableList = ({const [filterString, setFilterString] = useState<string>('')const canUpdateTables = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'tables')- const {- data: schemas,- isLoading: isLoadingSchemas,- isSuccess: isSuccessSchemas,- } = useSchemasQuery({+ const { data: schemas } = useSchemasQuery({projectRef: project?.ref,connectionString: project?.connectionString,})- const [protectedSchemas, openSchemas] = partition(schemas ?? [], (schema) =>+ const [protectedSchemas] = partition(schemas ?? [], (schema) =>EXCLUDED_SCHEMAS.includes(schema?.name ?? ''))@@ -89,70 +91,26 @@ const TableList = ({const isLocked = protectedSchemas.some((s) => s.id === schema?.id)return (- <>- <div className="mb-4">- <h3 className="mb-1 text-xl text-foreground">Database Tables</h3>- </div>+ <div className="space-y-4">+ <h3 className="mb-1 text-xl text-foreground">Database Tables</h3><div className="flex items-center justify-between"><div className="flex items-center space-x-4">- <div className="w-[260px]">- {isLoadingSchemas && <ShimmeringLoader className="!py-4" />}- {isSuccessSchemas && (- <Listbox- size="small"- value={snap.selectedSchemaName}- onChange={snap.setSelectedSchemaName}- icon={isLocked && <IconLock size={14} strokeWidth={2} />}- >- <Listbox.Option- disabled- key="normal-schemas"- value="normal-schemas"- label="Schemas"- >- <p className="text-sm">Schemas</p>- </Listbox.Option>- {openSchemas.map((schema) => (- <Listbox.Option- key={schema.id}- value={schema.name}- label={schema.name}- addOnBefore={() => <span className="text-foreground-lighter">schema</span>}- >- <span className="text-foreground text-sm">{schema.name}</span>- </Listbox.Option>- ))}- <Listbox.Option- disabled- key="protected-schemas"- value="protected-schemas"- label="Protected schemas"- >- <p className="text-sm">Protected schemas</p>- </Listbox.Option>- {protectedSchemas.map((schema) => (- <Listbox.Option- key={schema.id}- value={schema.name}- label={schema.name}- addOnBefore={() => <span className="text-foreground-lighter">schema</span>}- >- <span className="text-foreground text-sm">{schema.name}</span>- </Listbox.Option>- ))}- </Listbox>- )}- </div>- <div>- <Input- size="small"- placeholder="Filter tables"- value={filterString}- onChange={(e: any) => setFilterString(e.target.value)}- icon={<IconSearch size="tiny" />}- />- </div>+ <SchemaSelector+ className="w-[260px]"+ size="small"+ showError={false}+ selectedSchemaName={snap.selectedSchemaName}+ onSelectSchema={snap.setSelectedSchemaName}+ />+ <Input+ size="small"+ className="w-64"+ placeholder="Search for a table"+ value={filterString}+ onChange={(e: any) => setFilterString(e.target.value)}+ icon={<IconSearch size="tiny" />}+ /></div>{!isLocked && (@@ -189,11 +147,9 @@ const TableList = ({)}</div>- {isLoading && (- <div className="py-4 space-y-2">- <GenericSkeletonLoader />- </div>- )}+ {isLocked && <ProtectedSchemaWarning schema={snap.selectedSchemaName} entity="tables" />}++ {isLoading && <GenericSkeletonLoader />}{isError && <AlertError error={error} subject="Failed to retrieve tables" />}@@ -208,10 +164,10 @@ const TableList = ({<Table.th key="description" className="hidden lg:table-cell">Description</Table.th>,- <Table.th key="rows" className="hidden xl:table-cell">+ <Table.th key="rows" className="hidden text-right xl:table-cell">Rows (Estimated)</Table.th>,- <Table.th key="size" className="hidden xl:table-cell">+ <Table.th key="size" className="hidden text-right xl:table-cell">Size (Estimated)</Table.th>,<Table.th key="realtime" className="hidden xl:table-cell text-center">@@ -254,20 +210,22 @@ const TableList = ({<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 className="hidden text-right xl:table-cell">+ {(x.live_rows_estimate ?? x.live_row_count).toLocaleString()}</Table.td>- <Table.td className="hidden xl:table-cell">+ <Table.td className="hidden text-right 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} className="text-brand" />+ </div>+ ) : (<div className="flex justify-center">- <IconCheck strokeWidth={2} />+ <IconX strokeWidth={2} className="text-foreground-lighter" /></div>)}</Table.td>@@ -283,63 +241,79 @@ const TableList = ({{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-foreground">- You need additional permissions to edit tables- </span>- </div>- </Tooltip.Content>- </Tooltip.Portal>- )}- </Tooltip.Root>+ {!isLocked && (+ <DropdownMenu>+ <DropdownMenuTrigger>+ <Button+ asChild+ type="default"+ icon={<IconMoreVertical />}+ className="px-1"+ >+ <span />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent side="bottom" align="end" className="w-32">+ <DropdownMenuItem+ disabled={!canUpdateTables}+ onClick={() => onEditTable(x)}+ >+ <Tooltip.Root delayDuration={0}>+ <Tooltip.Trigger className="flex items-center space-x-2">+ <IconEdit size="tiny" />+ <p>Edit table</p>+ </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-foreground">+ Additional permissions required to edit table+ </span>+ </div>+ </Tooltip.Content>+ </Tooltip.Portal>+ )}+ </Tooltip.Root>+ </DropdownMenuItem>- <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-foreground">- You need additional permissions to delete tables- </span>- </div>- </Tooltip.Content>- </Tooltip.Portal>- )}- </Tooltip.Root>+ <DropdownMenuItem+ disabled={!canUpdateTables || isLocked}+ onClick={() => onDeleteTable(x)}+ >+ <Tooltip.Root delayDuration={0}>+ <Tooltip.Trigger className="flex items-center space-x-2">+ <IconTrash stroke="red" size="tiny" />+ <p>Delete table</p>+ </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-foreground">+ Additional permissions required to delete table+ </span>+ </div>+ </Tooltip.Content>+ </Tooltip.Portal>+ )}+ </Tooltip.Root>+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ )}</div></Table.td></Table.tr>@@ -349,7 +323,7 @@ const TableList = ({/></div>))}- </>+ </div>)}diff --git a/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx b/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsxindex f02e66ff723..3725969b82b 100644--- a/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx+++ b/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx@@ -113,21 +113,19 @@ const TriggerList = ({{canUpdateTriggers ? (<DropdownMenu><DropdownMenuTrigger>- <Button asChild type="default" icon={<IconMoreVertical />}>- <span></span>+ <Button asChild type="default" className="px-1" icon={<IconMoreVertical />}>+ <span /></Button></DropdownMenuTrigger>- <DropdownMenuContent side="bottom" align="end">- <>- <DropdownMenuItem className="space-x-2" onClick={() => editTrigger(x)}>- <IconEdit3 size="tiny" />- <p>Edit trigger</p>- </DropdownMenuItem>- <DropdownMenuItem className="space-x-2" onClick={() => deleteTrigger(x)}>- <IconTrash stroke="red" size="tiny" />- <p>Delete trigger</p>- </DropdownMenuItem>- </>+ <DropdownMenuContent side="bottom" align="end" className="w-36">+ <DropdownMenuItem className="space-x-2" onClick={() => editTrigger(x)}>+ <IconEdit3 size="tiny" />+ <p>Edit trigger</p>+ </DropdownMenuItem>+ <DropdownMenuItem className="space-x-2" onClick={() => deleteTrigger(x)}>+ <IconTrash stroke="red" size="tiny" />+ <p>Delete trigger</p>+ </DropdownMenuItem></DropdownMenuContent></DropdownMenu>) : (diff --git a/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx b/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsxindex 2f4ce037494..5d833df63fe 100644--- a/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx+++ b/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx@@ -3,18 +3,20 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'import { noop, partition } from 'lodash'import { observer } from 'mobx-react-lite'import { useState } from 'react'-import { Button, IconLock, IconSearch, Input, Listbox } from 'ui'+import { Button, IconSearch, Input } from 'ui'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'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 SchemaSelector from 'components/ui/SchemaSelector'import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'import { useSchemasQuery } from 'data/database/schemas-query'import { useCheckPermissions, useStore } from 'hooks'import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'import TriggerList from './TriggerList'+import ProtectedSchemaWarning from '../../ProtectedSchemaWarning'interface TriggersListProps {createTrigger: () => void@@ -36,7 +38,7 @@ const TriggersList = ({projectRef: project?.ref,connectionString: project?.connectionString,})- const [protectedSchemas, openSchemas] = partition(schemas ?? [], (schema) =>+ const [protectedSchemas] = partition(schemas ?? [], (schema) =>EXCLUDED_SCHEMAS.includes(schema?.name ?? ''))const schema = schemas?.find((schema) => schema.name === selectedSchema)@@ -77,57 +79,19 @@ const TriggersList = ({<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- size="small"- value={selectedSchema}- onChange={setSelectedSchema}- icon={isLocked && <IconLock size={14} strokeWidth={2} />}- >- <Listbox.Option- disabled- key="normal-schemas"- value="normal-schemas"- label="Schemas"- >- <p className="text-sm">Schemas</p>- </Listbox.Option>- {/* @ts-ignore */}- {openSchemas.map((schema) => (- <Listbox.Option- key={schema.id}- value={schema.name}- label={schema.name}- addOnBefore={() => <span className="text-foreground-lighter">schema</span>}- >- <span className="text-foreground text-sm">{schema.name}</span>- </Listbox.Option>- ))}- <Listbox.Option- disabled- key="protected-schemas"- value="protected-schemas"- label="Protected schemas"- >- <p className="text-sm">Protected schemas</p>- </Listbox.Option>- {protectedSchemas.map((schema) => (- <Listbox.Option- key={schema.id}- value={schema.name}- label={schema.name}- addOnBefore={() => <span className="text-foreground-lighter">schema</span>}- >- <span className="text-foreground text-sm">{schema.name}</span>- </Listbox.Option>- ))}- </Listbox>- </div>+ <SchemaSelector+ className="w-[260px]"+ size="small"+ showError={false}+ selectedSchemaName={selectedSchema}+ onSelectSchema={setSelectedSchema}+ /><Input- placeholder="Filter by name"+ placeholder="Search for a trigger"size="small"icon={<IconSearch size="tiny" />}value={filterString}+ className="w-64"onChange={(e) => setFilterString(e.target.value)}/></div>@@ -158,6 +122,8 @@ const TriggersList = ({</Tooltip.Root></div>+ {isLocked && <ProtectedSchemaWarning schema={selectedSchema} entity="triggers" />}+<TableclassName="table-fixed"head={diff --git a/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx b/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsxindex 7ec9758f765..220d087b7ff 100644--- a/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx+++ b/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx@@ -21,9 +21,9 @@ import {IconX,Input,Menu,- Modal,} from 'ui'+import { ProtectedSchemaModal } from 'components/interfaces/Database/ProtectedSchemaWarning'import InfiniteList from 'components/ui/InfiniteList'import SchemaSelector from 'components/ui/SchemaSelector'import { useSchemasQuery } from 'data/database/schemas-query'@@ -302,41 +302,7 @@ const TableEditorMenu = () => {)}</div>- <Modal- size="medium"- visible={showModal}- header="Schemas managed by Supabase"- customFooter={- <div className="flex items-center justify-end space-x-2">- <Button type="default" onClick={() => setShowModal(false)}>- Understood- </Button>- </div>- }- onCancel={() => setShowModal(false)}- >- <Modal.Content className="py-4 space-y-2">- <p className="text-sm">- The following schemas are managed by Supabase and are currently protected from write- access through the Table Editor.- </p>- <div className="flex flex-wrap gap-1">- {EXCLUDED_SCHEMAS.map((schema) => (- <code key={schema} className="text-xs">- {schema}- </code>- ))}- </div>- <p className="text-sm !mt-4">- These schemas are critical to the functionality of your Supabase project and hence we- highly recommend not altering them.- </p>- <p className="text-sm">- You can, however, still interact with those schemas through the SQL Editor although we- advise you only do so if you know what you are doing.- </p>- </Modal.Content>- </Modal>+ <ProtectedSchemaModal visible={showModal} onClose={() => setShowModal(false)} /></>)}diff --git a/studio/pages/project/[ref]/database/extensions.tsx b/studio/pages/project/[ref]/database/extensions.tsxindex 89ea5c976f6..7846c81f6e8 100644--- a/studio/pages/project/[ref]/database/extensions.tsx+++ b/studio/pages/project/[ref]/database/extensions.tsx@@ -21,9 +21,7 @@ const DatabaseExtensions: NextPageWithLayout = () => {<ScaffoldContainer><ScaffoldSection><div className="col-span-12">- <div className="mb-4">- <h3 className="mb-1 text-xl text-foreground">Database Extensions</h3>- </div>+ <h3 className="mb-4 text-xl text-foreground">Database Extensions</h3><Extensions /></div></ScaffoldSection>diff --git a/studio/pages/project/[ref]/database/functions.tsx b/studio/pages/project/[ref]/database/functions.tsxindex 36fa02edb3e..de2d6a07759 100644--- a/studio/pages/project/[ref]/database/functions.tsx+++ b/studio/pages/project/[ref]/database/functions.tsx@@ -19,15 +19,9 @@ const FunctionsPage: NextPageWithLayout = () => {const canReadFunctions = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_READ, 'functions')useEffect(() => {- if (ui.selectedProjectRef) {- fetchFunctions()- }+ if (ui.selectedProjectRef) meta.functions.load()}, [ui.selectedProjectRef])- const fetchFunctions = async () => {- meta.functions.load()- }-const createFunction = () => {setSelectedFunction(undefined)setShowCreateFunctionForm(true)@@ -52,9 +46,7 @@ const FunctionsPage: NextPageWithLayout = () => {<ScaffoldContainer><ScaffoldSection><div className="col-span-12">- <div className="mb-4">- <h3 className="mb-1 text-xl text-foreground">Database Functions</h3>- </div>+ <h3 className=" mb-4 text-xl text-foreground">Database Functions</h3><FunctionsListcreateFunction={createFunction}editFunction={editFunction}diff --git a/studio/pages/project/[ref]/database/schemas.tsx b/studio/pages/project/[ref]/database/schemas.tsxindex d6737367a75..a7dbe56d6a0 100644--- a/studio/pages/project/[ref]/database/schemas.tsx+++ b/studio/pages/project/[ref]/database/schemas.tsx@@ -9,6 +9,7 @@ import { useSchemasQuery } from 'data/database/schemas-query'import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'import { NextPageWithLayout } from 'types'import { IconLock, Listbox } from 'ui'+import SchemaSelector from 'components/ui/SchemaSelector'const SchemasPage: NextPageWithLayout = () => {const { project } = useProjectContext()@@ -40,45 +41,13 @@ const SchemasPage: NextPageWithLayout = () => {{isError && <AlertError error={error} subject="Failed to retrieve schemas" />}{isSuccess && (- <Listbox+ <SchemaSelectorclassName="w-[260px]"size="small"- value={selectedSchema}- onChange={setSelectedSchema}- icon={isLocked && <IconLock size={14} strokeWidth={2} />}- >- <Listbox.Option disabled key="normal-schemas" value="normal-schemas" label="Schemas">- <p className="text-sm">Schemas</p>- </Listbox.Option>- {openSchemas.map((schema) => (- <Listbox.Option- key={schema.id}- value={schema.name}- label={schema.name}- addOnBefore={() => <span className="text-foreground-lighter">schema</span>}- >- <span className="text-foreground text-sm">{schema.name}</span>- </Listbox.Option>- ))}- <Listbox.Option- disabled- key="protected-schemas"- value="protected-schemas"- label="Protected schemas"- >- <p className="text-sm">Protected schemas</p>- </Listbox.Option>- {protectedSchemas.map((schema) => (- <Listbox.Option- key={schema.id}- value={schema.name}- label={schema.name}- addOnBefore={() => <span className="text-foreground-lighter">schema</span>}- >- <span className="text-foreground text-sm">{schema.name}</span>- </Listbox.Option>- ))}- </Listbox>+ showError={false}+ selectedSchemaName={selectedSchema}+ onSelectSchema={setSelectedSchema}+ />)}</div>diff --git a/studio/pages/project/[ref]/database/triggers.tsx b/studio/pages/project/[ref]/database/triggers.tsxindex be05f80951e..be69016d186 100644--- a/studio/pages/project/[ref]/database/triggers.tsx+++ b/studio/pages/project/[ref]/database/triggers.tsx@@ -5,16 +5,13 @@ import { useEffect, useState } from 'react'import { CreateTrigger, DeleteTrigger } from 'components/interfaces/Database'import TriggersList from 'components/interfaces/Database/Triggers/TriggersList/TriggersList'import { DatabaseLayout } from 'components/layouts'-import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'+import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'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, ui } = useStore()- const { project } = useProjectContext()-const [selectedTrigger, setSelectedTrigger] = useState<any>()const [showCreateTriggerForm, setShowCreateTriggerForm] = useState<boolean>(false)const [showDeleteTriggerForm, setShowDeleteTriggerForm] = useState<boolean>(false)@@ -22,13 +19,9 @@ const TriggersPage: NextPageWithLayout = () => {const canReadTriggers = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_READ, 'triggers')useEffect(() => {- if (ui.selectedProjectRef) fetchTriggers()+ if (ui.selectedProjectRef) meta.triggers.load()}, [ui.selectedProjectRef])- const fetchTriggers = async () => {- meta.triggers.load()- }-const createTrigger = () => {setSelectedTrigger(undefined)setShowCreateTriggerForm(true)@@ -53,9 +46,7 @@ const TriggersPage: NextPageWithLayout = () => {<ScaffoldContainer><ScaffoldSection><div className="col-span-12">- <div className="mb-4">- <h3 className="mb-1 text-xl text-foreground">Database Triggers</h3>- </div>+ <h3 className="mb-4 text-xl text-foreground">Database Triggers</h3><TriggersListcreateTrigger={createTrigger}editTrigger={editTrigger}diff --git a/studio/pages/project/[ref]/database/types.tsx b/studio/pages/project/[ref]/database/types.tsxindex 20e5cff9e9f..71a28efef30 100644--- a/studio/pages/project/[ref]/database/types.tsx+++ b/studio/pages/project/[ref]/database/types.tsx@@ -33,7 +33,7 @@ const DatabaseEnumeratedTypes: NextPageWithLayout = () => {</Link></div></ScaffoldSectionDetail>- <div className="col-span-12 mt-6">+ <div className="col-span-12 mt-3"><EnumeratedTypes /></div></ScaffoldSection>