Commit Graph

17 Commits

Author SHA1 Message Date
Charis
3aec96f9c6 fix(studio): use measured node heights for instance diagram layout (#46075)
## Summary

The homepage instance diagram looks visually off when a project has read
replicas — see
[FE-3390](https://linear.app/supabase/issue/FE-3390/adjust-homepage-diagram-spacing-for-read-replicas).

Root cause: the dagre layout in `InstanceConfiguration.utils.ts` was
passing a fake `height: 25` (and a `-70` hack for the load balancer) for
every node, regardless of how tall the rendered node actually is. When
the Primary card grew taller after #45274 added the compute-metrics row,
the gap between the Primary node and the Read Replica node became
visually tight while the gap between the Load Balancer and Primary
stayed loose — the diagram looked lopsided.

## Fix

- Pass the **real measured height** of each node to dagre, sourced from
React Flow's internal measurement (`node.measured.height`).
- Run the layout in two passes:
1. First pass uses small per-type fallback heights so React Flow has
something to render and measure against.
2. Once `useNodesInitialized()` flips true, re-run dagre with the
measured heights and fitView.
- Keep the diagram at `opacity-0` until the measured pass completes, so
the fallback positions are never visible to the user. Subsequent data
refetches don't re-hide the diagram — once measured, it stays visible.
- Drop `NODE_ROW_HEIGHT` and the load-balancer `-70` hack. Replaced with
a small `NODE_HEIGHT_FALLBACKS` table used only on first paint.
- `ranksep` reduced from 160 → 60 since dagre now knows real heights.

Closes FE-3390.

## Test plan

- [x] Open the project homepage for a project with no read replicas —
diagram renders centered, single Primary node.
- [x] Open the project homepage for a project **with** a read replica —
Load Balancer → Primary → Replica spacing is visually balanced; no flash
of fallback positions on initial render; the diagram fades in once.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Improvements**
* More accurate infrastructure diagram layout with better node sizing
and spacing for initial and measured renders.
* Introduced fallback heights so diagrams render correctly on first
paint before measurements are available.
* Region containers now use a consistent fixed height for stable layout.
* Smoother, visually consistent diagram initialization with improved
opacity transition during layout setup.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46075?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-19 16:13:26 -04:00
Charis
4a0bb36ca8 style: require sorted imports in studio/components (#44408)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-04-01 10:22:37 +02:00
Gildas Garcia
06190d15b9 Gildasgarcia/fe 2426 show relationship line context and highlight on hover (#44023)
## Problem

When you have many tables, it's hard to follow the relations between
them in the Schema Visualiser

## Solution

When selecting an edge (the line between tables), highlight it along
with the related tables and columns to make it easier.
Also, if there is enough space, display a popover showing the relation
details

## Screencasts


https://github.com/user-attachments/assets/11d35fa7-3674-4f13-b77f-8ebe25c66b04
2026-03-23 17:41:50 +01:00
Alaister Young
f44c910015 feat: add us-west-2 region for read replicas (#40199)
feat: add us west 2 region
2025-11-06 17:55:41 +08:00
Joshen Lim
caeb09b369 Add new regions for RR deployment (#30409) 2024-11-11 16:37:49 +08:00
Joshen Lim
0b5573ecb5 Add lat long for aws regions (#30376)
* Remove console log

* Add comment
2024-11-08 12:17:41 +00:00
Joshen Lim
b36c9f86b3 Fix missing region in replica primary node (#28832) 2024-08-23 16:11:15 +07:00
Charis
5cd8384bca feat(docs), refactor(docs,studio): add regions list to docs (#28125)
* feat(docs), refactor(docs,studio): add regions list to docs

Adds list of supported AWS regions to docs.

Pulls the region information into `shared-data` package to provide common source of truth for dashboard and docs.

* style: format
2024-07-23 12:45:44 -04:00
Joshen Lim
b4f5c0c16a Chore/support more granular updates via events for spinning up replica (#26378)
* Support more granular updates via events for spinning up replica

* Add duration estimates as tooltips

* Show granular error message if error happens during replica set up

* Add support for hours in duration estimates
2024-05-17 14:09:58 +08:00
Joshen Lim
cea8e45166 Chore/read replicas fixes 040324 (#21731)
* Remove size selection and add info on rr billing

* Add prompt in SQL editor if trying to run mutation query in read replica

* Fix

* Fix dropping replica not optimistically updating, and support new replica statuses

* Invalidate load balancers after read replicas are spun up

* fix
2024-03-06 15:31:09 +08:00
Div Arora
cc2425d11b fix: typo in region name (#21761) 2024-03-05 09:43:06 +08:00
Joshen Lim
1b5f35983e Make region names consistent between settings and project creation (#20760)
* Make region names consistent between settings and project creation

* Add flag
2024-02-16 17:17:31 +08:00
Ivan Vasilov
eac073219a fix: Enable APSE (#20909)
* Revert some of the changes in 20982 and 20987.

* The default env for staging should be Singapore.
2024-01-31 23:17:12 +00:00
Joshen Lim
e7a9131d56 Allow apse1 on staging and local only (#20897)
* Allow apse1 on staging and local only

* Fix

* Fix

* Fix

* Fix

* Fix
2024-01-31 15:50:16 +07:00
Joshen Lim
199dd37ac8 Offer select closest region CTA in project creation (#20262)
* Offer select closest region CTA in project creation

* Update region select CTA to use cloudflare and support all regions

* Auto select region, remove CTA

* Update apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
2024-01-11 15:23:34 +08:00
Joshen Lim
539c2bbace feat/rr-functionality (#19466)
* Implement read, create, delete replicas

* Long poll replica statuses if any one of them is coming up

* Support querying replicas in SQL editor

* Add optimistic rendering for setting up and removing replicas

* Small style fix for database selector in SQL editor

* Small fix

* Add Alerts around PITR and PG upgrades RE read replicas

* Small fixes after testing flag off

* Add UI guards to check that project has PITR before deploying replica

* Fix

* Address feedback

* Fix

* Update replicas RQ to enable based on flag
2023-12-08 13:41:35 +08:00
Joshen Lim
3620ca8ebe RR Scaffolding Work (#18658)
* Init demo world map for read replicas

* Update package.json

* Scaffold and mock data for flow view of project settings infrastructure configuration

* Shift map stuff and install deck.gl to experiment

* Flesh out map view a bit more

* Scaffold deploy new replica panel

* Add restart replica option

* Add animations, shift node generation into utils, attempt to show region nodes

* Experiments

* General improvement to chart and map UI

* Improve some copy writing for restart and drop replica modals

* Simplify loading, error, success states in DatabaseSettings

* Scaffold DB selection in connection string section

* Link replica node to connection string

* Scaffold database selection for SQL editor

* Make DatabaseSelector into a component

* Add database selector to infra activity

* Update

* Hide read replicas UI behind a feature flag

* Update flags

* Update package-lock

---------

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
2023-11-27 12:50:19 +08:00