Commit Graph

122 Commits

Author SHA1 Message Date
Ivan Vasilov 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00
Ali Waseem 42b431a270 feat(studio): add keyboard shortcuts to the table editor (#45178)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Feature — a set of new keyboard shortcuts for the table editor, along
with infrastructure to register, gate, and surface them.

## What is the current behavior?

Clicking into the grid "traps" the keyboard: Escape doesn't pop out,
there are no shortcuts for row selection / deletion / navigation, and
the search-tables input grabs focus on page load.

## What is the new behavior?

### New shortcuts (all scoped to the table editor)

| Keybind | Action | Surface |
|---|---|---|
| `Esc` | Exit grid selection — clears the highlighted cell and drops
focus back to the page | hotkey |
| `↑` / `↓` | Start grid navigation from the first cell when no cell is
selected | hotkey |
| `Shift+Space` | Toggle selection on the current row | hotkey +
checkbox tooltip |
| `Mod+A` | Toggle selection on all displayed rows (matches Excel) |
hotkey + header-checkbox tooltip + Cmd+K |
| `Mod+Shift+A` | Toggle selection on all rows in the table | hotkey +
"Select all rows in table" button tooltip + Cmd+K |
| `Mod+Backspace` | Delete selected rows | hotkey + delete-button
tooltip + Cmd+K |

### Infrastructure

- **Split registry** — table-editor shortcuts moved to
`state/shortcuts/registry/table-editor.ts`, spread into `SHORTCUT_IDS`.
Makes it easy to scope a runtime check to a specific surface.
- **`eventMatchesAnyShortcut`** (`state/shortcuts/matchEvent.ts`) —
queries the hotkey library's live `SequenceManager` so gated shortcuts
(`enabled: false`) are correctly excluded. Covered by
`matchEvent.test.ts`.
- **`handleCellKeyDown`** now calls `event.preventGridDefault()`
whenever the keystroke matches an active table-editor shortcut, so rdg's
"start editing on key press" default doesn't compete with shortcut
actions (e.g. typing `Shift+X` no longer opens edit mode with `X` as
input).
- **`<Shortcut>` / `<ShortcutTooltip>`** used on the header checkbox,
the per-row checkbox, the "Select all rows in table" button, and the
delete button — keybinds show up on hover (Linear-style) so users can
discover them without reading docs.
- **CSS** — `.rdg:not(:focus-within) .rdg-cell[aria-selected='true']`
drops the selected-cell outline whenever focus leaves the grid,
reinforcing the "you're out" feedback after `Esc`.
- **`useShortcut`** wraps the Cmd+K-registered action to close the
command menu after firing (previously menu stayed open after selecting
an action).
- **Search-tables input** no longer auto-focuses on load, so arrow
shortcuts work immediately without clicking out first.

## Additional context

Linear: FE-3057

### Test plan

- [x] Open any table → `↓` selects the first cell; subsequent arrows
navigate rows
- [x] `Esc` drops focus out of the grid and re-enables `↓` to re-enter
- [x] Click a cell → `Shift+Space` toggles that row's selection
(checkbox)
- [x] `Mod+A` toggles all displayed rows
- [x] With pagination + some rows selected → `Mod+Shift+A` toggles
"Select all rows in table"
- [x] With rows selected → `Mod+Backspace` deletes them (existing
confirmation flow)
- [x] Hover the header checkbox / per-row checkbox / delete button →
keybind tooltip after ~500ms
- [x] Cmd+K with selection → the relevant action shows up; selecting it
closes the palette and runs

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

* **New Features**
* Added table editor keyboard shortcuts for navigation, row selection,
and cell actions, with command-menu integration and visible shortcut
tooltips.

* **Improvements**
* Better keyboard handling in grid cells allowing external shortcuts to
override default behavior.
* Select-all/deselect-all toggle and improved select-row UX;
selected-cell styling no longer shows when grid loses focus.
  * Command menu now reliably closes before executing shortcut actions.
* Removed autofocus on the table editor search input for consistent
focus behavior.

* **Tests**
* Added unit tests covering shortcut matching and command-menu shortcut
behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-28 08:20:04 -06:00
Ivan Vasilov 308cd791a2 chore: Prep work for migrating to Tailwind v4 (#45285)
This PR preps the monorepo for a migration to Tailwind v4:
- Bump all Tailwind dependencies and libraries to the latest possible
version, while still compatible with Tailwind 3.
- Cleans up obsolete Tailwind 3 specific options and configs.
- Cleans up unused CSS files and fixes the CSS imports.
- Migrates all `important` uses in `@apply` lines to using the `!`
prefix.
- Move `typography.css` to the `config` package and import it from the
apps.
- Migrated all occurrences of `flex-grow`, `flex-shrink`,
`overflow-clip` and `overflow-ellipsis` since they're deprecated and
will be removed in Tailwind 4.
- Make the default theme object typesafe in the `ui` package.
- Migrate all `bg-opacity`, `border-opacity`, `ring-opacity` and
`divider-opacity` to the new format where they're declared as part of
the property color.
- Bump and unify all imports of `postcss` dependency.
2026-04-28 11:33:53 +02:00
Joshen Lim 7f5865872a Enforce noUnusedLocals and noUnusedParameters in tsconfig.json + fix all related issues (#45264)
## Context

Enforce `noUnusedLocals` and `noUnusedParameters` in tsconfig.json + fix
all related issues
2026-04-27 17:42:34 +08:00
Gildas Garcia 416210d666 chore: remove _Shadcn_ suffix for Checkbox and Radio components (#45263)
## Problem

With #45211 and #45218 merged, we don't need the `_Shadcn_` suffix
anymore

## Solution

- [x] Remove the `_Shadcn_` suffix 
- [x] Update exports and imports 

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

## Summary by CodeRabbit

* **Refactor**
* Standardized UI component exports by removing legacy naming
conventions and providing direct imports for checkbox and radio group
components throughout the design system.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-27 11:07:06 +02:00
Ali Waseem 6be596ea34 feat: add user preference to enable queue operations (#44366)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

- Remove queue operations from feature preview into settings
- Refactor dashboard settings 
- Resolves DEPR-434

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

* **New Features**
* Dashboard settings panel in Account preferences with toggles for
Inline Editor and Queue Operations; “Dashboard” added to project
Configuration.

* **Removed**
* Old Inline Editor settings UI and the Queue Operations feature-preview
UI removed.

* **Refactor**
* Consolidated dashboard preferences into a single settings surface;
banners and actions now navigate to preferences; account/preferences
layouts and back-navigation behavior adjusted for platform vs
self-hosted.

* **Tests**
* Added tests for settings UI, menu generation, redirects, and
local-storage.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>
2026-04-06 13:52:53 +00: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
Joshen Lim 18ddfadf86 Add banner for queue operations (#43918)
## Context

Similar to how we added a banner for the new table filter bar - mainly
to improve visibility for this feature preview as we'd like some
feedback from usage

<img width="313" height="314" alt="image"
src="https://github.com/user-attachments/assets/4cea6383-483a-42cf-b4a5-bb8c3918c00d"
/>

## Other changes
- Also adding some typing to the `addBanner` and `dismissBanner`
- Removed banner for table editor filter bar
2026-03-19 00:46:22 +08:00
Jordi Enric ec26943390 feat: improve db overload debugging UX (#43564)
When the dashboard hits a DB connection timeout, users currently see a
raw error message with no
path forward. This PR adds an inline troubleshooting system that detects
known error types and
surfaces contextual next steps — restart the DB, read the docs, or debug
with AI.

##  Changes

- New ErrorDisplay component (packages/ui-patterns) — styled error card
with a title, monospace error
block, optional troubleshooting slot, and a "Contact support" link that
always renders. Accepts
  typed supportFormParams to pre-fill the support form.

- Error classification in handleError (data/fetchers.ts) — on every API
error, the message is tested
against ERROR_PATTERNS. If matched, handleError throws a typed subclass
(ConnectionTimeoutError
extends ResponseError) instead of a plain ResponseError. Stack traces
now show the exact error
  class. All existing instanceof ResponseError checks continue to work.

- ErrorMatcher component — reads errorType from the thrown class
instance, does an O(1) lookup into
ERROR_MAPPINGS, and renders the matching troubleshooting accordion as
children of ErrorDisplay.
  Falls back to plain ErrorDisplay for unclassified errors.

- Connection timeout mapping — first error type wired up, with three
troubleshooting steps: restart
the database, link to the docs, and "Debug with AI" (opens the AI
assistant sidebar with a
  pre-filled prompt).

- Telemetry — three new typed events track when the troubleshooter is
shown, when accordion steps are
   toggled, and which CTAs are clicked.

##  Adding a new error type

  1. Add a class to types/api-errors.ts
  2. Add { pattern, ErrorClass } to data/error-patterns.ts
  3. Create a troubleshooting component in errorMappings/
  4. Add an entry to error-mappings.tsx
2026-03-16 11:22:30 +01:00
Joshen Lim dfd5461ef9 Opt to use connection string of read replica if available to power the table editor (#42856)
## Context

Part of dashboard scalability project

Opting to use the connection string of the project's read replica (if
available) for read queries on the database.

Trialing with the Table Editor as a first pass - changes involved will
opt to use replica connection string for `useTableRowsQuery`,
`useTableRowsCountQuery`, and `useForeignKeyConstraintsQuery`

There's definitely optimizations to be done for deciding which replica
to use - but am starting off with a rather naive logic to prioritize
replicas in the same region as the project.

## Changes involved

- We're no longer passing `connectionString` as a param into the
affected hooks, the `connectionString` is derived from within those
hooks instead
- Change is feature flagged, so things should be status quo if flag is
off (use primary database's connection string)
- Added `useConnectionStringForReadOps` hook which returns the replica's
connection string if (Otherwise defaults to primary database connection
string)
  - Feature flag is on
  - Project has a replica available

## To test

- [ ] Verify that the table editor works as expected for a project that
has read replicas (There shouldn't be any change really)
- [ ] Also just double check that updating cells in the table editor
works as well (There's no change there, we're using the primary DB's
connection string for mutation ops)
- [ ] ^ Same thing for a project that doesn't have read replicas
- [ ] ^ Same thing for local / self-host
2026-03-04 16:34:36 +08:00
Joshen Lim f363d69bc3 Persist dismissal of table filter bar banner if already enabled or enabling feature preview (#43323)
## Context

Persists the dismissal of the table filter banner promo if
- Already enabled
- After enabling feature preview

<img width="588" height="512" alt="image"
src="https://github.com/user-attachments/assets/97433c5a-cb9e-47b1-9971-f368f9c1688d"
/>
2026-03-03 18:14:34 +08:00
Ali Waseem a909c0869d chore: enable new filter bar as a default opt in (#43028)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

This is the first step for the GA rollout

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-02-20 09:33:32 -07:00
Charis 6b805289c7 chore(studio): remove feature flag for dataApiExposedBadge (#42563)
Cleanup / chore — removing a feature flag that has been at 100% rollout
with no issues.

## What is the current behavior?

The `dataApiExposedBadge` feature flag is checked at runtime via
ConfigCat, even though it has been set to 100% for a while with no
issues.

## What is the new behavior?

The feature flag check is removed and the gated behavior is now
unconditionally enabled. A reminder has been set to delete the flag from
ConfigCat in a month.

## Summary by CodeRabbit

**Refactor**
* Simplified API access status indicators in the studio editor, ensuring
security-related tooltips now display consistently based on actual
access conditions.
* Updated component interfaces and consolidated internal hook
dependencies for improved code maintainability and organization.
2026-02-10 21:18:53 +00:00
Charis 9aced557ed fix(studio): copy schema behavior on safari (#42293)
Bug fix

## What is the current behavior?

The clipboard copy operation for table schema would show the success
toast before the copy actually completed.

## What is the new behavior?

Move the toast showing to the callback so it appears only after the copy
finishes

## Summary

* **Bug Fixes**
* Clipboard success confirmation now appears reliably after the copy
completes.

* **New Features**
* Copied table schemas are automatically formatted for improved
readability.

* **Improvements**
  * Enhanced clipboard behavior for better reliability across browsers.
2026-01-30 14:14:04 -05:00
Ali Waseem ea1b95d29b feature: batch and save operations for cell content updates (#42120)
* added initial queue operations and feature flag

* updated types

* added dirty state tracking on columns

* updated queue operations

* updated operation types and queue

* updated spacing

* removed on cancel

* updated to support saving

* updated to include eye details

* updated spacing for orders

* updated to support shortcuts

* added feature preview

* updated to unify queue methods

* added key generation

* used unique keys rather than random uuid

* updated based on code review

* operation key

* updated handle cancel

* updated remove operation button

* updated views for toast

* updated logic to support optimistic updates

* updated types

* code cleanup: remove LLM slop

* updated PR bug

* updated preview for logout

* updated based on code review

* removed use effect as it was causing problems

* fixed toast mounting away from sql editor

* removed toast for dedicated action bar

* cleaned up logic

* updated queue operations

* renamed method

* updated name for types

* updated comment

* fixed code rabbit solution

* added check for changed column

* added tests
2026-01-28 06:54:30 -07:00
Charis 3fcc8b51a1 fix(studio): schema copy bug in safari (#42161)
* fix(studio): schema copy bug in safari

The schema could not be copied to clipboard in Safari because of the
known problem where Safari does not allow awaits to happen before
copyToClipboard. Fixed by passing the promise directly to
copyToClipboard.

* chore(studio): add eslint rule to catch async copyToClipboard

* Apply suggestion from @charislam

* Smol fix

* Clean

* Revert

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-01-27 15:05:14 +08:00
Joshen Lim c6b2fe6fee Popover ui component to use portal by default, remove all manual declaration of portal for PopoverContent in dashboard (#41818)
* Popover ui component to use portal by default, remove all manual declaration of portal for PopoverContent in dashboard

* Forgot to add ui changes lol

* Clean uop
2026-01-20 11:58:31 +08:00
Saxon Fletcher 0dab4d93fe Enable or disable Data API access per table (#41218)
* feat(studio): add mutation to update table access privileges

Adds a mutation to update table grants for `anon` and `authenticated`
roles.

* feat(studio): add data api toggles

Add toggles to the Table Editor, allowing fine-grained grants to the
anon and authenticated roles.

* fix(studio): don't show rls policies warning if table not exposed

RLS policies warning was showing in Table Editor side panel even if
table was not exposed due to no grants to anon/authenticated.

* fixup! feat(studio): add data api toggles

* fixup! feat(studio): add data api toggles

* fix(studio): revalidate rls lints when table grants are toggled

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2026-01-07 12:12:15 -05:00
Saxon Fletcher 1bcecb1c42 Table list entity api badge copy (#41547)
* api badge copy

* ts

* test

* API badge policy row (#41548)

api badge policy row

* refine

* fix tiny nits

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2026-01-06 08:04:40 +10:00
Saxon Fletcher 42a452dad3 Remove isOpened from table editor (#41524)
remove isOpened from table editor
2025-12-23 10:26:12 +10:00
Charis 1d49e9e954 feat(studio): show icon on tables exposed by data api (#41416)
* feat(studio): show icon on tables exposed by data api

Show an icon in the Table Editor for tables that are exposed via the
Data API.

* refactor(studio): move table api access query up to parent

* fix(studio): invalidate table privileges query on table create

* fix(studio): make RLS disabled warning on table editor more obvious

Change from warning -> danger

* Only show add foreign key in side panel if isSuccess

* chore(studio): put data api exposed badge behind feature flag

Only show badge for now if flag `dataApiExposedBadge` is enabled.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-18 16:50:26 +00:00
Ivan Vasilov a36b65e7a3 fix: Refactor all Table Editor links to include sorts and filters (#41075)
* Possible solution with building the URL from local storage.

* Refactor the local storage for tabs to use table ids.

* Fix the saving table state to local storage.

* Minor fixes.

* Open the correct schema when following the link.

* Minor fixes from CodeRabbit.

* Address charis' feedbacks

* Clean

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-18 10:21:09 +01:00
Joshen Lim d3d8331cae Use totalRows if available from params to validate MAX_EXPORT_ROW_COUNT (#41384)
* Use totalRows if available from params to validate MAX_EXPORT_ROW_COUNT

* Clean
2025-12-16 08:18:51 -07:00
Ivan Vasilov 0d5be306ef chore: Bump React Query to v5 (#40174)
* Bump the deps, refactor deprecated code.

* Migrate keepPreviousData usage.

* Migrate all uses of InfiniteQuery.

* Fix refetchInterval in queries.

* Migrate all use of isLoading to isPending in mutations.

* Fix accessing location in claim-project.

* Fix a bug in duplicate query keys.

* Migrate all queries to use isPending.

* Revert "Fix accessing location in claim-project."

This reverts commit 2a07df64b5.

* Revert the rss.xml file to master.
2025-12-10 10:10:29 +01:00
Charis 8e705ecdbc fix(export all rows): use cursor pagination if possible (#40536)
Exporting all rows (in CSV, SQL, or JSON format) currently uses offset pagination, which can cause performance problems if the table is large. There is also a correctness problem if the table is being actively updated as the export happens, because the relative row offsets could shift between queries.

Now that composite filters are available in postgres-meta, we can change to using cursor pagination on the primary key (or any non-null unique keys) wherever possible. Where this is not possible, the user will be shown a confirmation dialog explaining the possible performance impact.

---------

Co-authored-by: Ali Waseem <waseema393@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-08 13:39:10 -05:00
Joshen Lim 2c91a79b58 Joshen/fe 2180 right side sidebars too wide on laptop displays (#40940)
* Fix default size for resizeable panel in table editor

* Fix default size for resizeable panel for global

* Clean up

* nit

* Tweak

* Adjust
2025-12-01 17:32:07 +08:00
Danny White bf8641ad33 chore(studio): clearer foreign tables (#40411)
* clean up admonition

* legible foreign entity type on light mode

* entity icon instances with tooltip
2025-11-13 21:24:46 +11:00
Charis cfa59dabc8 refactor: use @tanstack/react-virtual for virtualization (#39992)
* refactor(infinite list): use @tanstack/react-virtual for virtualization

Swapping virtualization libraries from `react-window` to
`@tanstack/react-virtual`.

Motivation: we need a completely headless library for maximum
flexibility. `react-window` injects extra DOM elements which makes it
hard to customize styling and placement on elements that are very picky
about their DOM structure, like tables.

* refactor(table editor menu): use new infinite list

* refactor(notifications): use new infinite list

* cleanup(infinite list): remove old infinite list

* refactor(storage menu): use new infinite list & remove react-window deps
2025-10-30 14:27:53 -04:00
Joshen Lim 75e1717a02 Remove barrel files part 02 (#39956)
* Remove barrel files part 02

* Clean up
2025-10-30 23:50:14 +08:00
Sean Oliver f73ea9bd74 feat: add AI-powered table generation variant (2 of 3) (#38934)
* Add table quickstart with templates and AI generation

Implement table quickstart feature with two variants:
- Template-based: Pre-built schemas across multiple categories (social, ecommerce, content, productivity)
- AI-powered: Generate custom table schemas from natural language prompts

Key features:
- Template selector with category tabs and schema previews
- AI generation using gpt-oss-120b via Bedrock for fast response times
- Streaming responses with real-time table generation
- Quick idea chips for common use cases
- Success feedback and seamless integration with table editor
- Feature flag gated (tableQuickstart) with 7-day new project window
- Comprehensive error handling and retry logic
- ARIA labels and accessibility improvements

Technical implementation:
- Custom React hooks for AI generation and state management
- Zod schema validation for type-safe streaming
- API endpoint with structured object streaming
- localStorage-based dismissal state
- Consistent styling with existing UI patterns

* Refactor and optimize AI table generation

Refactor to use AI SDK streaming with structured object generation:
- Use streamObject() with Zod schema validation for type-safe streaming
- Add 50KB buffer limit to prevent memory issues from oversized responses
- Replace custom stream parsing with Object.assign() for efficient merging
- Use fetchHandler utility for consistent error messages across codebase
- Clean up comments and unused code

* Update quickstart widget styling to match action card

- Changed background from bg-surface-75 to bg-surface-100
- Changed hover background to bg-surface-200
- Applied to AI widget, template widget, and quick idea buttons

* Address PR review feedback

- Persist AI results to localStorage so users can create multiple tables from same generation
- Remove unnecessary isMountedRef checks before synchronous state updates
- Change Quick ideas label to semantic h4 element for accessibility
- Add TODO comment about migrating to experimental_useObject() hook

* Clean up table quickstart implementation

- Match SQL Editor ActionCard styling with circular icons
- Implement smart Generate/Regenerate button logic
- Add tooltips for column counts
- Persist prompt to localStorage
- Fix React hook dependency warnings
- Remove debugging artifacts
2025-10-23 11:35:43 -07:00
Joshen Lim 085bddafc5 Chore/consolidate copy icons (#39386)
* Replace all clipboard icons with copy icons

* Fix Menu.Item active styling for light mode

* Update

* Use bg side bar accent
2025-10-10 11:06:42 +08:00
matlin 172f6ba5fc Improve stability and explicitness of table editor tab state syncing between URL params and local storage (#38931)
* Improve stability and explicitness of table editor tab cache <-> url syncing

* fix: maintain filter state when using nav bar to switch back to Table Editor

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2025-09-23 13:03:56 -05:00
Joshen Lim d46525eac1 Chore/swap use check permissions with use async check project permissions part 8 (Season Finale) (#38619)
* Update perms checking in audit logs

* Deprecate useCheckPermissions, useIsPermissionsLoaded and useCheckProjectPermissions as they're no longer used

* Rename useAsyncCheckProjectPermissions to useAsyncCheckPermissions

* Fix TS
2025-09-16 17:05:57 +08:00
Francesco Sansalvadore 6cff20b7a2 fix vertical scroll in mobile schema selector (#38671) 2025-09-15 11:01:18 +08:00
Joshen Lim 7650926b77 Chore/swap use check permissions with use async check project permissions part 7 (#38581)
* Wrap up remaining swapping of useCheckPermissions

* remove OrganizationSettingsLayout on billing, team, integrations and usage org pages

* Fix missing loading state in usage page

* Add comments for next step
2025-09-10 18:09:18 +08:00
Joshen Lim bc3a473170 Swap useCheckPermissions with useAsyncCheckProjectPermissions Part 6 (#38559)
More swapping
2025-09-10 11:26:26 +08:00
Charis bb5861f5a1 fix: table editor mobile view (#38539)
There is a bug in the Table Editor mobile view:

1. Open the Table Editor in mobile.
2. Open a tab with a table.
3. Use the Table Editor Menu to switch schemas. This switches the schema
   in the URL and in local storage, but the Table Editor Menu closes
   immediately and you can't see the list of tables in the new schema to
   pick.
4. Open the Table Editor Menu again to pick a new table. The schema
   automatically flips back to the previous schema, and the Table Editor
   Menu only flickers open temporarily before closing again. There is no
   way to access the tables for your newly selected schema.

The cause of the bug:

There is a useEffect that triggers every time the Table Editor Menu is
opened in mobile. (It technically has selectedTable?.schema in its
dependency array, but since the menu unmounts and remounts on visibility
toggle, the effect runs regardless of whether global selectedTable state
has changed. That's also why desktop works fine, because the menu is
continuously mounted in desktop view.)

When the useEffect runs, it sets the schema to the schema of the
currently selected table. Therefore, what actually happens:

1. Schema is set to `schema_a`. The currently selected table is
   `schema_a.table_a`.
2. User changes schema to `schema_b`.
3. User reopens Table Editor Menu. useEffect runs. Currently selected
   table is `schema_a.table_a`, so the schema automatically changes back
   to `schema_a`. Menu automatically closes.

The fix:

The actual behavior on desktop right now is probably what we want:
- The selected table is only used to set the schema if no explicit
  schema is provided.
- If an explicit schema is provided, the user probably chose it, so we
  allow the schema to not match the currently selected table. The table tabs
  update to include the table schema anyway if the schema changes, so it should
  be somewhat obvious that the schema of the menu and the selected table
  don't match.

Therefore, the logic we want is `!!selectedTable?.schema &&
!selectedSchema`. Because of this change, we can also take it out of the
useEffect, which means less circular logic.
  that

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-09-09 21:06:30 +08:00
hallidayo 25af9fa6d3 fix: add apostrophe for sql export (#37920)
* add apostrophe for sql export

* refactor: move quote escape logic to common util

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2025-09-03 16:59:18 -04:00
Joshen Lim 7ed5edd320 Add CTA to unrestricted badge in table editor (#37730)
* Add CTA to unrestricted badge in table editor

* Update apps/studio/components/interfaces/TableGridEditor/GridHeaderActions.tsx

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

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
2025-08-12 10:44:48 +07:00
Joshen Lim cab0585533 Fe 1799/consolidate to useselectedprojectquery and (#37684)
* Replace all usage of useProjectContext with useSelectedProjectQuery

* Replace all usage of useSelectedProject with useSelectedProjectQuery

* Replace all usage of useProjectByRef with useProjectByRefQuery

* Replace all usage of useSelectedOrganization with useSelectedOrganizationQuery

* Deprecate useSelectedProject, useSelectedOrganization, and useProjectByRef hooks

* Deprecate ProjecContext
2025-08-06 10:53:10 +07:00
Joshen Lim eeaf7e3c38 Minor clean ups (#37653)
* Minor clean ups

* Clean up

* Standardize more icon for table and storage editor

* update copy
2025-08-05 14:26:20 +07:00
Joshen Lim 0f4ad7dad3 Factor in filters and sorts for export via CLI option (#37399)
* Factor in filters and sorts for export via CLI option

* Add align

* Update

* Smol fix
2025-08-05 13:52:27 +07:00
Ivan Vasilov 37bc6cda3a fix: Fix the exposed foreign table in the tooltip in table list (#37668) 2025-08-04 23:31:51 +02:00
Ivan Vasilov 492568bb55 fix: Make the padlock red if the entity is insecure in the Table Editor (#37604)
* Make the padlock red.

* Update based on feedback in thread

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-08-04 10:36:58 +02:00
Ivan Vasilov b3c6992e56 feat: Make the protected schemas dynamic, namespace schemas are now protected (#37290)
* Add hooks for async protected schemas.

* Migrate the ProtectedSchemaWarning to support the new implementation.

* sq

* Migrate all uses of protected schemas to the new approach.

* Delete extra file.

* Refactor the import foreign schema dialog to forbid protected and exposed schemas.

* Add the type to the protected schema.

* Revert ImportForeignSchemaDialog, it'll be addressed in another PR.

* Update apps/studio/hooks/useProtectedSchemas.ts

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>

* Fix a bad commit.

* Minor fixes.

* Fix the FDW delete mutation to handle names with numbers.

* Simplify the logic to skip a fetch.

* Minor fixes.

* Make the useIcebergFdwSchemasQuery work for all iceberg FDWs.

* Fix the tab schemas to always show in the Table Editor.

* Apply suggestion from @joshenlim

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>

* Fix a minor typo.

* Refactor ProtectedSchemaWarning to use Admonition, and standardise input field for target schema iceberg

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-07-30 11:38:50 +02:00
Joshen Lim 2c6e3c2b3d Chore/add export as cli option to entity list item (#37513)
* Add export as JSON option for table editor

* Add export via CLI option to EntityListItem
2025-07-28 23:23:31 +08:00
Joshen Lim 327cab053a Clean up tabs interface feature flags (#36441)
* Clean up tabs interface feature flags

* Update SQL e2e test
2025-06-23 11:16:24 +08:00
Joshen Lim 27d9b44526 Consolidate copy to clipboard (#36353)
* Consolidate copy to clipboard

* Fix

* Fix some extra clipboard events.

* Fix the tests. Fix a small issue with the copy button.

* Fix

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-06-13 13:08:08 +02:00
Alaister Young 367ffdd893 fix: get table schema on click (#35989) 2025-05-28 11:00:43 +02:00
Jordi Enric 318280f2fe add copy table schema option to table dropdown (#35909)
* add table schema option

* change logic to fetch on render instead

* rm unnecessary check

* rm unused code

* readd check for tables
2025-05-26 16:13:35 +02:00