Commit Graph

67 Commits

Author SHA1 Message Date
Joshen Lim 71acf22318 Skip invalidating auth config when toggling security email notification in template editor page (#44888)
## Context

Preferred fix to this PR
[here](https://github.com/supabase/supabase/pull/44886)

On a security email template page (e.g. Reauthentication), if you edit
the Subject or Body without saving, then toggle **Enable notification**
in the Configuration card and click **Save changes**, the Content edits
are reverted to the last saved values.

## Changes involved

Opting to not invalidate the `authConfig` RQ cache on a successful
mutation when toggling the security email notification while on the
template editor page

## To test

- [ ] Open a security email template
- [ ] Make some changes to the template without saving 
- [ ] Toggle the notification and save
- [ ] Ensure that the template changes are still present and not
reverted

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

## Summary by CodeRabbit

* **Refactor**
* Optimized query cache handling for authentication configuration
updates to reduce unnecessary refresh operations.
* Enhanced type safety for form submissions in authentication settings
to prevent data validation errors.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-16 09:27:57 +10:00
Charis 3b7052b5a9 cleanup: fix import order and prefixes for studio/data (#44501) 2026-04-03 09:15:57 +02:00
Joshen Lim fc7fb50aa2 Organize pg meta queries for studio (#43562)
## Context

We reached to a consensus that we'll keep manually written queries
within the `pg-meta` package

I'll shift queries over in several PRs but wanted to double check if the
changes here is a good folder structure

## Changes involved

- Am organizing dashboard queries in `pg-meta` based on product
  - So folder structure will be `/sql/studio/[product]/*.ts`
- Every constant will be exported directly from `pg-meta`'s index
- So consumption in dashboard will just be `import { xxx } from
'@supabase/pg-meta`

cc @avallete and @soedirgo on this one - lemme know if this is alright,
or if there's a preferred way to do this
2026-03-10 09:34:11 +07:00
Jordi Enric 911eb03498 fix: banning / unbanning a user does not update user pane ban status (#43332) 2026-03-03 12:20:42 +01:00
Vaibhav 01fe4e68a0 fix(auth-config) : force refetch lint data after config update (#41960)
## Problem


The Performance Advisor warning "Auth Absolute Connection Management
Strategy" persists after switching from "Absolute" to "Percentage"
allocation strategy, even after project restart.

PR #41652 added cache invalidation but the frontend doesn't immediately
refetch, so stale lint data may be displayed until the next natural
refetch occurs.

## Solution

Force an immediate refetch of lint data after invalidating the cache.
This ensures the backend re-evaluates the `auth_db_connections_absolute`
lint with the updated `DB_MAX_POOL_SIZE_UNIT` configuration value.

## Changes

- Added `refetchQueries` call after cache invalidation in
`useAuthConfigUpdateMutation`
- Uses `type: 'active'` to only refetch active queries (React Query best
practice)

## Related

- Extends: https://github.com/supabase/supabase/pull/41652
- Closes: https://github.com/supabase/supabase/issues/41619


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

## Summary by CodeRabbit

* **Bug Fixes**
* Improved data consistency by ensuring validation information is
automatically refreshed following authentication configuration updates.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-03-02 17:35:10 +01:00
Danny White 487c74f174 feat(studio): sortable projects (#43118)
## What kind of change does this PR introduce?

Feature. Resolves DEPR-390

## What is the current behavior?

Projects aren’t sortable in either the card or table view.

## What is the new behavior?

Projects are sortable in both:

- Card view: sort dropdown
- Table view: sort dropdown or table column headers

| Before | After |
| --- | --- |
| <img width="1382" height="797"
alt="Supabase-4D1BFE40-875D-494C-8F17-A68D92826458"
src="https://github.com/user-attachments/assets/c4f17b77-bc90-447f-90cd-78a11c2e4129"
/> | <img width="1382" height="797"
alt="Supabase-D8C0AC7C-A28D-4AA6-BA7C-0FCD61DB5D11"
src="https://github.com/user-attachments/assets/d926d03d-2702-48e5-9d1f-0e09d163079d"
/> |
| <img width="1382" height="797"
alt="Supabase-0A545C5C-40B5-47F7-9ACD-2200879BB95E"
src="https://github.com/user-attachments/assets/f2103c32-a150-4db7-a78a-8bd610e2a028"
/> | <img width="1382" height="797"
alt="Supabase-0F7AB608-2E86-4F0C-BB60-C85D9B7F3D57"
src="https://github.com/user-attachments/assets/baa63f14-4059-483d-a9d6-33663e5cff43"
/> |

## Additional context

I wonder if this is overkill given most folks only have 1–2 projects.
Some ideas:

- Only sortable in table view via column headers
- Conditional rendering for folks with 2+ projects
- Opt-in feature
- Feature-flag

I’ve opted to make it global and synced for now.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-02-25 10:47:56 +11:00
Joshen Lim b94538268b Joshen/fe 2558 shift sql queries to contextual folders update codeowners (#42770)
## Context

Related to Dashboard Scalability, specifically having Postgres team as
CODEOWNERS for dashboard queries

This is just a clean up as we're currently piling manual queries into
one folder under `data/sql/queries`, whereas I reckon it'll be better
for each query to sit within their RQ folder for better context.

Am opting the naming format for files housing queries to be `*.sql.ts`,
and also updating CODEOWNERS to reflect as such

Next step will also be to shift all the dashboard queries within pg-meta
into studio itself as requested by the pg-meta team

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

## Summary by CodeRabbit

* **Refactor**
* Consolidated and reorganized internal module structure for the data
layer to improve maintainability and reduce redundancy.
* Streamlined import paths across components to align with new
consolidated module organization.

* **Chores**
* Updated code ownership patterns to reflect reorganized file structure.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Ali Waseem <waseema393@gmail.com>
2026-02-16 18:34:08 +00:00
Ivan Vasilov f9cbf661ca fix: Fix a bug in Edit FDW sheet (#41685)
* Add types to the getDecryptedValues function.

* Refactor the edit-wrapper-sheet to fetch the secrets by id, instead of name.

* Add try/catch for the secret values fetching.

* Minor CodeRabbit nitpicks.

* Small improvement for types in EditWrapperSheet

* Small fix for WrapperRow icon space issue hiding ChevronRight

* Update comment

* Only fetch encrypted IDs if value is a valid UUID

* Nit

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-01-05 12:00:49 +07:00
Aditya kumar singh 30fd0087ae fix(auth-config): invalidate lint cache on update to dismiss stale Pe… (#41652)
* fix(auth-config): invalidate lint cache on update to dismiss stale Performance Advisor warnings

* Do the invalidations in parallel.

* Fix prettier error.

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-01-02 12:36:26 +00:00
issuedat 115ca3a2e3 feat(auth): improved user search (#41199)
* feat(auth): improved user search

* chore: fix types for columns

* feat: cursor-based pagination

* chore: remove trigram indexes in favour of b-tree
2025-12-24 12:24:43 +01:00
Joshen Lim 0c2f44d0b8 Remove use of useQueryStateWithSelect for auth users (#41380)
* Remove use of useQueryStateWithSelect for auth users

* Address code rabbit
2025-12-17 14:35:52 +08:00
Joshen Lim 34b5e0bf07 Fix deleting a user shows User not found toast error (#41339) 2025-12-15 07:42:08 -07:00
Joshen Lim 511229f7a6 Fix creating users not invalidating users list and count (#41254) 2025-12-11 11:06:06 -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
issuedat cb25d2383a feat(auth): allow opting in to creating indexes on auth.users (#40955)
* feat(auth): allow opting in to creating indexes on `auth.users`

* chore: organize imports. use alert above table.

* chore: use default type to avoid 2 primary actions
2025-12-08 10:42:18 +01:00
Joshen Lim 5701a291fe Fix Users page not invalidating data when switching search mode (#40809)
* Fix Users page not invalidating data when switching search mode

* Nit fix
2025-11-26 16:15:34 +08:00
Ivan Vasilov c83d7255a4 chore: Migrate leftover query keys (#40573)
* Fix queryKey to be compatible with RQ 5.

* Revert .find usage of queryKey.
2025-11-18 10:27:17 -07:00
Jordi Enric be5e8b289e Auth Overview: Refactor to Logflare Endpoint for all metrics (#40042)
* refactor

* fix schema, add validation, add tests, remove old code

* remove debugging tag

* fix imports

* prettier

* fix prettier

* move query to its own file
2025-11-10 11:30:12 +01:00
Ali Waseem 7682bac0f3 Fix: Updated to use optimized search columns when getting user counts (#40107)
* Updated to use optimized search columns when getting user counts

* added unit tests for query builders

* minor

* Nit fix keywords URL param not getting loaded into search input field

* removed user footer

* updated tests for upstream

* updated integration tests

* updated tests to be int for paginated

* updated schema

* updated types

* updated type imports

* updated type imports

* Apply suggestion from @avallete

Co-authored-by: Andrew Valleteau <avallete@users.noreply.github.com>

* updated literal import

* refactor: use common escaping (#40186)

refactor: use utils for sql escaping

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Andrew Valleteau <avallete@users.noreply.github.com>
2025-11-06 15:32:34 +08:00
Ivan Vasilov 8b657165b5 chore: Migrate to use custom type for ReactQuery queries and mutations (#40073)
* Add custom types for queries, mutations and infinite queries.

* Migrate all queries to use the new type.

* Migrate all infinite queries to useCustomInfiniteQueryOptions.

* Migrate all mutations to use useCustomMutationOptions.

* Add type to all imports in `types` folder.
2025-11-03 13:18:13 +01:00
Joshen Lim cac225b24a Clean up barrel files part 4 (#40015)
* Clean up barrel files part 4

* nit
2025-10-31 00:30:42 +08:00
Ivan Vasilov da4a40e308 chore: Migrate RQ functions to use object syntax style (#39895)
* Migrate all uses of invalidateQueries to use object syntax.

* Migrate the remainder of useInfiniteQuery.

* Migrate all setQueriesData.

* Migrate all fetchQuery uses.

* Migrate some leftover functions from RQ.

* Fix issues found by Charis.
2025-10-28 10:43:14 +01:00
Alaister Young 8855d05803 chore(studio): swap react-query to object syntax (#39842)
* chore(studio): swap react-query to object syntax

* Fix small issues found

* Fix realtime settings

* Nit

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-27 09:38:27 +01:00
Stojan Dimitrovski 0a3f4184a7 feat: optimized users page (#39349)
* feat: optimized users page

* Update UI

* Reinstate footer with count if mode is freeform

* Simplify disabled sort in performance mode

* Clean

* Small fix

* Final fixes

* Shift users SQL query to packages/pg-meta

* Nit unrelated: Clear query params from useLogsUrlState when going to logs tab of a selected user

* Shift user count SQL and get count estimate SQL into packages/pg-meta

* Fix

* Nit

* Nit

* Minor nits

* Refactor UX for searching

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-14 15:02:00 +08:00
Joshen Lim 87ab63a1d7 Chore/optimize auth users UI query (#38739)
* only select required columns, instead of *

* Use CTE, run agg only within the results block
2025-09-16 22:58:41 +08:00
Charis 271ee3af6d fix: estimate number of users when count is large (#38638)
* fix: estimate number of users when count is large

In the Auth Users table, we always fetch an exact count of users. This
can be a problem for projects with many (>50K) users as the count(*)
might cause performance issues on the database. We already have logic on
the Table Editor to only run automatic count estimates (fetching the
exact count only if usr requests it), this change ports the same logic
over to Auth Users.

* Nit refactor

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-09-12 13:07:31 +08: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 b9a0908331 Refactor post calls from lib/common/fetch in auth pages to data/fetchers (#36506)
* Deprecate use of getWithTimeout, refactor BuildingState and RestoringState to use RQ

* Refactor profile-create-mutation to use data/fetchers, and edge-function-status-query to use fetch

* Shift post from lib/common/fetch, refactor bucket-object-download-mutation

* Address feedback

* Minor fix

* Refactor post calls from lib/common/fetch in auth pages to data/fetchers

* Add missing POST users endpoint + small fix when deleting user via context menu

* simplify handleFetchError

* allow handleFetchError to accept unknown

* non-breaking change

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2025-07-21 12:45:53 +08:00
Ivan Vasilov 4add928dae chore: Update API types (#35879)
* Regenerate all types from develop branch.

* Fix all types in studio.

* Remove extra type.
2025-05-26 15:43:14 +02:00
Terry Sutton 4fcc6f3026 Update user impersonation search (#35717)
* Update user impersonation search

* Fix spacing, make users unique in history

* Scrollable contaner
2025-05-22 09:00:57 -02:30
Andrew Valleteau 31aad403de fix(studio): early fail query when x-connection-encrypted is invalid (#35331)
* fix(studio): early fail query when x-connection-encrypted is invalid

* fix(studio): uniformize readDatabase and projectDetails connString handling

* chore: update api types

* chore: add connectionString null option

* fix: only enforce x-connection-encrypted on platform

* chore: refactor connString check in a single point

* chore: fix guard logic

* chore: fix pgMetaGuard

* chore: fix types
2025-05-08 12:11:03 +02:00
Joshen Lim 357936f9eb Only send required data for reset password, magic link and send OTP (#33352) 2025-02-05 18:59:59 +08:00
Joshen Lim cc6c6bf096 Fix unnecessary requests in auth users (#33269)
* Fix unnecessary requests in auth users

* fix hasNextPage

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2025-02-04 15:45:13 +08:00
Joshen Lim 5024df75c0 Refactor auth users the way we retrieve providers (#33258)
* Refactor auth users the way we retrieve providers

* Fix

* Fix
2025-02-04 10:38:12 +08:00
Alaister Young 9d534c9f5a fix: response error codes (#30581)
* fix: response error codes

* upgrade docs

* remove request url modification middleware

* move api routes for self-hosted to platform folder

* remove some lib/common/fetch usage

* docs: use middleware for openapi-fetch (#30600)

Get rid of the unauthedAllowedPost function (I don't think there's any harm in letting any requests that require authentication to just 403, they should be disabled at the React Query level and if not they will fail gracefully enough...)

* fix local count query

* add default values for clone mutation

* fix ts and codegen

* add missing lodash dep to playwright tests

* Fix the playwright tests to match the new folder structure for selfhosted variant.

* remove unused import

* Remove unused state

* remove unused sql debug mutation

* remove unused export

* fix notifications query

* fix jwt updating status

* fix typescript

* save sql snippet after renaming

* update codegen & fix ts error

* override array querySerializer

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-01-20 11:27:38 +08:00
Joshen Lim 394e8302f8 Fix impersonation and searching users escape single quote (#32603)
* Fix impersonation and searching users escape single quote

* Smol fix

* Fix count
2025-01-07 10:52:30 +07:00
Joshen Lim 771ff70891 Support bulk deletes in auth users (#31271)
* Support bulk deletes in auth users

* Close overview panel if user was deleted

* Add max select up to 20 users limit, and add cancel selection button
2024-12-23 14:29:18 +08:00
Kamil Ogórek 643926d5b4 ref: Use non-deprecated delete user endpoint (#31095) 2024-12-13 13:11:04 +08:00
Ivan Vasilov ee9ca4fa0b fix: Change the users infinite query to use like instead of ilike (#31048)
Change the users infinite query to use like instead of ilike.
2024-12-11 12:26:24 +08:00
Joshen Lim a4243f438f Add restrictions for orioledb technical preview (#30410)
* Add restrictions for orioledb technical preview

* Add callouts to pgvector and postgis if orioledb

* Restrict restore to new project for orioledb

* Scaffold client side validation for preventing org upgrade if org has oriole db present

* Hook up proper logic for oriole

* Fix

* Remove console log

* Fix type

* Disable version selector if only one version is available

* chore: oriole badges

* UI updates based on requests

* Update copy

* Fix

* Dont open assistant if opt is selected

* Fix

* Fix

* Update badge

* Add feature flag for orioleDB

* Feature flag oriole check in plan update

---------

Co-authored-by: Paul Cioanca <paul.cioanca@supabase.io>
2024-11-30 17:36:15 +08:00
Alaister Young 6c592dec99 chore: remove useExecuteSqlQuery() part 2 (#30467)
* foreign-key-constraints

* update entity-types stale time

* schemas query

* deprecate useExecuteSqlQuery

* users count query

* database size query

* indexes query

* keywords query

* migrations query

* table columns

* database functions

* database roles query

* fdws query

* replication lag query

* ongoing queries query

* vault secrets query

* remove unneeded staleTime: 0

* max connections query

* fix entity types key in tests

* Some fixes

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-11-18 05:15:37 +00:00
Joshen Lim 55c4dffda7 Chore/update create and update user to use platform endpoints (#30379)
* Refactor create and update user to use platform endpoints

* Update perms

* Fix self host endpoints

* Fix
2024-11-13 09:19:37 +08:00
Alaister Young eb7b0818d1 fix: use nulls last when sorting users (#30430) 2024-11-12 17:50:05 +08:00
Joshen Lim b37d377917 Add check for project active healthy status in some RQs that are unnecessary when project is paused (#30377) 2024-11-12 17:47:55 +08:00
Ivan Vasilov f29003e0e7 fix: Use protocol property when building API url (#30332)
* Fix the types for API settings to include protocol.

* Use the protocol property in all usages of endpoints.

* Update

* Lint

* Revert changes to retrieving protocol

* Remove console.logs

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-11-06 22:22:24 +01:00
Joshen Lim 8f4f7e3e57 Chore/deprecate old users management UI components (#30224)
* Remove usage of userManagementV2 flag and deprecate old user management UI component

* Remove usage of API users endpoint, to use the same SQL query as users-infinite-query

* Use user-infinite-query in UserImpersonationSelector and deprecate users-query

* Fix import statements
2024-11-05 09:10:10 +08:00
Joshen Lim 1e462453f5 Add sort by last sign in at in auth users (#30202)
* Add sort by last sign in at in auth users

* Feex
2024-11-01 17:32:23 +08:00
Joshen Lim db2e977f7d Add spam validation check in auth email templates (#30188)
* Add spam validation check in auth email templates

* Update comment

* Add another banding

* Update
2024-10-31 10:07:53 +08:00
Joshen Lim 34f02f344b Revert "Revert "Update auth hooks to use new endpoint and add perms checking"" (#29894)
Revert "Revert "Update auth hooks to use new endpoint and add perms checking"…"

This reverts commit a2a94d1f74.
2024-10-16 09:13:07 +08:00
Joshen Lim a2a94d1f74 Revert "Update auth hooks to use new endpoint and add perms checking" (#29893)
Revert "Update auth hooks to use new endpoint and add perms checking (#29870)"

This reverts commit a3e1fb2a0e.
2024-10-15 07:51:23 +00:00