The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix layouts and make sure buttons are visible in smol screens (#28939)
Jordi Enric3fa447d57d36
diff --git a/apps/studio/components/grid/components/header/Header.tsx b/apps/studio/components/grid/components/header/Header.tsxindex 7f85c63f73b..35fc3f28350 100644--- a/apps/studio/components/grid/components/header/Header.tsx+++ b/apps/studio/components/grid/components/header/Header.tsx@@ -64,7 +64,7 @@ const Header = ({return (<div>- <div className="flex h-10 items-center justify-between bg-dash-sidebar px-5 py-1.5">+ <div className="flex h-10 items-center justify-between bg-dash-sidebar px-5 py-1.5 gap-2 overflow-x-auto">{customHeader ? (<>{customHeader}</>) : (diff --git a/apps/studio/components/interfaces/Database/EnumeratedTypes/EnumeratedTypes.tsx b/apps/studio/components/interfaces/Database/EnumeratedTypes/EnumeratedTypes.tsxindex cc39663d5dc..fe8588e085b 100644--- a/apps/studio/components/interfaces/Database/EnumeratedTypes/EnumeratedTypes.tsx+++ b/apps/studio/components/interfaces/Database/EnumeratedTypes/EnumeratedTypes.tsx@@ -59,26 +59,25 @@ const EnumeratedTypes = () => {return (<div className="space-y-4">- <div className="flex items-center justify-between">- <div className="flex items-center space-x-2">- <SchemaSelector- className="w-[260px]"- size="small"- showError={false}- selectedSchemaName={selectedSchema}- onSelectSchema={setSelectedSchema}- />- <Input- size="small"- value={search}- className="w-64"- onChange={(e) => setSearch(e.target.value)}- placeholder="Search for a type"- icon={<Search size={14} />}- />- </div>+ <div className="flex items-center gap-2 flex-wrap">+ <SchemaSelector+ className="w-[260px]"+ size="small"+ showError={false}+ selectedSchemaName={selectedSchema}+ onSelectSchema={setSelectedSchema}+ />+ <Input+ size="small"+ value={search}+ className="w-64"+ onChange={(e) => setSearch(e.target.value)}+ placeholder="Search for a type"+ icon={<Search size={14} />}+ />+{!isLocked && (- <Button type="primary" onClick={() => setShowCreateTypePanel(true)}>+ <Button className="ml-auto" type="primary" onClick={() => setShowCreateTypePanel(true)}>Create type</Button>)}diff --git a/apps/studio/components/interfaces/Database/Extensions/Extensions.tsx b/apps/studio/components/interfaces/Database/Extensions/Extensions.tsxindex 7b2ccb00609..4fac7a2a4cf 100644--- a/apps/studio/components/interfaces/Database/Extensions/Extensions.tsx+++ b/apps/studio/components/interfaces/Database/Extensions/Extensions.tsx@@ -55,7 +55,7 @@ const Extensions = () => {return (<><div className="mb-4">- <div className="flex items-center justify-between">+ <div className="flex items-center gap-2 flex-wrap"><Inputsize="small"placeholder="Search for an extension"@@ -72,7 +72,7 @@ const Extensions = () => {/></div>) : (- <Button asChild type="default" icon={<ExternalLink />}>+ <Button className="ml-auto" asChild type="default" icon={<ExternalLink />}><Linkhref="https://supabase.com/docs/guides/database/extensions"target="_blank"diff --git a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsxindex 6de20b1f904..c86f4e08d2d 100644--- a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx+++ b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionList.tsx@@ -88,17 +88,15 @@ const FunctionList = ({<Table.td className="truncate"><p title={x.name}>{x.name}</p></Table.td>- <Table.td className="hidden md:table-cell md:overflow-auto">+ <Table.td className="table-cell overflow-auto"><p title={x.argument_types} className="truncate">{x.argument_types || '-'}</p></Table.td>- <Table.td className="hidden lg:table-cell">+ <Table.td className="table-cell"><p title={x.return_type}>{x.return_type}</p></Table.td>- <Table.td className="hidden lg:table-cell">- {x.security_definer ? 'Definer' : 'Invoker'}- </Table.td>+ <Table.td className="table-cell">{x.security_definer ? 'Definer' : 'Invoker'}</Table.td><Table.td className="text-right">{!isLocked && (<div className="flex items-center justify-end">diff --git a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsxindex 2dfa7f6a0b9..759a4dac823 100644--- a/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx+++ b/apps/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx@@ -98,7 +98,7 @@ const FunctionsList = ({</div>) : (<div className="w-full space-y-4">- <div className="flex items-center justify-between">+ <div className="flex items-center justify-between gap-2 flex-wrap"><div className="flex items-center space-x-4"><SchemaSelectorclassName="w-[260px]"@@ -141,17 +141,17 @@ const FunctionsList = ({{isLocked && <ProtectedSchemaWarning schema={selectedSchema} entity="functions" />}<Table- className="table-fixed"+ className="table-fixed overflow-x-auto"head={<><Table.th key="name">Name</Table.th>- <Table.th key="arguments" className="hidden md:table-cell">+ <Table.th key="arguments" className="table-cell">Arguments</Table.th>- <Table.th key="return_type" className="hidden lg:table-cell">+ <Table.th key="return_type" className="table-cell">Return type</Table.th>- <Table.th key="security" className="hidden lg:table-cell w-[100px]">+ <Table.th key="security" className="table-cell w-[100px]">Security</Table.th><Table.th key="buttons" className="w-1/6"></Table.th>diff --git a/apps/studio/components/interfaces/Database/Indexes/Indexes.tsx b/apps/studio/components/interfaces/Database/Indexes/Indexes.tsxindex ee68475a0a5..d3e1444e1ff 100644--- a/apps/studio/components/interfaces/Database/Indexes/Indexes.tsx+++ b/apps/studio/components/interfaces/Database/Indexes/Indexes.tsx@@ -98,35 +98,35 @@ const Indexes = () => {<><div className="pb-8"><div className="flex flex-col gap-y-4">- <div className="flex items-center justify-between">- <div className="flex items-center space-x-2">- {isLoadingSchemas && <ShimmeringLoader className="w-[260px]" />}- {isErrorSchemas && (- <div className="w-[260px] text-foreground-light text-sm border px-3 py-1.5 rounded flex items-center space-x-2">- <IconAlertCircle strokeWidth={2} size={16} />- <p>Failed to load schemas</p>- </div>- )}- {isSuccessSchemas && (- <SchemaSelector- className="w-[260px]"- size="small"- showError={false}- selectedSchemaName={selectedSchema}- onSelectSchema={setSelectedSchema}- />- )}- <Input+ <div className="flex items-center gap-2 flex-wrap">+ {isLoadingSchemas && <ShimmeringLoader className="w-[260px]" />}+ {isErrorSchemas && (+ <div className="w-[260px] text-foreground-light text-sm border px-3 py-1.5 rounded flex items-center space-x-2">+ <IconAlertCircle strokeWidth={2} size={16} />+ <p>Failed to load schemas</p>+ </div>+ )}+ {isSuccessSchemas && (+ <SchemaSelector+ className="w-[260px]"size="small"- value={search}- className="w-64"- onChange={(e) => setSearch(e.target.value)}- placeholder="Search for an index"- icon={<IconSearch size={14} />}+ showError={false}+ selectedSchemaName={selectedSchema}+ onSelectSchema={setSelectedSchema}/>- </div>+ )}+ <Input+ size="small"+ value={search}+ className="w-64"+ onChange={(e) => setSearch(e.target.value)}+ placeholder="Search for an index"+ icon={<IconSearch size={14} />}+ />+{!isLocked && (<Button+ className="ml-auto"type="primary"onClick={() => setShowCreateIndex(true)}disabled={!isSuccessSchemas}diff --git a/apps/studio/components/interfaces/Database/Publications/PublicationsList.tsx b/apps/studio/components/interfaces/Database/Publications/PublicationsList.tsxindex 7ed868f1e47..3d214c6367c 100644--- a/apps/studio/components/interfaces/Database/Publications/PublicationsList.tsx+++ b/apps/studio/components/interfaces/Database/Publications/PublicationsList.tsx@@ -98,78 +98,68 @@ const PublicationsList = ({ onSelectPublication = noop }: PublicationsListProps)</div></div>- <div className="overflow-hidden rounded">- <Table- head={[- <Table.th key="header.name" style={{ width: '25%' }}>- Name- </Table.th>,- <Table.th key="header.id" className="hidden lg:table-cell" style={{ width: '25%' }}>- System ID- </Table.th>,- <Table.th key="header.insert">Insert</Table.th>,- <Table.th key="header.update">Update</Table.th>,- <Table.th key="header.delete">Delete</Table.th>,- <Table.th key="header.truncate">Truncate</Table.th>,- <Table.th key="header.source" className="text-right">- Source- </Table.th>,- ]}- body={- isLoading- ? Array.from({ length: 5 }).map((_, i) => <PublicationSkeleton key={i} index={i} />)- : publications.map((x) => (- <Table.tr className="border-t" key={x.name}>- <Table.td className="px-4 py-3" style={{ width: '25%' }}>- {x.name}+ <Table+ head={[+ <Table.th key="header.name">Name</Table.th>,+ <Table.th key="header.id">System ID</Table.th>,+ <Table.th key="header.insert">Insert</Table.th>,+ <Table.th key="header.update">Update</Table.th>,+ <Table.th key="header.delete">Delete</Table.th>,+ <Table.th key="header.truncate">Truncate</Table.th>,+ <Table.th key="header.source" className="text-right">+ Source+ </Table.th>,+ ]}+ body={+ isLoading+ ? Array.from({ length: 5 }).map((_, i) => <PublicationSkeleton key={i} index={i} />)+ : publications.map((x) => (+ <Table.tr className="border-t" key={x.name}>+ <Table.td className="px-4 py-3">{x.name}</Table.td>+ <Table.td>{x.id}</Table.td>+ {publicationEvents.map((event) => (+ <Table.td key={event.key}>+ <Toggle+ size="tiny"+ checked={(x as any)[event.key]}+ disabled={!canUpdatePublications}+ onChange={() => {+ setToggleListenEventValue({+ publication: x,+ event,+ currentStatus: (x as any)[event.key],+ })+ }}+ /></Table.td>- <Table.td className="hidden lg:table-cell" style={{ width: '25%' }}>- {x.id}- </Table.td>- {publicationEvents.map((event) => (- <Table.td key={event.key}>- <Toggle- size="tiny"- checked={(x as any)[event.key]}- disabled={!canUpdatePublications}- onChange={() => {- setToggleListenEventValue({- publication: x,- event,- currentStatus: (x as any)[event.key],- })- }}- />- </Table.td>- ))}- <Table.td className="px-4 py-3 pr-2">- <div className="flex justify-end gap-2">- <Button- type="default"- style={{ paddingTop: 3, paddingBottom: 3 }}- onClick={() => onSelectPublication(x.id)}- >- {x.tables == null- ? 'All tables'- : `${x.tables.length} ${- x.tables.length > 1 || x.tables.length == 0 ? 'tables' : 'table'- }`}- </Button>- </div>- </Table.td>- </Table.tr>- ))- }- />+ ))}+ <Table.td className="px-4 py-3 pr-2">+ <div className="flex justify-end gap-2">+ <Button+ type="default"+ style={{ paddingTop: 3, paddingBottom: 3 }}+ onClick={() => onSelectPublication(x.id)}+ >+ {x.tables == null+ ? 'All tables'+ : `${x.tables.length} ${+ x.tables.length > 1 || x.tables.length == 0 ? 'tables' : 'table'+ }`}+ </Button>+ </div>+ </Table.td>+ </Table.tr>+ ))+ }+ />- {!isLoading && publications.length === 0 && (- <NoSearchResults- searchString={filterString}- onResetFilter={() => setFilterString('')}- className="rounded-t-none border-t-0"- />- )}- </div>+ {!isLoading && publications.length === 0 && (+ <NoSearchResults+ searchString={filterString}+ onResetFilter={() => setFilterString('')}+ className="rounded-t-none border-t-0"+ />+ )}<ConfirmationModalvisible={toggleListenEventValue !== null}diff --git a/apps/studio/components/interfaces/Database/Roles/RolesList.tsx b/apps/studio/components/interfaces/Database/Roles/RolesList.tsxindex 8384bd4dbe6..3c934d37b9d 100644--- a/apps/studio/components/interfaces/Database/Roles/RolesList.tsx+++ b/apps/studio/components/interfaces/Database/Roles/RolesList.tsx@@ -59,7 +59,7 @@ const RolesList = () => {return (<>- <div className="mb-4 flex items-center justify-between">+ <div className="mb-4 flex items-center justify-between gap-2 flex-wrap"><div className="flex items-center space-x-4"><Inputsize="small"diff --git a/apps/studio/components/interfaces/Database/Tables/ColumnList.tsx b/apps/studio/components/interfaces/Database/Tables/ColumnList.tsxindex 8626d46b84e..a5999f82dc1 100644--- a/apps/studio/components/interfaces/Database/Tables/ColumnList.tsx+++ b/apps/studio/components/interfaces/Database/Tables/ColumnList.tsx@@ -10,6 +10,7 @@ import { useParams } from 'common'import NoSearchResults from 'components/to-be-cleaned/NoSearchResults'import Table from 'components/to-be-cleaned/Table'import AlertError from 'components/ui/AlertError'+import { ButtonTooltip } from 'components/ui/ButtonTooltip'import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'import useTable from 'hooks/misc/useTable'@@ -69,32 +70,19 @@ const ColumnList = ({/></div>{!isLocked && isTableEntity && (- <div>- <Tooltip.Root delayDuration={0}>- <Tooltip.Trigger asChild>- <Button disabled={!canUpdateColumns} icon={<Plus />} onClick={() => onAddColumn()}>- New column- </Button>- </Tooltip.Trigger>- {!canUpdateColumns && (- <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 create columns- </span>- </div>- </Tooltip.Content>- </Tooltip.Portal>- )}- </Tooltip.Root>- </div>+ <ButtonTooltip+ icon={<Plus />}+ disabled={!canUpdateColumns}+ onClick={() => onAddColumn()}+ tooltip={{+ content: {+ side: 'bottom',+ text: 'You need additional permissions to create columns',+ },+ }}+ >+ New column+ </ButtonTooltip>)}</div>@@ -121,12 +109,8 @@ const ColumnList = ({<Table.th key="description" className="hidden lg:table-cell">Description</Table.th>,- <Table.th key="type" className="hidden xl:table-cell">- Data Type- </Table.th>,- <Table.th key="format" className="hidden xl:table-cell">- Format- </Table.th>,+ <Table.th key="type">Data Type</Table.th>,+ <Table.th key="format">Format</Table.th>,<Table.th key="buttons"></Table.th>,]}body={columns.map((x: any, i: number) => (@@ -134,7 +118,7 @@ const ColumnList = ({<Table.td><p>{x.name}</p></Table.td>- <Table.td className="break-all whitespace-normal">+ <Table.td className="break-all whitespace-normal hidden xl:table-cell">{x.comment !== null ? (<p title={x.comment}>{x.comment}</p>) : (diff --git a/apps/studio/components/interfaces/Database/Tables/TableList.tsx b/apps/studio/components/interfaces/Database/Tables/TableList.tsxindex 07bc8838718..24cecbe3885 100644--- a/apps/studio/components/interfaces/Database/Tables/TableList.tsx+++ b/apps/studio/components/interfaces/Database/Tables/TableList.tsx@@ -198,79 +198,80 @@ const TableList = ({return (<div className="space-y-4">- <div className="flex items-center justify-between">- <div className="flex items-center gap-x-4">- <div className="flex items-center gap-x-2">- <SchemaSelector- className="w-[260px]"- size="small"- showError={false}- selectedSchemaName={selectedSchema}- onSelectSchema={setSelectedSchema}+ <div className="flex items-center gap-2 flex-wrap">+ <SchemaSelector+ className="w-[260px]"+ size="small"+ showError={false}+ selectedSchemaName={selectedSchema}+ onSelectSchema={setSelectedSchema}+ />+ <Popover_Shadcn_>+ <PopoverTrigger_Shadcn_ asChild>+ <Button+ type={visibleTypes.length !== 5 ? 'default' : 'dashed'}+ className="py-4 px-2"+ icon={<Filter />}/>- <Popover_Shadcn_>- <PopoverTrigger_Shadcn_ asChild>- <Button- type={visibleTypes.length !== 5 ? 'default' : 'dashed'}- className="py-4 px-2"- icon={<Filter />}- />- </PopoverTrigger_Shadcn_>- <PopoverContent_Shadcn_ className="p-0 w-56" side="bottom" align="center">- <div className="px-3 pt-3 pb-2 flex flex-col gap-y-2">- <p className="text-xs">Show entity types</p>- <div className="flex flex-col">- {Object.entries(ENTITY_TYPE).map(([key, value]) => (- <div key={key} className="group flex items-center justify-between py-0.5">- <div className="flex items-center gap-x-2">- <Checkbox_Shadcn_- id={key}- name={key}- checked={visibleTypes.includes(value)}- onCheckedChange={() => {- if (visibleTypes.includes(value)) {- setVisibleTypes(visibleTypes.filter((y) => y !== value))- } else {- setVisibleTypes(visibleTypes.concat([value]))- }- }}- />- <Label_Shadcn_ htmlFor={key} className="capitalize text-xs">- {key.toLowerCase().replace('_', ' ')}- </Label_Shadcn_>- </div>- <Button- size="tiny"- type="default"- onClick={() => setVisibleTypes([value])}- className="transition opacity-0 group-hover:opacity-100 h-auto px-1 py-0.5"- >- Select only- </Button>- </div>- ))}+ </PopoverTrigger_Shadcn_>+ <PopoverContent_Shadcn_ className="p-0 w-56" side="bottom" align="center">+ <div className="px-3 pt-3 pb-2 flex flex-col gap-y-2">+ <p className="text-xs">Show entity types</p>+ <div className="flex flex-col">+ {Object.entries(ENTITY_TYPE).map(([key, value]) => (+ <div key={key} className="group flex items-center justify-between py-0.5">+ <div className="flex items-center gap-x-2">+ <Checkbox_Shadcn_+ id={key}+ name={key}+ checked={visibleTypes.includes(value)}+ onCheckedChange={() => {+ if (visibleTypes.includes(value)) {+ setVisibleTypes(visibleTypes.filter((y) => y !== value))+ } else {+ setVisibleTypes(visibleTypes.concat([value]))+ }+ }}+ />+ <Label_Shadcn_ htmlFor={key} className="capitalize text-xs">+ {key.toLowerCase().replace('_', ' ')}+ </Label_Shadcn_>+ </div>+ <Button+ size="tiny"+ type="default"+ onClick={() => setVisibleTypes([value])}+ className="transition opacity-0 group-hover:opacity-100 h-auto px-1 py-0.5"+ >+ Select only+ </Button></div>- </div>- </PopoverContent_Shadcn_>- </Popover_Shadcn_>- </div>- <Input- size="small"- className="w-64"- placeholder="Search for a table"- value={filterString}- onChange={(e: any) => setFilterString(e.target.value)}- icon={<Search size={12} />}- />- </div>+ ))}+ </div>+ </div>+ </PopoverContent_Shadcn_>+ </Popover_Shadcn_>++ <Input+ size="small"+ className="w-64"+ placeholder="Search for a table"+ value={filterString}+ onChange={(e: any) => setFilterString(e.target.value)}+ icon={<Search size={12} />}+ />{!isLocked && (<ButtonTooltip+ className="ml-auto"icon={<Plus />}disabled={!canUpdateTables}onClick={() => onAddTable()}tooltip={{- content: { side: 'bottom', text: 'You need additional permissions to create tables' },+ content: {+ side: 'bottom',+ text: 'You need additional permissions to create tables',+ },}}>New tablediff --git a/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx b/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsxindex aad8424b4a4..c8ee247d612 100644--- a/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx+++ b/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggerList.tsx@@ -87,19 +87,19 @@ const TriggerList = ({</p></Table.td>- <Table.td className="hidden lg:table-cell break-all">+ <Table.td className="break-all"><p title={x.table} className="truncate">{x.table}</p></Table.td>- <Table.td className="hidden space-x-2 xl:table-cell">+ <Table.td className="space-x-2"><p title={x.function_name} className="truncate">{x.function_name}</p></Table.td>- <Table.td className="hidden xl:table-cell">+ <Table.td><div className="flex gap-2 flex-wrap">{x.events.map((event: string) => (<Badge key={event}>{`${x.activation} ${event}`}</Badge>@@ -107,13 +107,13 @@ const TriggerList = ({</div></Table.td>- <Table.td className="hidden space-x-2 xl:table-cell">+ <Table.td className="space-x-2"><p title={x.orientation} className="truncate">{x.orientation}</p></Table.td>- <Table.td className="hidden xl:table-cell">+ <Table.td><div className="flex items-center justify-center">{x.enabled_mode !== 'DISABLED' ? (<IconCheck strokeWidth={2} className="text-brand" />diff --git a/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx b/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsxindex 99e643ab3d9..357db2514ee 100644--- a/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx+++ b/apps/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx@@ -85,30 +85,31 @@ const TriggersList = ({</ProductEmptyState></div>) : (- <div className="w-full space-y-4">- <div className="flex items-center justify-between">- <div className="flex items-center space-x-4">- <SchemaSelector- className="w-[260px]"- size="small"- showError={false}- selectedSchemaName={selectedSchema}- onSelectSchema={setSelectedSchema}- />- <Input- placeholder="Search for a trigger"- size="small"- icon={<IconSearch size="tiny" />}- value={filterString}- className="w-64"- onChange={(e) => setFilterString(e.target.value)}- />- </div>-+ <div className="space-y-4">+ <div className="flex items-center gap-2 flex-wrap">+ <SchemaSelector+ className="w-[260px]"+ size="small"+ showError={false}+ selectedSchemaName={selectedSchema}+ onSelectSchema={setSelectedSchema}+ />+ <Input+ placeholder="Search for a trigger"+ size="small"+ icon={<IconSearch size="tiny" />}+ value={filterString}+ className="w-64"+ onChange={(e) => setFilterString(e.target.value)}+ />{!isLocked && (<Tooltip.Root delayDuration={0}><Tooltip.Trigger asChild>- <Button disabled={!canCreateTriggers} onClick={() => createTrigger()}>+ <Button+ className="ml-auto"+ disabled={!canCreateTriggers}+ onClick={() => createTrigger()}+ >Create a new trigger</Button></Tooltip.Trigger>@@ -136,25 +137,14 @@ const TriggersList = ({{isLocked && <ProtectedSchemaWarning schema={selectedSchema} entity="triggers" />}<Table- className="table-fixed"head={<>- <Table.th key="name" className="space-x-4">- Name- </Table.th>- <Table.th key="table" className="hidden lg:table-cell">- Table- </Table.th>- <Table.th key="function" className="hidden xl:table-cell">- Function- </Table.th>- <Table.th key="events" className="hidden xl:table-cell">- Events- </Table.th>- <Table.th key="orientation" className="hidden xl:table-cell">- Orientation- </Table.th>- <Table.th key="enabled" className="hidden w-20 xl:table-cell">+ <Table.th key="name">Name</Table.th>+ <Table.th key="table">Table</Table.th>+ <Table.th key="function">Function</Table.th>+ <Table.th key="events">Events</Table.th>+ <Table.th key="orientation">Orientation</Table.th>+ <Table.th key="enabled" className="w-20">Enabled</Table.th><Table.th key="buttons" className="w-1/12"></Table.th>diff --git a/apps/studio/components/interfaces/SQLEditor/SQLEditor.constants.ts b/apps/studio/components/interfaces/SQLEditor/SQLEditor.constants.tsindex c200724b39e..776575c517c 100644--- a/apps/studio/components/interfaces/SQLEditor/SQLEditor.constants.ts+++ b/apps/studio/components/interfaces/SQLEditor/SQLEditor.constants.ts@@ -48,3 +48,10 @@ export const ASSISTANT_TEMPLATES = ['Create a table of countries and a table of cities, with each city belonging to a country',},]++export const ROWS_PER_PAGE_OPTIONS = [+ { value: -1, label: 'No limit' },+ { value: 100, label: '100 rows' },+ { value: 500, label: '500 rows' },+ { value: 1000, label: '1,000 rows' },+]diff --git a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsxindex ff718bf0aec..eb2169b87e6 100644--- a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx+++ b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx@@ -1,7 +1,7 @@import type { Monaco } from '@monaco-editor/react'import { useQueryClient } from '@tanstack/react-query'import { motion } from 'framer-motion'-import { Loader2 } from 'lucide-react'+import { ChevronUp, Loader2 } from 'lucide-react'import dynamic from 'next/dynamic'import { useRouter } from 'next/router'import { useCallback, useEffect, useMemo, useRef, useState } from 'react'@@ -9,6 +9,7 @@ import { toast } from 'sonner'import { format } from 'sql-formatter'import { useParams, useTelemetryProps } from 'common'+import { GridFooter } from 'components/ui/GridFooter'import { useSqlDebugMutation } from 'data/ai/sql-debug-mutation'import { useSqlTitleGenerateMutation } from 'data/ai/sql-title-mutation'import type { SqlSnippet } from 'data/content/sql-snippets-query'@@ -37,10 +38,19 @@ import { getSqlEditorStateSnapshot, useSqlEditorStateSnapshot } from 'state/sql-import { getSqlEditorV2StateSnapshot, useSqlEditorV2StateSnapshot } from 'state/sql-editor-v2'import {AiIconAnimation,+ Button,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuRadioGroup,+ DropdownMenuRadioItem,+ DropdownMenuTrigger,ImperativePanelHandle,ResizableHandle,ResizablePanel,ResizablePanelGroup,+ TooltipContent_Shadcn_,+ TooltipTrigger_Shadcn_,+ Tooltip_Shadcn_,cn,} from 'ui'import ConfirmModal from 'ui-patterns/Dialogs/ConfirmDialog'@@ -48,7 +58,11 @@ import { subscriptionHasHipaaAddon } from '../Billing/Subscription/Subscription.import AISchemaSuggestionPopover from './AISchemaSuggestionPopover'import { AiAssistantPanel } from './AiAssistantPanel'import { DiffActionBar } from './DiffActionBar'-import { sqlAiDisclaimerComment, untitledSnippetTitle } from './SQLEditor.constants'+import {+ ROWS_PER_PAGE_OPTIONS,+ sqlAiDisclaimerComment,+ untitledSnippetTitle,+} from './SQLEditor.constants'import {ContentDiff,DiffType,@@ -144,6 +158,7 @@ const SQLEditor = () => {const isDiffOpen = !!sourceSqlDiffconst limit = enableFolders ? snapV2.limit : snap.limit+ const results = enableFolders ? snapV2.results[id]?.[0] : snap.results[id]?.[0]const snippetIsLoading = enableFolders? !(id in snapV2.snippets && snapV2.snippets[id].snippet.content !== undefined): !(id && ref && snap.loaded[ref])@@ -625,7 +640,7 @@ const SQLEditor = () => {><ResizablePanel minSize={30}><ResizablePanelGroup- className="h-full relative"+ className="relative"direction="vertical"autoSaveId={LOCAL_STORAGE_KEYS.SQL_EDITOR_SPLIT_SIZE}>@@ -663,7 +678,7 @@ const SQLEditor = () => {)}</AISchemaSuggestionPopover>)}- <ResizablePanel collapsible collapsedSize={10} minSize={20}>+ <ResizablePanel maxSize={70}><div className="flex-grow overflow-y-auto border-b h-full">{!isAiOpen && (<motion.button@@ -729,8 +744,10 @@ const SQLEditor = () => {)}</div></ResizablePanel>+<ResizableHandle withHandle />- <ResizablePanel collapsible collapsedSize={10} minSize={20}>++ <ResizablePanel maxSize={70}>{isLoading ? (<div className="flex h-full w-full items-center justify-center"><Loader2 className="animate-spin text-brand" />@@ -748,14 +765,80 @@ const SQLEditor = () => {/>)}</ResizablePanel>++ <ResizablePanel maxSize={10} minSize={10} className="max-h-9">+ {results?.rows !== undefined && !isExecuting && (+ <GridFooter className="flex items-center justify-between gap-2">+ <Tooltip_Shadcn_>+ <TooltipTrigger_Shadcn_>+ <p className="text-xs">+ <span className="text-foreground">+ {results.rows.length} row{results.rows.length > 1 ? 's' : ''}+ </span>+ <span className="text-foreground-lighter ml-1">+ {results.autoLimit !== undefined &&+ ` (Limited to only ${results.autoLimit} rows)`}+ </span>+ </p>+ </TooltipTrigger_Shadcn_>+ <TooltipContent_Shadcn_ className="max-w-xs">+ <p className="flex flex-col gap-y-1">+ <span>+ Results are automatically limited to preserve browser performance, in+ particular if your query returns an exceptionally large number of rows.+ </span>++ <span className="text-foreground-light">+ You may change or remove this limit from the dropdown on the right+ </span>+ </p>+ </TooltipContent_Shadcn_>+ </Tooltip_Shadcn_>+ {results.autoLimit !== undefined && (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button type="default" iconRight={<ChevronUp size={14} />}>+ Limit results to:{' '}+ {+ ROWS_PER_PAGE_OPTIONS.find(+ (opt) => opt.value === (enableFolders ? snapV2.limit : snap.limit)+ )?.label+ }+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent className="w-40" align="end">+ <DropdownMenuRadioGroup+ value={enableFolders ? snapV2.limit.toString() : snap.limit.toString()}+ onValueChange={(val) => {+ if (enableFolders) snapV2.setLimit(Number(val))+ else snap.setLimit(Number(val))+ }}+ >+ {ROWS_PER_PAGE_OPTIONS.map((option) => (+ <DropdownMenuRadioItem+ key={option.label}+ value={option.value.toString()}+ >+ {option.label}+ </DropdownMenuRadioItem>+ ))}+ </DropdownMenuRadioGroup>+ </DropdownMenuContent>+ </DropdownMenu>+ )}+ </GridFooter>+ )}+ </ResizablePanel></ResizablePanelGroup></ResizablePanel>+<ResizableHandle withHandle />+<ResizablePanelref={aiPanelRef}collapsiblecollapsedSize={0}- minSize={21}+ minSize={31}maxSize={40}onCollapse={() => setIsAiOpen(false)}onExpand={() => setIsAiOpen(true)}diff --git a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/Results.tsx b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/Results.tsxindex a3ca4265185..3d247e95fec 100644--- a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/Results.tsx+++ b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/Results.tsx@@ -2,12 +2,8 @@ import { Clipboard, Expand } from 'lucide-react'import { useState } from 'react'import DataGrid, { CalculatedColumn } from 'react-data-grid'-import { GridFooter } from 'components/ui/GridFooter'import { useKeyboardShortcuts } from 'hooks/deprecated'-import { useFlag } from 'hooks/ui/useFlag'import { copyToClipboard } from 'lib/helpers'-import { useSqlEditorStateSnapshot } from 'state/sql-editor'-import { useSqlEditorV2StateSnapshot } from 'state/sql-editor-v2'import {cn,ContextMenu_Shadcn_,@@ -25,15 +21,10 @@ function formatClipboardValue(value: any) {return value}-const Results = ({ id, rows }: { id: string; rows: readonly any[] }) => {- const enableFolders = useFlag('sqlFolderOrganization')+const Results = ({ rows }: { rows: readonly any[] }) => {const [expandCell, setExpandCell] = useState(false)const [cellPosition, setCellPosition] = useState<{ column: any; row: any; rowIdx: number }>()- const snap = useSqlEditorStateSnapshot()- const snapV2 = useSqlEditorV2StateSnapshot()- const results = enableFolders ? snapV2.results[id]?.[0] : snap.results[id]?.[0]-const onCopyCell = () => {if (cellPosition) {const { rowIdx, column } = cellPosition@@ -134,31 +125,15 @@ const Results = ({ id, rows }: { id: string; rows: readonly any[] }) => {}})- if (rows.length <= 0) {- return (- <div className="bg-table-header-light [[data-theme*=dark]_&]:bg-table-header-dark">- <p className="m-0 border-0 px-6 py-4 font-mono text-sm">Success. No rows returned</p>- </div>- )- }-return (<><DataGridcolumns={columns}rows={rows}- className="flex-grow border-t-0"+ className="h-full flex-grow border-t-0"rowClass={() => '[&>.rdg-cell]:items-center'}onSelectedCellChange={setCellPosition}/>-- <GridFooter className="flex items-center justify-center">- <p className="text-xs text-foreground-light">- {rows.length} row{rows.length > 1 ? 's' : ''}- {results.autoLimit !== undefined && ` (auto limit ${results.autoLimit} rows)`}- </p>- </GridFooter>-<CellDetailPanelcolumn={cellPosition?.column.name ?? ''}value={cellPosition?.row?.[cellPosition.column.name]}diff --git a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsxindex e8cf80a34d6..3dbf46c5e6c 100644--- a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx+++ b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx@@ -2,7 +2,6 @@ import { useQueryClient } from '@tanstack/react-query'import {AlignLeft,Check,- ChevronDown,Command,CornerDownLeft,Heart,@@ -29,8 +28,6 @@ import {DropdownMenu,DropdownMenuContent,DropdownMenuItem,- DropdownMenuRadioGroup,- DropdownMenuRadioItem,DropdownMenuSeparator,DropdownMenuTrigger,TooltipContent_Shadcn_,@@ -40,13 +37,6 @@ import {} from 'ui'import SavingIndicator from './SavingIndicator'-const ROWS_PER_PAGE_OPTIONS = [- { value: -1, label: 'No limit' },- { value: 100, label: '100 rows' },- { value: 500, label: '500 rows' },- { value: 1000, label: '1,000 rows' },-]-export type UtilityActionsProps = {id: stringisExecuting?: boolean@@ -250,33 +240,6 @@ const UtilityActions = ({</Tooltip_Shadcn_></div>- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button type="default" iconRight={<ChevronDown size={14} />}>- {- ROWS_PER_PAGE_OPTIONS.find(- (opt) => opt.value === (enableFolders ? snapV2.limit : snap.limit)- )?.label- }- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent className="w-42">- <DropdownMenuRadioGroup- value={enableFolders ? snapV2.limit.toString() : snap.limit.toString()}- onValueChange={(val) => {- if (enableFolders) snapV2.setLimit(Number(val))- else snap.setLimit(Number(val))- }}- >- {ROWS_PER_PAGE_OPTIONS.map((option) => (- <DropdownMenuRadioItem key={option.label} value={option.value.toString()}>- {option.label}- </DropdownMenuRadioItem>- ))}- </DropdownMenuRadioGroup>- </DropdownMenuContent>- </DropdownMenu>-<div className="flex items-center justify-between gap-x-2"><div className="flex items-center"><DatabaseSelector@@ -306,7 +269,7 @@ const UtilityActions = ({</div>)}- className="rounded-l-none"+ className="rounded-l-none min-w-[82px]">{hasSelection ? 'Run selected' : 'Run'}</Button>diff --git a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityPanel.tsx b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityPanel.tsxindex 70331b64783..9e4eec953f3 100644--- a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityPanel.tsx+++ b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityPanel.tsx@@ -119,7 +119,7 @@ const UtilityPanel = ({return (<Tabs_Shadcn_ defaultValue="results" className="w-full h-full flex flex-col">- <TabsList_Shadcn_ className="flex justify-between gap-2 pl-6 pr-2">+ <TabsList_Shadcn_ className="flex justify-between gap-2 px-2 overflow-x-auto min-h-[42px]"><div className="flex items-center gap-4"><TabsTrigger_Shadcn_ className="py-3 text-xs" value="results"><span className="translate-y-[1px]">Results</span>@@ -138,7 +138,7 @@ const UtilityPanel = ({executeQuery={executeQuery}/></TabsList_Shadcn_>- <TabsContent_Shadcn_ className="mt-0 h-full" value="results">+ <TabsContent_Shadcn_ asChild value="results" className="mt-0 flex-grow"><UtilityTabResultsid={id}isExecuting={isExecuting}@@ -147,7 +147,8 @@ const UtilityPanel = ({isDebugging={isDebugging}/></TabsContent_Shadcn_>- <TabsContent_Shadcn_ className="mt-0 h-full" value="chart">++ <TabsContent_Shadcn_ asChild value="chart" className="mt-0 flex-grow"><ChartConfig results={result} config={chartConfig} onConfigChange={onConfigChange} /></TabsContent_Shadcn_></Tabs_Shadcn_>diff --git a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsxindex 09d5d0be3d7..22f615d3c2e 100644--- a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx+++ b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx@@ -147,13 +147,15 @@ const UtilityTabResults = ({</p></div>)+ } else if (result.rows.length <= 0) {+ return (+ <div className="bg-table-header-light [[data-theme*=dark]_&]:bg-table-header-dark">+ <p className="m-0 border-0 px-6 py-4 font-mono text-sm">Success. No rows returned</p>+ </div>+ )}- return (- <div className="h-full flex flex-col">- <Results id={id} rows={result.rows} />- </div>- )+ return <Results rows={result.rows} />}export default UtilityTabResultsdiff --git a/apps/studio/components/ui/DatabaseSelector.tsx b/apps/studio/components/ui/DatabaseSelector.tsxindex b4b0d37bf0b..832bdae9b11 100644--- a/apps/studio/components/ui/DatabaseSelector.tsx+++ b/apps/studio/components/ui/DatabaseSelector.tsx@@ -71,7 +71,7 @@ const DatabaseSelector = ({icon={isLoading && <Loader2 className="animate-spin" />}iconRight={<ChevronDown className="text-foreground-light" strokeWidth={2} size={12} />}>- Source:{' '}+ <span className="text-foreground-muted mr-1">source</span>{selectedAdditionalOption ? (<span>{selectedAdditionalOption.name}</span>) : (diff --git a/apps/studio/components/ui/GridFooter.tsx b/apps/studio/components/ui/GridFooter.tsxindex cbf2a9efc2c..13f64fc1575 100644--- a/apps/studio/components/ui/GridFooter.tsx+++ b/apps/studio/components/ui/GridFooter.tsx@@ -4,7 +4,10 @@ import { cn } from 'ui'export const GridFooter = ({ children, className }: PropsWithChildren<{ className?: string }>) => {return (<div- className={cn('flex min-h-9 overflow-hidden items-center px-2 w-full border-t', className)}+ className={cn(+ 'flex min-h-9 h-9 overflow-hidden items-center px-2 w-full border-t',+ className+ )}>{children}</div>diff --git a/apps/studio/pages/project/[ref]/database/indexes.tsx b/apps/studio/pages/project/[ref]/database/indexes.tsxindex 4c2d9808885..16a2e0f788e 100644--- a/apps/studio/pages/project/[ref]/database/indexes.tsx+++ b/apps/studio/pages/project/[ref]/database/indexes.tsx@@ -23,7 +23,7 @@ const IndexesPage: NextPageWithLayout = () => {description="Improve query performance against your database"/></ScaffoldSectionContent>- <ScaffoldSectionDetail className="flex items-center justify-end gap-x-2">+ <ScaffoldSectionDetail className="flex items-center justify-end gap-2 flex-wrap"><Button asChild type="default" icon={<ExternalLink size={14} strokeWidth={1.5} />}><atarget="_blank"diff --git a/apps/studio/pages/project/[ref]/database/tables/index.tsx b/apps/studio/pages/project/[ref]/database/tables/index.tsxindex c064d460616..5000015189f 100644--- a/apps/studio/pages/project/[ref]/database/tables/index.tsx+++ b/apps/studio/pages/project/[ref]/database/tables/index.tsx@@ -20,7 +20,7 @@ const DatabaseTables: NextPageWithLayout = () => {<><ScaffoldContainer><ScaffoldSection>- <div className="col-span-12">+ <div className="col-span-12 space-x-2"><FormHeader title="Database Tables" /><TableListonAddTable={snap.onAddTable}