The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: request confirmation before applying auto-layout to the schema visualiser (#44932)
Gildas Garciae7860e9163ea
diff --git a/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx b/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsxindex 39731f6c873..5da4bfb5bc2 100644--- a/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx+++ b/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx@@ -22,6 +22,15 @@ import '@xyflow/react/dist/style.css'import { LOCAL_STORAGE_KEYS, useParams } from 'common'import { toast } from 'sonner'import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+ AlertDialogTrigger,Button,copyToClipboard,DropdownMenu,@@ -130,7 +139,7 @@ export const SchemaGraph = () => {const canAddTables = canUpdateTables && !isSchemaLocked- const resetLayout = () => {+ const resetLayout = async () => {const nodes = reactFlowInstance.getNodes()const edges = reactFlowInstance.getEdges()@@ -140,7 +149,12 @@ export const SchemaGraph = () => {)reactFlowInstance.setNodes(nodes)reactFlowInstance.setEdges(edges)- setTimeout(() => reactFlowInstance.fitView({}))+ await new Promise<void>((resolve) =>+ setTimeout(async () => {+ await reactFlowInstance.fitView({})+ resolve()+ })+ )saveNodePositions()}@@ -286,9 +300,7 @@ export const SchemaGraph = () => {<div className="h-[34px] w-[260px] bg-foreground-lighter rounded shimmering-loader" />)}- {isErrorSchemas && (- <AlertError error={errorSchemas as any} subject="Failed to retrieve schemas" />- )}+ {isErrorSchemas && <AlertError error={errorSchemas} subject="Failed to retrieve schemas" />}{isSuccessSchemas && (<>@@ -347,18 +359,33 @@ export const SchemaGraph = () => {</DropdownMenuItem></DropdownMenuContent></DropdownMenu>- <ButtonTooltip- type="default"- onClick={resetLayout}- tooltip={{- content: {- side: 'bottom',- text: 'Automatically arrange the layout of all nodes',- },- }}- >- Auto layout- </ButtonTooltip>+ <AlertDialog>+ <AlertDialogTrigger asChild>+ <ButtonTooltip+ type="default"+ tooltip={{+ content: {+ side: 'bottom',+ text: 'Automatically arrange the layout of all nodes',+ },+ }}+ >+ Auto layout+ </ButtonTooltip>+ </AlertDialogTrigger>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Confirm to rearrange all nodes</AlertDialogTitle>+ <AlertDialogDescription>+ Auto layout will rearrange all nodes in the graph. This cannot be undone.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction onClick={resetLayout}>Apply</AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog></div>)}</>