Commit Graph

63 Commits

Author SHA1 Message Date
Jonathan Summers-Muir
f912536db8 [Design system] Feat/sonner (#27382)
* fix toast examples

* add sonner stuff

* new sonner examples added

* updated

* add upload POC

* add

* Update sonner-upload.tsx

* move statusicons

* Minor fix.

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2024-07-19 12:38:42 +02:00
Joshen Lim
cb4b0fe6d8 Add set search path for query performance query (#28084)
* Add set search path for query performance query

* more
2024-07-19 18:07:27 +08:00
Alaister Young
70da0f1d1d chore: cleanup packages (#27770)
* chore: cleanup packages

- Avoid circular imports
- Export API-types as types
- pg-format without depending on Node internal Buffer (not browser-compatible)
- Avoid importing from barrel files in ui dir

* chore: avoid barrel file imports in studio (#27771)

* chore: avoid barrel file imports

- Removes some unused imports
- Avoids barrel file import for faster builds + less memory

* add eslint rule

* type fixes

* delete layouts barrel

* delete components/grid barrel file

* delete components/grid/utils barrel file

* delete components/grid/components/common barrel file

* delete components/grid/components/editor barrel file

* delete components/grid/components/formatter barrel file

* delete components/grid/components/grid barrel file

* delete components/grid/components/header/filter barrel file

* remote components/grid/store barrel file

* remove components/interfaces/Auth/Policies barrel file

* delete components/interfaces/Settings/Logs barrel file

* delete components/ui/CodeEditor barrel file

* delete components/ui/Forms barrel file

* delete components/ui/Shimmers barrel file

* delete data/analytics barrel file

* delete hooks barrel file

* cleanup lib/common/fetch barrel file

* final * barral files cleanup

* global react-data-grid styles

* remove console.log

---------

Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>

* fix build

---------

Co-authored-by: Kevin Grüneberg <k.grueneberg1994@gmail.com>
2024-07-04 14:48:10 +08:00
Joshen Lim
553f2aa7fc Trim column name in table editor when updating column (#27522)
* Trim column name in table editor when updating column

* Address comment

* Address comment
2024-06-26 19:03:35 +08:00
Charis
253668fd93 fix: types (#27433) 2024-06-21 12:22:42 -04:00
Ivan Vasilov
5847ad54cf fix: Test the playwright tests in Github actions (#26799)
* Add an API page for run-lints endpoint.

* Fix the playwright test.

* Make the check mandatory in the github action.

* Fix a console.log.

* Use a more stable way of waiting for buttons before clicking them.

* Add helper method for dismissing toasts.

* Wait for the other toast.

* Try and fix the flakiness of the toasts.

* Minor fix.

* Upload artifacts at the end of the github action run.

* Fix yaml stuff.

* Use the newer action for uploading. Shorten the retention period to 7 days.

* Add waitForResponse for the entity types API call.

* snapshot.

* Wait for the page to be loaded.

* Make the timeout bigger when waiting for response.

* Try to fix the timeouts.

* Minor restructuring of the test.

* Add another test and few minor todo tests.

* Fix the table names.

* Don't render hcaptcha in test mode.

* Expand the test to include sorting and filtering.

* Add a test for checking if the other schemas are can be listed.

* Make the sort popover button more stable.

* Fix a unused forward ref in the NavMenuItem component.

* Don't render the Toaster container when in test mode.

* Simplify starting the dev server when testing.

* Fix all inputs to have proper test ids.

* Fix the command for testing.
2024-06-07 17:44:28 +02:00
Joshen Lim
21890675e5 Chore/sentry fixes 050624 (#27025)
* Add check before generating nodes in settings infrastructure

* Fix conditional in ResourceContent and add some typing

* Wrap checkIfPrivate with try catch

* Add ? in TableEditor.utils generateTableFieldsFromPostgresTable

* More typing

* Add ternary in RPC

* Remove mobx from API docs v1

* Fix renaming folder in storage explorer
2024-06-05 16:32:24 +07:00
Joshen Lim
4637140e72 Fix downgrade network error causing UI crash (#26919)
* Fix downgrade network error causing UI crash

* Ensure that all try blocks have at least a catch block and not an empty finally block

* Update apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PlanUpdateSidePanel.tsx

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

* Update

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
2024-06-03 11:08:39 +08:00
Joshen Lim
0a0f2260f9 Chore/gracefully handle large text or json in table editor (#26792)
* Support rendering large text/jsons in grid

* Support rendering large json in side panel, and large text in grid

* Support rendering large text in side panel

* Fix

* Update comment

* Fix the editValue type for json fields.

* Fix

* Update blur value

* Fix

* Feex

* Padding bump

* Small refactor

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Terry Sutton <saltcod@gmail.com>
2024-05-29 17:10:07 +08:00
Joshen Lim
d025e0f739 chore/fix studio jest tests (#25872)
* Fix tests in tests/unit, tests/components and files under tests, looking into tests/pages

* Fix tests under pages/projects root

* Fix

* Comment out broken tests that im stuck with

* Fix api-report.test

* Fix storage-report-test

* chore: fix some tests

* chore: remove logging

* Fix LogsPreviewer.test.js

* Fix most of logs-query-test

* Skip broken tests instead of false positiving them

---------

Co-authored-by: TzeYiing <ty@tzeyiing.com>
2024-05-11 12:05:25 +02:00
Charis
7d15462d5d fix(ux): allow creating fk on new column after changing name (#23204)
* fix(ux): allow creating fk on new column after changing name

Old behavior: If you create a new column, create an FK on that column,
then change the name of the column before saving, FK creation will fail.
This is because the name of the FK source column does not update to
match the changed name.

New behavior: When you change the name of the new column, the FK source
column changes to match, so the FK is created correctly.

* small fix

* Temp hide column privileges warning in column editor for new columns

* Smol fix

* Fix imports

* fix

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-04-24 09:23:34 -04:00
Joshen Lim
44b3853cbf Reinstate link button for foreign keys in table editor side panel (#23186)
* Reinstate link button for foreign keys in table editor side panel

* Skip assigning name when creating foreign key
2024-04-24 10:29:32 +07:00
Jonathan Summers-Muir
2581f978eb fix: update dark mode css. update borders for light and dark mode (#22392)
* update dark mode css. update borders for light and dark mode

* Delete concept-two.css

* Update Panel.tsx

* clean up
2024-04-05 07:46:24 +00:00
Jonathan Summers-Muir
645273cb45 Chore/update confirmation modal (#22328)
* Update confirmation modal

* update all props

* Update ExtensionCard.tsx

* clen up
2024-04-02 13:39:27 +08:00
Ryan Martin
b361544461 fix(studio): empty arrays become empty string in row editor (#16882)
* fix(studio): empty arrays become empty string in row editor

* test: update test case to match the new parseValue behavior

---------

Co-authored-by: Ryan Martin <rmrt1n@users.noreply.github.com>
Co-authored-by: Han Qiao <sweatybridge@gmail.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-03-27 11:22:50 +07:00
Joshen Lim
8b43a2b564 Add trims to table and column names (#22170) 2024-03-22 14:47:45 +07:00
Joshen Lim
742e7df396 Fix CSV text import not supporting null values (#22146) 2024-03-22 10:25:07 +07:00
Joshen Lim
180c052d4d Support updating column is unique when editing table in side panel (#22121) 2024-03-22 09:24:53 +07:00
Joshen Lim
8925d1f72e Add validation when creating enumerated types to ensure that name doesnt conflict with a native PG data type (#22120) 2024-03-21 16:02:37 +07:00
Jonathan Summers-Muir
a4a4a7e26d Deprecate old Badge component (#22037)
* Update Badge.tsx

* refactor apps with new props

* Update APIKeys.tsx

* format

* remove old code
2024-03-19 10:33:12 +01:00
Joshen Lim
948a2390fe Final replacements of ui setNotification with toast (#21885)
* Final replacements of ui setNotification with toast

* Rip out UiStore

* Rip out UiStore

* Shift files under authConfigSchema to components/Auth

* Rip out use of observers
2024-03-12 12:56:56 +08:00
Joshen Lim
3906f1cfb0 Replace ui setnotification with toast part 3 (#21877)
* Replace ui setnotification with toast part 3

* Convert ui setNotification loading to toast for those that dont require progress bar

* Fix

* lint
2024-03-08 21:43:41 +08:00
hallidayo
a6d16182d1 feat/table name whitespace (#21861)
added .trim to table names
2024-03-08 12:45:18 +00:00
Joshen Lim
6b741bc964 Replace ui setnotification with toast midway (#21867)
Replace ui setnotification with toast
2024-03-08 15:46:52 +08:00
Ivan Vasilov
845167ca14 chore: Delete MetaStore and RootStore (#20034)
* Replace all methods of MetaStore with react queries.

* Remove unneeded usages of MetaStore.

* Remove RootStore completely. The only thing left from these stores is uiStore.

* Remove unnecessary comments.

* Delete MetaStore.

* Fix the usage of the wrong toaster.

* Remove unused variables

* Remove onSqlQuery

* Convert some ui setNotification calls to direct toast calls

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-03-08 14:56:28 +08:00
Kevin Grüneberg
f9a55935f5 chore: use type imports for types/interfaces (#21738) 2024-03-04 20:48:22 +08:00
Kevin Grüneberg
13cfc0abb5 fix: barrel imports (#21728)
Avoid importing all components via barrel files that lead to bloated bundles/chunks
2024-03-04 18:39:53 +08:00
Joshen Lim
bb5108e154 Chore/foreign key management in column editor (#21683)
* Support adding foreign key via ColumnEditor

* Support updating/deleting foreign key from ColumnEditor
2024-03-04 16:00:00 +08:00
Jonathan Summers-Muir
c4a492002b Chore/move confirmation dialogs (#21651)
* move confirmation dialogs

* Update index.tsx

* Update ExtensionCard.tsx
2024-03-01 18:16:25 +08:00
Joshen Lim
0ddd1b4711 Remove duplicated types-query, use enumerated-types-query instead (#21632)
* Remove duplicated types-query, use enumerated-types-query instead

* Fix type
2024-02-29 11:29:57 +08:00
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
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
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
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
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
Kevin Grüneberg
542d984b3e chore: reduce main bundle size (#19918) 2023-12-20 17:49:15 +01:00