Commit Graph

43 Commits

Author SHA1 Message Date
Joshen Lim
dcdc3cd230 Fix table editor unable to update PK after renaming table (#21285)
* Fix table editor unable to update PK after renaming table

* Lint
2024-02-26 06:21:42 +00:00
Terry Sutton
bdd3ad76ad Chore/show impersonator in views (#21401)
* Show role impersonation in views and tables

* Small fixes

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-02-21 15:34:33 +08:00
Joshen Lim
8af291101d Fix foreign key management bugs (#21381) 2024-02-21 14:34:12 +08:00
Ivan Vasilov
66ae36e005 feat: Playwright tests (#21083)
* initial commit for testing the github action.

* Improvements to the Github action.

* Add docker caching.

* Fix an issue in the github action.

* Another fix for the action.

* Just delete the db after the tests.

* Add a supabase app to the playwright-tests.

* Delete .env.testing.

* Remove the docker image caching from the Playwright github action.

* Add a README.md.

* Add an example test for the table editor.

* Ignore the generated keys.json.

* Add commands for running and writing tests.

* Remove Auth tests.

* Only show the react-query tool when not in test mode.

* Add data-testids to the buttons and use them in the test.

* Handle a case where SUPABASE_URL isn't defined.

* Fix the button test id.

* Remove some dependency.

* Try setting a timeout for an action.

* Add timeout to another action.

* Add some timeouts before the save button.

* Add some timeout before clicking save.

* Enable the video recording only during local testing.

* Minor fixes.

* Expand the README.
2024-02-19 12:12:54 +01:00
Terry Sutton
46051bce17 Chore/table editor header simplification (#18366)
* start

* Update

* Types

* Passhref

* Cleanup

* Update

* Fix

* Updates

* Updates

* Enable RLS from table editor

* Cleanup

* Filter current table policies

* Fix missing footer

* Duplicate role picker

* Remove rls banner

* Add tooltip for rls enabled, but no policies

* Fix footer positioning

* Prettier

* Change wording

* Update button style

* Cleanup

* Small update

* Fix Auth policies button number bg color

* Fix

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-02-15 09:10:30 -03:30
Joshen Lim
39f1fdae2f Format 503 errors in AlertError (#21283)
* Format 503 errors in AlertError

* Small fix
2024-02-15 17:00:14 +08:00
Joshen Lim
168a48f537 Fix error handling if formatting definition throws error (#21255) 2024-02-14 18:58:45 +08:00
Joshen Lim
ee0d2b40dc Fix duplicating table not saving description (#21215) 2024-02-13 17:30:02 +08:00
Joshen Lim
0ee75935f7 Support for composite foreign keys in table editor (#21078)
* Init foreign keys manage

* Midway

* Midway

* Implement functionality for new foreign key management flow in table editor

* Deprecate old add and remove foreign key queries

* Lint

* Set editor dirty when managing foreign keys

* Add basic validation in new ForeignKeySelector

* Remove FK management in column editor, deprecate old foreign key selector components

* Add validation on columnm types for foreign keys

* Set column type to foreign key type if new column

* Show appropriate notices for when referenced column doesnt match source column type

* fix

* Remove comment

* Lint

* ColumnEditor swap position of data type and Fk
2024-02-13 10:42:06 +08:00
Joshen Lim
758f257732 Chore/fix add data in table editor (#21137)
* Fix error handling when adding data to existing table via spreadsheet upload

* Fix error handling when adding data to existing table via text
2024-02-09 17:03:01 +08:00
Ivan Vasilov
e81442de56 chore: Migrate TableStore (#20033)
* Add create, update and delete mutations for tables.

* Use the new mutations instead of the table store.

* Fully remove the TableStore from the MetaStore.

* Move the methods from MetaStore into pure functions in SidePanelEditor utils.

* Remove TableStore.

* Refactor the onError callbacks to be on the mutations.

* Convert some of the UIStore invocations.

* Fixed not closing the modal in case of an error. Migrate some uses of uiStore.

* Use onSettled on all RQ hooks.

* Remove the ui param to the create/updateTable functions.

* Add a missing connection string.

* Add progress bar for loading UI for importing rows

* Update apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx

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

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
2024-02-06 14:56:59 +08:00
Alaister Young
a4f86bce8f chore: increase react-query stale time (#19465)
* chore: increase react-query stale time

* keep staleTime: 0 for table rows

* use staleTime: 0 for all user sql queries

* use staleTime: 0 for all pg-meta queries

* Some fixes

* fix updating tables

* fix bug while editing column names

* Fix deleting column in database/tables column list not revalidating UI

* Fix updating column in database/tables column list throwing ane rror

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-02-06 13:47:05 +08:00
Faizan Rasool
31fca2d7ea remove trailing commas (#20781)
* remove trailing commas

* test cases added

* Opt for immutable way in JsonEditor

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-02-05 14:41:07 +08:00
Kevin Grüneberg
f7e60bf324 chore: upgrade prettier/eslint + autofix (#20785) 2024-01-30 10:54:02 +08:00
Joshen Lim
fca9b3bff8 Feat/support expanding text cells into a sidepanel editor (#20727)
* Do up logic for callback for opening side panel

* Add TextEditor side panel and fix some quirky bugs with JSONEditor too

* Add Markdown Preview in TextEditor

* Fix bad cs

* Fix border css
2024-01-25 17:47:36 +07:00
Joshen Lim
078a694ed4 Fix database tables page not updating when creating/deleting tables (#20625) 2024-01-22 18:02:15 +07:00
Jordi Enric
62e1a3fb2a fix: add schema name to url query params (#20580)
add schema name to url query params
2024-01-19 18:22:47 +01:00
Alaister Young
4bf421c5c3 fix: entity types query keepPreviousData (#20476) 2024-01-16 23:06:22 +11:00
Alaister Young
6156133cfe fix: truncation while impersonating roles (#20349)
fix: truncation while impersonating
2024-01-11 11:07:28 -03:30
Ivan Vasilov
ef651aa9ba chore: Migrate ColumnsStore (#20032)
* Add react-query mutations for columns APIs.

* Use the new delete column mutation.

* Remove the column store and replace all its methods with mutations from react-query.

* Fix type errors.

* Move some the meta store methods to be pure functions in sidepanel.utils.

* Move the createColumn and updateColumn out of the metaStore.

* Some refactors and fixes

* Shift query invalidation when deleting column to mutation file instead of component file

* reorder some code for my sanity

* remove some @ts-ignores

* remove more @ts-ignores

* Update apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts

* Fix ForeignKeyFormatter crashing client

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Alaister Young <a@alaisteryoung.com>
Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
2024-01-10 15:20:18 +08:00
Ariel Aharonson
6d121f1546 feat(dashboard): Add column-level privileges management (#13745)
* add privileges page

* fix

* fix: could have both global and column-specific privileges + is global per privilege

* Trigger Build

* load permissions data for current table only

* fix style for light theme

* add a guide to Privileges

* Update apps/docs/pages/guides/auth/column-level-security.mdx

Co-authored-by: Greg Richardson <greg.nmr@gmail.com>

* Update apps/docs/pages/guides/auth/column-level-security.mdx

Co-authored-by: Greg Richardson <greg.nmr@gmail.com>

* Update doc

* Update docs

* progress moving privileges to pg-meta

* split up column privileges and table privileges

* adds loading state to toggles

* Add feature flag, move from auth section to database section

* Cleanup

* Update meta store table lists, add header warnings, update docs

* Add alert if any columns have privilages

* Spelling

* fix api.d.ts

* fix link

* move to auth pages

* only show editable schemas

* limit roles

* auto select first table

* remove roles meta store

* inline toggling

* apply privileges all at once

* add preview and use new switch component

* fix spelling

* handle long column names

* warn users about losing changes when changing schemas/tables

* remove strange docs link

* fix feature preview after reload

* use shadcn select

* Update select.tsx

* Minor UX fixes

* Update toast

* Update feature preview image for cls

* update cls warnings

* update warnings

* fix toast message

* Add migration alert to preview page

* Add link to CLS from feature preview, and add empty state on CLS page if feature preview is not enabled

* Shift local storage keys hard code to lib/constants

---------

Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>
Co-authored-by: Greg Richardson <greg.nmr@gmail.com>
Co-authored-by: Terry Sutton <saltcod@gmail.com>
Co-authored-by: Alaister Young <a@alaisteryoung.com>
Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-01-10 17:39:03 +11:00
Ivan Vasilov
b6d8e770fa fix: Don't fetch columns when fetching tables by default (#20157)
* Only fetch the tables from the required schema in the MetaStore.

* Don't include the columns in the getTables API call unless a flag is passed.

* Use the new flag in the ForeignKeySelector.

* Columns should be included for the schema visualizer.

* Address comments.
2024-01-09 17:39:40 +01:00
Kevin Grüneberg
d12332ea5a chore: xmas cleanup (#19938) 2024-01-04 17:27:49 +01:00
Ivan Vasilov
693294ec85 chore: Migrate VaultStore (#20020)
* Move listEncryptedColumns method to a function.

* Remove encryptColumn method since it's unused.

* Add CRUD RQ queries/mutations for vault secrets.

* Use the new queries/mutations.

* Add RQ for secret/decrypted values of secrets.

* Add RQ queries/mutations for pg-sodium keys.

* Use the new hook for decrypted value.

* Use the new hooks for pg sodium keys.

* Remove unneeded code from the vault store.

* Delete VaultStore and all usages of it.

* Small style fix

* Fix invalidation for create, update, delete secrets

* Small UI fixes to EditSecretModal

* Fix invalidation for pg-sodium-keys rq

* Add default error handler for pg sodium keys rq

* Undo

* Add default error handler for vault secrets RQ

* Remove observer on vault pages

* Fix database wrappers with vault

* Add loading state for vault keys

* fix pg sodium keys invalidation

* Opt for immutable const declaration in SecretsManagement

* remove keyId and keyName context from ColumnEditor, no longer supports TLE

* Address PR comments

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-01-04 15:15:45 +07:00
Ivan Vasilov
c867205b20 chore: Migrate ViewsStore (#19975)
* Move useEncryptedColumns hook and use it in the TableGridEditor.

* Convert the viewsQuery to use data/fetchers. It also handles invalidation of schemas.

* Invalidate the view when deleting a column or a table.

* Use the new query function in VaultStore.

* Remove the viewStore.

* Fix two more edge cases. Add comments for it.
2024-01-02 12:52:06 +01:00
Ivan Vasilov
fdfdb5282b chore: Remove released feature flags (#19917)
* Remove roleImpersonation flag.

* Remove realtimeDashboard.

* Fix forgotten uses of the role impersonation flag.
2023-12-26 10:35:20 +01:00
Kevin Grüneberg
542d984b3e chore: reduce main bundle size (#19918) 2023-12-20 17:49:15 +01:00
Joshen Lim
f8d30a35c0 Fix policy count in table editor header (#19903) 2023-12-20 11:09:31 +00:00
Joshen Lim
b6f8a05a79 Support prettify JSON in side panel editor (#19899)
* Support prettify JSON in side panel edito

* Fix
2023-12-20 17:59:53 +07:00
Joshen Lim
d0c730d08e Chore/deprecate policies store (#19723)
* Add database policies RQ and shift all usage of policies from pg meta mobx to RQ

* Deprecate and remove policies store from pg meta mobx store

* Fix policies not showing by table and schema

* Update create policy mutation body
2023-12-18 12:17:57 +07:00
Joshen Lim
6298e1e14b Chore/deprecate publications store (#19655)
* Hide RLS assistant features for orgs with HIPAA

* Replace all usage of meta.publications with react query

* Deprecate publications store from meta store mobx, shift updateTableRealtime logic to SidePanelEditor

* Address comments
2023-12-14 10:21:25 +07:00
Joshen Lim
18840b5e3b Chore/column editor show types from extensions schema (#19580)
* Show types from extensions schema in table editor

* Shift postgres types to RQ

* Deprecate types store in mobx

* Address feedback

* Update label
2023-12-11 15:11:23 +07:00
Alaister Young
35e5b6b87b chore: make returning optional for insert/update queries (#19463)
* chore: make returning optional for insert/update queries

* use arrow function for SupabaseGridLayout

* add success toasts
2023-12-11 08:04:49 +00:00
Alaister Young
49219d4b88 chore: add role impersonation on views (#19581) 2023-12-11 17:52:48 +11:00
Alaister Young
9d8e8b068f chore: move role impersonation state into a context (#19510)
* chore: move role impersonation state into a context

* clean up ProjectContext.tsx imports

* move isRoleImpersonationEnabled to only relevant queries
2023-12-11 16:32:11 +11:00
Alaister Young
42164183f2 fix: add missing asChild props (#19456)
* fix: add missing asChild props

* move csvlink outside of dropdown trigger

* fix incorrect merge
2023-12-06 21:11:32 +11:00
Alaister Young
49ac7d8975 chore: improve loading on table editor index page (#19454)
* chore: improve loading on table editor index page

* fix margin on no results

* make TableEditorLayout non-blocking by default

* change no search results text
2023-12-06 07:17:46 +00:00
Gulshan
db747fb4fa fix: drag and drop causing page crash (#19340) 2023-12-05 14:15:33 +10:00
Alaister Young
e6006b9653 feat: user impersonation (#18945)
* feat: user impersonation

* refactor

* add anon impersonation

* add user impersonation to graphiql

* thanks Ivan for this one

* add radio buttons

* progress

* working user selector

* adds loading and error states to user selector

* nicer popover button

* default graphiql to use service role key

* styling updates

* fix padding in graphiql

* add service role warning to graphiql

* add user impersonation to realtime inspector

* add feature flag

* use Alert_Shadcn_ instead of old Alert

* Update apps/studio/lib/role-impersonation.ts

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

* update title

* Update apps/studio/components/interfaces/RoleImpersonationSelector/UserImpersonationSelector.tsx

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

* Update apps/studio/components/interfaces/RoleImpersonationSelector/Icons.tsx

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

* Update apps/studio/components/interfaces/RoleImpersonationSelector/Icons.tsx

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

* Update apps/studio/components/interfaces/RoleImpersonationSelector/Icons.tsx

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

* Update apps/studio/components/interfaces/RoleImpersonationSelector/Icons.tsx

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

* Update apps/studio/components/interfaces/RoleImpersonationSelector/Icons.tsx

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

* Update apps/studio/components/interfaces/RoleImpersonationSelector/UserImpersonationSelector.tsx

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

* add constant padding at the bottom of user selector

* update graphiql buttons font size

* make rls warning dismissable

* use text-foreground on rls warning title

* fix no results while impersonating a role

* fix error line number when impersonating a role

---------

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2023-12-04 04:45:11 +00:00
Joshen Lim
f47a7385ab Assign keys to each side panel editor on the table editor to ensure that input fields have the latest data (#19264)
* Assign keys to each side panel editor on the table editor to ensure that input fields have the latest data

* move rowsPerPage to valtio + more cleanup

* remove sidepanel row optimistic updates

* Change prop for listbox in input field from default value to value

---------

Co-authored-by: Alaister Young <a@alaisteryoung.com>
2023-11-28 21:24:37 +11:00
likendev
e93afc3575 fix: table editor new column input field (#17970)
Issue #17969

* added padding to the right to prevent the icon blocking the input field
2023-11-24 11:44:25 +00:00
Francesco Sansalvadore
be9590c890 Multiple themes management (#18871)
* set up multiple themes in studio

* set up multiple themes in studio

* set up multiple themes in docs and www

* update all resolvedTheme to also include deep-dark

* update all resolvedTheme checks to also include deep-dark

* update tailwind.config.js tokens

* update tailwind.config.js tokens

* update leftover scale12 token

* update if resolvedTheme _doesn't_ include 'dark'

* update more styling tokens

* add dynamic themes to CmdK

* fix nav and footer for multi theme

* add data-theme selector output to transformTokens.js

* update code-hike.css to target data-theme css

* update tailwindcss to ^3.3.5

* ThemeImage with light and dark src for www and docs

* add brand-button styling token

* update old dark theme boolean

* update old dark theme boolean

* make homepage product visuals themeable

* update product page themed images

* update badge green with brand

* fix roles list appearance

* fix auth widget in auth page

* update more dark logic

* update more dark logic

* add button default bg and border

* update pricing page theme styling

* clean up Themeimage

* remove forceDark in homepage

* update dark:border-dark occurrences

* update dark:border-dark occurrences

* fix dark mode base colors

* remove foreground-strong

* fix notification badge bg

* remove some dark: selectors

* update dark: selectors

* update code-hike deep dark bg color

* fix comment typo

* update border-button-hover token

* fix customer story logo

* remove some more dark: selectors

* restore forceDark in www homepage

* fix auth react icon

* fix homepage product visuals

* remove theme

* add brand-link token

* fix checkbox bg

* npm install

* more visible EntityListItem active bg

* fix --background-alternative-default css vars

---------

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
2023-11-16 16:41:53 +00:00
Ivan Vasilov
436bdb10ae chore: Move the studio app to apps/studio (#18915)
* Move all studio files from /studio to /apps/studio.

* Move studio specific prettier ignores.

* Fix the ui references from studio.

* Fix the css imports.

* Fix all package.json issues.

* Fix the prettier setup for the studio app.

* Add .turbo folder to prettierignore.

* Fix the github workflows.
2023-11-15 12:38:55 +01:00