Compare commits

..

222 Commits

Author SHA1 Message Date
Szilárd Dóró
19818e2b59 Merge pull request #1777 from nhost/changeset-release/main
chore: update versions
2023-03-27 12:03:16 +02:00
github-actions[bot]
b3eeec82ef chore: update versions 2023-03-27 09:38:55 +00:00
Szilárd Dóró
34ff254696 Merge pull request #1782 from nhost/renovate/sharp-0.x
fix(deps): update dependency sharp to ^0.32.0
2023-03-27 11:37:33 +02:00
Szilárd Dóró
1c4806bf51 chore: add changeset 2023-03-27 11:17:41 +02:00
renovate[bot]
2fb82ec97d fix(deps): update dependency sharp to ^0.32.0 2023-03-27 07:50:45 +00:00
Szilárd Dóró
0c994a9651 Merge pull request #1779 from nhost/renovate/pnpm-find-workspace-dir-6.x
fix(deps): update dependency @pnpm/find-workspace-dir to v6
2023-03-27 09:48:14 +02:00
Szilárd Dóró
4713cecfc2 chore: add changeset 2023-03-27 09:26:44 +02:00
renovate[bot]
f79eebadbf fix(deps): update dependency @pnpm/find-workspace-dir to v6 2023-03-24 21:30:22 +00:00
Szilárd Dóró
ac174b5e51 Merge pull request #1780 from nhost/chore/vercel-preview-fetcher 2023-03-24 17:07:43 +01:00
Szilárd Dóró
dc9ddfc9ae chore(ci): adjust preview fetcher 2023-03-24 16:30:29 +01:00
Szilárd Dóró
3bdd9f570c Merge pull request #1773 from nhost/chore/dashboard-delete-table-tests
chore(dashboard): tests for table deletion
2023-03-24 15:52:25 +01:00
Szilárd Dóró
94477be998 Merge pull request #1778 from nhost/chore/fetch-preview-url
chore: use dynamic test URL
2023-03-24 15:51:47 +01:00
Szilárd Dóró
568577e8ca Merge pull request #1774 from nhost/renovate/docusaurus-monorepo
fix(deps): update docusaurus monorepo to v2.4.0
2023-03-24 15:38:23 +01:00
Szilárd Dóró
e93b06ab8f chore: add changeset 2023-03-24 15:37:08 +01:00
Szilárd Dóró
c75bf46ba1 fix: fetch valid previews only 2023-03-24 15:24:36 +01:00
Szilárd Dóró
63a1fd09b5 fix: use correct Vercel token 2023-03-24 15:09:42 +01:00
Szilárd Dóró
630d44ad6e fix: use staging project ID 2023-03-24 14:55:26 +01:00
Szilárd Dóró
d7db521974 chore: use dynamic test URL 2023-03-24 14:16:05 +01:00
renovate[bot]
90e4053f0a fix(deps): update docusaurus monorepo to v2.4.0 2023-03-24 09:57:19 +00:00
Szilárd Dóró
8e9d5d1b38 Merge pull request #1775 from nhost/fix/storage-sdk-tests
chore(hasura-storage-js): improve presignedUrl test
2023-03-24 10:54:51 +01:00
Szilárd Dóró
43c86fef14 chore(hasura-storage-js): improve presignedUrl test 2023-03-24 10:25:18 +01:00
Szilárd Dóró
6b97340cf4 fix: remove test.only call 2023-03-23 16:14:49 +01:00
Szilárd Dóró
1605756362 chore: add tests for table deletion 2023-03-23 16:05:21 +01:00
Szilárd Dóró
6437544384 Merge pull request #1771 from nhost/changeset-release/main
chore: update versions
2023-03-23 14:20:16 +01:00
github-actions[bot]
b4dcd1996d chore: update versions 2023-03-23 13:01:48 +00:00
Szilárd Dóró
7fb73dbb1b Merge pull request #1770 from nhost/fix/subscription-errors
fix(apollo): retry subscriptions on error
2023-03-23 14:00:11 +01:00
Szilárd Dóró
a66b11d245 Merge pull request #1769 from st3phan/patch-1
Fix import in docs for SignedIn component
2023-03-23 13:23:35 +01:00
Szilárd Dóró
912ed76c64 fix: potential subscription fix 2023-03-23 12:30:14 +01:00
Szilárd Dóró
b47c0d1af7 Merge pull request #1765 from nhost/chore/dashboard-db-tests
chore(dashboard): tests for table creation
2023-03-23 09:36:27 +01:00
Stephan van Opstal
b97ab2be2f Fix import in docs 2023-03-22 21:46:58 +01:00
Szilárd Dóró
f12cb666ff fix: remove test.only call 2023-03-22 15:42:05 +01:00
Szilárd Dóró
c3b2b1cd02 chore: add remaining table creation tests 2023-03-22 15:40:39 +01:00
Szilárd Dóró
c0b71102d4 chore: add foreign key constraint test 2023-03-22 15:32:18 +01:00
Szilárd Dóró
5f68ae95c4 chore: add extra database UI tests 2023-03-22 15:22:49 +01:00
Szilárd Dóró
2d1b7bb292 chore: restructure tests, add basic table creation test 2023-03-22 14:57:33 +01:00
Szilárd Dóró
ee154d4eca Merge pull request #1764 from nhost/changeset-release/main
chore: update versions
2023-03-22 14:21:18 +01:00
github-actions[bot]
58ef9bbe02 chore: update versions 2023-03-22 12:49:02 +00:00
Szilárd Dóró
f3f35beefd Merge pull request #1758 from nhost/renovate/turbo-1.x
chore(deps): update dependency turbo to v1.8.5
2023-03-22 13:47:44 +01:00
Szilárd Dóró
d31330e6c0 Merge pull request #1762 from nhost/renovate/react-error-boundary-4.x
fix(deps): update dependency react-error-boundary to v4
2023-03-22 13:47:30 +01:00
Szilárd Dóró
c3dda79d95 Merge branch 'renovate/react-error-boundary-4.x' of https://github.com/nhost/nhost into renovate/react-error-boundary-4.x 2023-03-22 13:11:13 +01:00
Szilárd Dóró
7c1273725d chore: add changeset 2023-03-22 13:11:01 +01:00
renovate[bot]
70be0e1ab4 fix(deps): update dependency react-error-boundary to v4 2023-03-22 12:08:14 +00:00
renovate[bot]
4f5870cfd7 chore(deps): update dependency turbo to v1.8.5 2023-03-22 12:07:47 +00:00
Szilárd Dóró
623607476e Merge branch 'main' into renovate/react-error-boundary-4.x 2023-03-22 13:07:31 +01:00
Szilárd Dóró
1e232713d9 Merge pull request #1763 from nhost/chore/improve-e2e
chore(tests): improve E2E tests
2023-03-22 13:05:43 +01:00
Szilárd Dóró
1ed647c4e9 fix: fix lint and test jobs 2023-03-22 12:50:12 +01:00
Szilárd Dóró
b666a173b1 fix: use correct name for the build script 2023-03-22 12:15:48 +01:00
Szilárd Dóró
caba147b32 chore: add changeset 2023-03-22 12:07:44 +01:00
Szilárd Dóró
ca365fc8e7 cleanup cypress 2023-03-22 12:06:46 +01:00
Szilárd Dóró
d88cdedb26 migrated file upload e2e tests 2023-03-22 11:39:17 +01:00
Szilárd Dóró
1de08cecaf migrate password change e2e tests 2023-03-22 11:21:38 +01:00
Szilárd Dóró
47bb997036 migrate email change e2e tests 2023-03-22 11:15:20 +01:00
Szilárd Dóró
4e4d962f30 migrate apollo e2e tests 2023-03-22 11:05:46 +01:00
Szilárd Dóró
883fb82c77 migrate sign-in tests 2023-03-22 10:46:11 +01:00
Szilárd Dóró
c9f5634ac2 chore: migrate sign in e2e tests 2023-03-21 18:25:19 +01:00
renovate[bot]
6ee9a589fb fix(deps): update dependency react-error-boundary to v4 2023-03-21 17:21:51 +00:00
Szilárd Dóró
e2d733cf34 chore: migrate passwordless e2e tests 2023-03-21 16:45:19 +01:00
Szilárd Dóró
a0d7327c8d chore: migrate sign up tests 2023-03-21 16:33:56 +01:00
Szilárd Dóró
c7c8a20334 chore: port some tests to playwright 2023-03-21 16:10:37 +01:00
Szilárd Dóró
cca8de5805 Merge pull request #1760 from nhost/fix/dashboard-e2e-workflow
fix dashboard e2e workflow
2023-03-21 13:42:10 +01:00
Szilárd Dóró
8c065c42d6 fix: remove dashboard-e2e job 2023-03-21 13:19:31 +01:00
Szilárd Dóró
210af3a3e8 merge ci and e2e workflows 2023-03-21 12:52:01 +01:00
Szilárd Dóró
fbb12a8079 update workflow triggers 2023-03-21 12:44:37 +01:00
Szilárd Dóró
77692ac40e remove unnecessary job from e2e workflow 2023-03-21 11:57:49 +01:00
Szilárd Dóró
2c2a42a8e8 fix test script 2023-03-21 11:51:22 +01:00
Szilárd Dóró
a8466798a3 Merge pull request #1761 from nhost/changeset-release/main
chore: update versions
2023-03-21 11:47:58 +01:00
Szilárd Dóró
a45c0970bb pin playwright version 2023-03-21 11:46:30 +01:00
Szilárd Dóró
9bf30a1ccc fix e2e script 2023-03-21 11:35:12 +01:00
github-actions[bot]
99d3d82c72 chore: update versions 2023-03-21 10:23:53 +00:00
Szilárd Dóró
43acb3fb50 Merge pull request #1757 from nhost/renovate/hookform-resolvers-3.x
fix(deps): update dependency @hookform/resolvers to v3
2023-03-21 11:22:15 +01:00
Szilárd Dóró
ba9ef13ba3 update workflow 2023-03-21 11:21:28 +01:00
Szilárd Dóró
cea507a271 fix: install browsers before e2e tests 2023-03-21 11:07:24 +01:00
Szilárd Dóró
9130ab1230 chore(deps): bump yup and @hookform/resolvers 2023-03-21 10:58:44 +01:00
Szilárd Dóró
27acdd6f56 fix: add missing env vars 2023-03-21 10:43:55 +01:00
Szilárd Dóró
dcdacd73ec fix: fix dashboard e2e workflow 2023-03-21 10:24:10 +01:00
Szilárd Dóró
9c9966a30f Merge pull request #1759 from diecknet/patch-1
fix DevDependencies parameter for @types/express
2023-03-21 10:22:50 +01:00
Andreas Dieckmann
5a23e7a0a8 fix DevDependencies parameter for @types/express
it's `-D` not `-d`
2023-03-20 22:18:40 +01:00
renovate[bot]
47500fac39 fix(deps): update dependency @hookform/resolvers to v3 2023-03-20 18:24:31 +00:00
Szilárd Dóró
cbbf53c05b Merge pull request #1756 from nhost/feat/playwright
chore(dashboard): prepare E2E testing framework
2023-03-20 16:02:27 +01:00
Szilárd Dóró
11bd011860 fix: correct CI workflows 2023-03-20 15:02:36 +01:00
Szilárd Dóró
e3c0c47777 fix: correct tests 2023-03-20 14:03:27 +01:00
Szilárd Dóró
d825404b54 Merge branch 'main' into feat/playwright 2023-03-20 13:45:17 +01:00
Szilárd Dóró
d46d77ee71 Merge pull request #1751 from Glenas7/docs/google-oauth-guide
Added Javascript origins step to docs
2023-03-20 12:20:35 +01:00
Szilárd Dóró
a292482705 Update docs/docs/authentication/sign-in-methods/4-google.mdx 2023-03-20 12:20:27 +01:00
Szilárd Dóró
8a4ca41172 Merge pull request #1754 from nhost/changeset-release/main
chore: update versions
2023-03-20 11:33:21 +01:00
github-actions[bot]
fd3ce98600 chore: update versions 2023-03-20 10:08:17 +00:00
Szilárd Dóró
04f36a0491 Merge pull request #1669 from nhost/new-create-app-mutation
feat(dashboard): Limit Free Projects
2023-03-20 11:05:30 +01:00
Szilárd Dóró
5e2ecb4d1e Merge pull request #1749 from nhost/changeset-release/main
chore: update versions
2023-03-20 10:00:29 +01:00
Glenas7
eca9e551e8 Added Javascript origins step 2023-03-18 21:30:46 +01:00
github-actions[bot]
52ebbef762 chore: update versions 2023-03-17 15:01:14 +00:00
Szilárd Dóró
82faa4ca0a Merge pull request #1748 from nhost/fix/presigned-url-params
fix(hasura-storage-js): allow image transformation parameters in `getPresignedUrl`
2023-03-17 15:58:38 +01:00
Szilárd Dóró
d06a21764a fix unit tests 2023-03-17 15:10:15 +01:00
Szilárd Dóró
8b54d290a5 Merge pull request #1747 from nhost/changeset-release/main
chore: update versions
2023-03-17 14:51:41 +01:00
Szilárd Dóró
4cfa6bbe1e chore: update changeset 2023-03-17 14:12:48 +01:00
Szilárd Dóró
614f213e26 feat: allow image transformation parameters in getPresignedUrl 2023-03-17 14:11:17 +01:00
github-actions[bot]
4eebf51821 chore: update versions 2023-03-17 11:29:52 +00:00
Szilárd Dóró
9a52298aa7 Merge pull request #1746 from nhost/fix/data-grid-date-cell
fix(dashboard): show correct date in data grid
2023-03-17 12:28:34 +01:00
Szilárd Dóró
099eebe602 Merge pull request #1745 from nhost/fix/disable-new-users
fix(dashboard): disable new users
2023-03-17 12:20:38 +01:00
Szilárd Dóró
7cce8652e7 chore: update response message for pausing 2023-03-17 12:20:16 +01:00
Szilárd Dóró
f2e2323801 fix: refresh list when deleting app 2023-03-17 12:09:41 +01:00
Szilárd Dóró
4e16de6db2 chore: cleanup, improve error messages 2023-03-17 12:01:11 +01:00
Szilárd Dóró
798e591b1d fix: show correct date in data grid 2023-03-17 10:19:39 +01:00
Szilárd Dóró
b48bc034ca chore: add changeset 2023-03-17 10:01:26 +01:00
Szilárd Dóró
f57819230b fix: disable new users 2023-03-17 10:00:25 +01:00
Szilárd Dóró
3d8067ff7b fix: show pausing only for free projects
- improve project list
2023-03-17 09:44:02 +01:00
Szilárd Dóró
0fa4b428a9 chore: change function to string 2023-03-16 15:04:13 +01:00
Szilárd Dóró
8c5864340e fix: fix build error 2023-03-16 14:57:25 +01:00
Szilárd Dóró
c131100af9 chore: fetch free and live apps separately 2023-03-16 14:52:35 +01:00
Szilárd Dóró
e363fef8cf fix: refetch projects after delete/pause 2023-03-16 13:11:28 +01:00
Szilárd Dóró
d8072101c8 feat: added pause section to settings 2023-03-16 13:03:11 +01:00
Szilárd Dóró
afbba531a1 Merge branch 'main' into new-create-app-mutation 2023-03-16 10:28:02 +01:00
Szilárd Dóró
4b6df8b9d6 Merge pull request #1731 from nhost/changeset-release/main
chore: update versions
2023-03-16 10:23:45 +01:00
Szilárd Dóró
a2af5a674d fix(deps): fix @nhost/apollo version 2023-03-16 09:55:43 +01:00
github-actions[bot]
c33c1fd6b9 chore: update versions 2023-03-16 08:37:32 +00:00
Szilárd Dóró
041d9b98e3 Merge pull request #1741 from nhost/renovate/stripe-react-stripe-js-2.x
fix(deps): update dependency @stripe/react-stripe-js to v2
2023-03-16 09:37:26 +01:00
Szilárd Dóró
e4b4940397 Merge pull request #1730 from nhost/chore/remove-axios-deprecation
fix: remove `useAxios`, restore autogenerated docs
2023-03-16 09:36:09 +01:00
renovate[bot]
be91f4ed2a fix(deps): update dependency @stripe/react-stripe-js to v2 2023-03-13 22:14:47 +00:00
Siarhei Lipchyk
ec6ba846cf Merge pull request #1732 from nhost/chore/dashboard-hasura-admin-secret
Allow to override hasura admin secret in docker
2023-03-13 10:01:47 +01:00
Szilárd Dóró
a9e9fc4305 chore: extend tests 2023-03-10 16:57:21 +01:00
Siarhei Lipchyk
d8d8394b3b Allow to override hasura admin secret in docker 2023-03-10 13:11:02 +01:00
Szilárd Dóró
f051a121b2 Merge pull request #1729 from nhost/fix/sdk-backend-url 2023-03-10 12:37:48 +01:00
Szilárd Dóró
c547b490e5 chore: improved overview tests 2023-03-10 11:46:12 +01:00
Szilárd Dóró
4f4449b855 Merge remote-tracking branch 'origin/main' into feat/playwright 2023-03-10 11:28:13 +01:00
Szilárd Dóró
6ed46ce2d4 fix(docs): fix broken link 2023-03-10 11:15:22 +01:00
Szilárd Dóró
bfb4c1a6cc fix docs and remove useAxios 2023-03-10 11:04:51 +01:00
Szilárd Dóró
776c8f9237 Merge pull request #1721 from nhost/changeset-release/main
chore: update versions
2023-03-10 11:03:55 +01:00
github-actions[bot]
c0773d82e9 chore: update versions 2023-03-10 09:38:58 +00:00
Siarhei Lipchyk
c46b1383f2 Merge pull request #1724 from nhost/fix/dashboard-docker-entrypoint
Fix default values for placeholders
2023-03-10 10:37:46 +01:00
Siarhei Lipchyk
beed2eba21 Fix default values for placeholders 2023-03-10 10:36:01 +01:00
Szilárd Dóró
70f9610041 Merge pull request #1723 from nhost/fix/provisioning-status-indicator
fix(dashboard): miscellaneous fixes
2023-03-10 10:23:22 +01:00
Szilárd Dóró
e91de1088d chore: remove unused helper 2023-03-10 10:22:56 +01:00
Szilárd Dóró
ce1ee40dab fix: deprecate backendUrl, allow other params 2023-03-10 10:22:11 +01:00
Szilárd Dóró
bd7929f5ed revert provisioning status changes 2023-03-10 09:35:36 +01:00
Szilárd Dóró
2c8559a319 fix(dashboard): misc fixes 2023-03-09 15:54:17 +01:00
Szilárd Dóró
bd5ea5ee3a Merge pull request #1722 from nhost/chore/renovate-ci
chore(ci): remove renovate changeset automation
2023-03-09 13:09:59 +01:00
Szilárd Dóró
3538dbac39 chore(ci): remove renovate changeset automation 2023-03-09 11:12:06 +01:00
Szilárd Dóró
03b5cda69a Merge pull request #1700 from nhost/renovate/graphiql-react-0.x
fix(deps): update dependency @graphiql/react to ^0.17.0
2023-03-09 11:08:04 +01:00
Szilárd Dóró
4329d04854 chore: bump graphiql dependencies 2023-03-09 10:41:46 +01:00
Szilárd Dóró
ca50c5ce0c Merge remote-tracking branch 'origin/main' into renovate/graphiql-react-0.x 2023-03-09 10:25:37 +01:00
Szilárd Dóró
a3271ed014 Merge pull request #1719 from nhost/changeset-release/main
chore: update versions
2023-03-09 10:14:06 +01:00
github-actions[bot]
d4fc99a77c chore: update versions 2023-03-09 08:20:32 +00:00
Szilárd Dóró
d90fcf3c24 Merge pull request #1713 from nhost/chore/mimir-cleanup
chore(dashboard): mimir migration cleanup
2023-03-09 09:19:06 +01:00
Szilárd Dóró
ee70b226fc Merge pull request #1716 from nhost/changeset-release/main
chore: update versions
2023-03-09 09:18:45 +01:00
github-actions[bot]
227ef968e6 chore: update versions 2023-03-08 09:26:55 +00:00
Szilárd Dóró
430b37b2e1 Merge pull request #1711 from nhost/fix/responsive-fixes
fix(dashboard): improve mobile responsive layout
2023-03-08 10:25:18 +01:00
Szilárd Dóró
124620c33e Merge pull request #1467 from nhost/fix/local-urls
feat: add support for custom local subdomains
2023-03-08 09:49:32 +01:00
Szilárd Dóró
ce3ece1ad7 Merge pull request #1714 from nhost/changeset-release/main
chore: update versions
2023-03-08 09:21:29 +01:00
github-actions[bot]
c81002622c chore: update versions 2023-03-07 16:27:40 +00:00
Szilárd Dóró
35fa6bb043 Merge pull request #1712 from nhost/fix/functions
fix(nhost-js): correct return type in functions
2023-03-07 17:24:07 +01:00
Siarhei Lipchyk
a4469a5942 Add default values for NEXT_PUBLIC_NHOST_* envs to make it work with current stable CLI version 2023-03-07 15:23:12 +01:00
Szilárd Dóró
b8f11a13d7 fix: add missing type 2023-03-07 15:09:35 +01:00
Szilárd Dóró
1d1555593f fix: correct return type in functions 2023-03-07 15:03:28 +01:00
Szilárd Dóró
001b3dccec chore: update codegen 2023-03-07 14:50:26 +01:00
Szilárd Dóró
6755dfb17b fix: improve line heights 2023-03-07 13:24:28 +01:00
Szilárd Dóró
2ac90dfdec chore: add changeset 2023-03-07 13:22:08 +01:00
Szilárd Dóró
093f3906a4 fix: additional responsive fixes 2023-03-07 13:21:26 +01:00
Szilárd Dóró
6fb81a27ba fix: additional responsive fixes 2023-03-07 13:07:51 +01:00
Szilárd Dóró
9be41bf594 fix: fixes for responsive issues 2023-03-07 12:58:51 +01:00
Szilárd Dóró
cbb1fc5bc8 chore: cleanup GraphQL operations 2023-03-07 11:23:55 +01:00
renovate[bot]
0ec3abf47c fix(deps): update dependency @graphiql/react to ^0.17.0 2023-03-03 00:19:25 +00:00
Johan Eliasson
ae19105302 cleanup 2023-03-02 21:32:34 +01:00
Johan Eliasson
730a482598 optimization 2023-03-02 21:25:43 +01:00
Szilárd Dóró
b00d261916 fix: update error message 2023-03-02 14:39:08 +01:00
Szilárd Dóró
6e05ab4628 Merge remote-tracking branch 'origin/main' into fix/local-urls 2023-03-02 14:18:10 +01:00
Szilárd Dóró
3141ce5b68 Merge branch 'main' into fix/local-urls 2023-03-01 16:10:07 +01:00
Johan Eliasson
253dd235ca added changeset 2023-03-01 09:43:00 +01:00
Johan Eliasson
991e8f2d15 removed unused code 2023-02-28 19:57:51 +01:00
Johan Eliasson
e500e87022 review fixes 2023-02-28 19:15:25 +01:00
Johan Eliasson
c684d0307b Update dashboard/src/utils/CONSTANTS.ts
Co-authored-by: Szilárd Dóró <doroszilard@icloud.com>
2023-02-28 16:59:35 +01:00
Johan Eliasson
2d657b9c29 styled 2023-02-28 13:42:22 +01:00
Johan Eliasson
f46d96bafc query fix 2023-02-27 17:33:26 +01:00
Szilárd Dóró
6b8acd35bd fix(nhost-js): fix tests 2023-02-27 14:23:37 +01:00
Szilárd Dóró
44ff6a059f Merge remote-tracking branch 'origin/main' into fix/local-urls 2023-02-27 13:50:34 +01:00
Johan Eliasson
8261743bd3 show warning if max free projects has been created by the user already 2023-02-27 10:44:52 +01:00
Johan Eliasson
34cf1d79a0 readability 2023-02-26 15:01:07 +01:00
Johan Eliasson
9d4542b3db revert back 2023-02-26 14:51:14 +01:00
Johan Eliasson
bb5dbdf5a3 small cleanup 2023-02-26 14:49:44 +01:00
Johan Eliasson
2801b03bf4 removed unused code 2023-02-26 09:57:46 +01:00
Johan Eliasson
8298d458d5 cleanup 2023-02-26 09:56:58 +01:00
Johan Eliasson
6e9b941b89 handle slug server side 2023-02-26 09:54:00 +01:00
Johan Eliasson
5dd25941e5 update 2023-02-26 09:25:40 +01:00
Szilárd Dóró
e88684ff2a Merge branch 'main' into fix/local-urls 2023-02-24 15:41:03 +01:00
Szilárd Dóró
cfcb97b8ee chore(actions): update workflow 2023-02-22 11:04:59 +01:00
Szilárd Dóró
892ad66ba1 Merge remote-tracking branch 'origin/main' into fix/local-urls 2023-02-21 19:08:20 +01:00
Szilárd Dóró
a1ffad77eb chore(dashboard): move sign in to global setup
- add test skeletons for the Overview
2023-02-20 17:19:46 +01:00
Szilárd Dóró
de4d59da99 feat(dashboard): add Playwright to the dashboard 2023-02-20 15:44:45 +01:00
Szilárd Dóró
982059e18e fix(dashboard): fix build error 2023-02-20 09:53:53 +01:00
Szilárd Dóró
02c0586467 Merge remote-tracking branch 'origin/main' into fix/local-urls 2023-02-20 09:37:51 +01:00
Szilárd Dóró
0753e6529c fix(nhost-js): update service URLs 2023-02-14 15:17:07 +01:00
Siarhei Lipchyk
e87a14a3fe Don't append "/console" to value from NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL 2023-02-14 11:20:33 +01:00
Szilárd Dóró
168616df38 Merge branch 'main' into fix/local-urls 2023-02-06 17:50:37 +01:00
Szilárd Dóró
d8c45b452d Merge remote-tracking branch 'origin/main' into fix/local-urls 2023-01-31 09:22:40 +01:00
Siarhei Lipchyk
adeb2a6d90 Adjust docker-entrypoint.sh for dashboard 2023-01-25 12:47:23 +01:00
Szilárd Dóró
921243e4d9 fix(dashboard): intercept metadata query in tests 2023-01-25 12:37:40 +01:00
Szilárd Dóró
1c5178f5fb chore(dashboard): _SCHEMA_API -> _API 2023-01-25 12:31:14 +01:00
Szilárd Dóró
72ad9aa8ee Merge branch 'main' into fix/local-urls 2023-01-23 10:39:56 +01:00
Szilárd Dóró
1b45db8caf chore(dashboard): revert users page changes
These will be fixed in a separate PR
2023-01-23 09:35:57 +01:00
Szilárd Dóró
9ffb4d0295 fix(dashboard): use fallbacks for services 2023-01-19 08:51:05 +01:00
Szilárd Dóró
e56340b792 fix(dashboard): env vars in Dockerfile
`localhost` -> `local`
2023-01-19 08:33:23 +01:00
Szilárd Dóró
814c6d997a Merge branch 'main' into fix/local-urls 2023-01-19 08:20:04 +01:00
Szilárd Dóró
7d7a352c33 chore(dashboard): update README 2023-01-16 19:23:22 +01:00
Szilárd Dóró
53a704fc7d chore(nhost-js): add TODO comments 2023-01-16 19:20:37 +01:00
Szilárd Dóró
c23eddf33d chore(dashboard): update README, improve SDK 2023-01-16 19:15:46 +01:00
Szilárd Dóró
d4147f4713 chore(dashboard): cleanup tests, cleanup env vars 2023-01-16 18:22:20 +01:00
Szilárd Dóró
f375eaccf5 feat(dashboard): introduce service based env vars
fix `@nhost/nextjs` and `@nhost/react` constructors
2023-01-16 17:49:03 +01:00
Siarhei Lipchyk
47f79ba9f3 upd 2023-01-10 12:33:26 +01:00
Siarhei Lipchyk
2e010455cf Update docker-entrypoint.sh 2023-01-10 11:09:00 +01:00
Szilárd Dóró
7e63c822ec Update dashboard/README.md
Co-authored-by: Nuno Pato <nunopato@gmail.com>
2023-01-10 09:27:24 +01:00
Szilárd Dóró
276b7d48c3 fix(dashboard): fix typo 2023-01-09 17:44:05 +01:00
Szilárd Dóró
6925b0d510 Merge remote-tracking branch 'origin/main' into fix/local-urls 2023-01-09 17:33:47 +01:00
Szilárd Dóró
6ff306c4e4 fix(dashboard): correct changeset
changed patch bump to minor bump as this version introduces deprecations
2023-01-09 17:33:01 +01:00
Szilárd Dóró
aa440fefe6 fix(dashboard): fix Dockerfile variables 2023-01-09 17:32:07 +01:00
Szilárd Dóró
9fbafc6654 feat(dashboard): introduce new port for services 2023-01-09 17:29:51 +01:00
Szilárd Dóró
b086175045 fix(dashboard): prevent build error 2023-01-09 16:25:06 +01:00
Szilárd Dóró
36db12297b fix(dashboard): resolve linter error 2023-01-09 15:43:49 +01:00
Szilárd Dóró
e5885d9bad fix(dashboard): don't break Auth page in local mode 2023-01-09 15:43:12 +01:00
Szilárd Dóró
15c13f3bbe Merge remote-tracking branch 'origin/main' into fix/local-urls 2023-01-09 15:10:40 +01:00
Szilárd Dóró
8d47cafd86 fix(dashboard): use correct subdomain 2023-01-09 14:59:25 +01:00
Szilárd Dóró
408cb6d10c chore(dashboard): update README 2023-01-06 13:31:01 +01:00
Szilárd Dóró
4d882703f2 fix(dashboard): use localhost for Hasura services 2023-01-06 13:27:57 +01:00
Szilárd Dóró
437dacaa9e chore(nhost-js): refactor port default value 2023-01-04 19:00:58 +01:00
Szilárd Dóró
088584e79d feat: add support for custom local subdomains 2023-01-04 15:34:48 +01:00
222 changed files with 4565 additions and 5662 deletions

View File

@@ -23,9 +23,7 @@ runs:
- uses: actions/cache@v3
id: pnpm-cache
with:
path: |
${{ steps.pnpm-cache-dir.outputs.dir }}
~/.cache/Cypress
path: ${{ steps.pnpm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-node-
- name: Use Node.js 16

View File

@@ -19,6 +19,11 @@ env:
NEXT_PUBLIC_ENV: dev
NEXT_TELEMETRY_DISABLED: 1
NEXT_PUBLIC_NHOST_BACKEND_URL: http://localhost:1337
NHOST_TEST_DASHBOARD_URL: ${{ vars.NHOST_TEST_DASHBOARD_URL }}
NHOST_TEST_WORKSPACE_NAME: ${{ vars.NHOST_TEST_WORKSPACE_NAME }}
NHOST_TEST_PROJECT_NAME: ${{ vars.NHOST_TEST_PROJECT_NAME }}
NHOST_TEST_USER_EMAIL: ${{ secrets.NHOST_TEST_USER_EMAIL }}
NHOST_TEST_USER_PASSWORD: ${{ secrets.NHOST_TEST_USER_PASSWORD }}
jobs:
build:
@@ -60,47 +65,6 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
e2e:
name: 'e2e (${{ matrix.package.path }})'
needs: build
if: ${{ needs.build.outputs.matrix != '[]' && needs.build.outputs.matrix != '' }}
strategy:
# * Don't cancel other matrices when one fails
fail-fast: false
matrix:
package: ${{ fromJson(needs.build.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# * Install Node and dependencies. Package dependencies won't be downloaded again as they have been cached by the `build` job.
- name: Install Node and dependencies
uses: ./.github/actions/install-dependencies
with:
TURBO_TOKEN: ${{ env.TURBO_TOKEN }}
TURBO_TEAM: ${{ env.TURBO_TEAM }}
# * Install Nhost CLI if a `nhost/config.yaml` file is found
- name: Install Nhost CLI
if: hashFiles(format('{0}/nhost/config.yaml', matrix.package.path)) != ''
uses: ./.github/actions/nhost-cli
# * Run the `ci` script of the current package of the matrix. Dependencies build is cached by Turborepo
- name: Run e2e test
run: pnpm --filter="${{ matrix.package.name }}" run e2e
- id: file-name
if: ${{ failure() }}
name: Tranform package name into a valid file name
run: |
PACKAGE_FILE_NAME=$(echo "${{ matrix.package.name }}" | sed 's/@//g; s/\//-/g')
echo "fileName=$PACKAGE_FILE_NAME" >> $GITHUB_OUTPUT
# * Run this step only if the previous step failed, and some Cypress screenshots/videos exist
- name: Upload Cypress videos and screenshots
if: ${{ failure() && hashFiles(format('{0}/cypress/screenshots/**', matrix.package.path), format('{0}/cypress/videos/**', matrix.package.path)) != ''}}
uses: actions/upload-artifact@v3
with:
name: cypress-${{ steps.file-name.outputs.fileName }}
path: |
${{format('{0}/cypress/screenshots/**', matrix.package.path)}}
${{format('{0}/cypress/videos/**', matrix.package.path)}}
unit:
name: Unit tests
needs: build
@@ -141,3 +105,57 @@ jobs:
# * Run every `lint` script in the workspace . Dependencies build is cached by Turborepo
- name: Lint
run: pnpm run lint:all
e2e:
name: 'E2E (Package: ${{ matrix.package.path }})'
needs: build
if: ${{ needs.build.outputs.matrix != '[]' && needs.build.outputs.matrix != '' }}
strategy:
# * Don't cancel other matrices when one fails
fail-fast: false
matrix:
package: ${{ fromJson(needs.build.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# * Install Node and dependencies. Package dependencies won't be downloaded again as they have been cached by the `build` job.
- name: Install Node and dependencies
uses: ./.github/actions/install-dependencies
with:
TURBO_TOKEN: ${{ env.TURBO_TOKEN }}
TURBO_TEAM: ${{ env.TURBO_TEAM }}
# * Install Nhost CLI if a `nhost/config.yaml` file is found
- name: Install Nhost CLI
if: hashFiles(format('{0}/nhost/config.yaml', matrix.package.path)) != ''
uses: ./.github/actions/nhost-cli
- name: Fetch Dashboard Preview URL
id: fetch-dashboard-preview-url
uses: zentered/vercel-preview-url@v1.1.9
if: github.ref_name != 'main'
env:
VERCEL_TOKEN: ${{ secrets.DASHBOARD_VERCEL_DEPLOY_TOKEN }}
GITHUB_REF: ${{ github.ref_name }}
GITHUB_REPOSITORY: ${{ github.repository }}
with:
vercel_team_id: ${{ secrets.DASHBOARD_VERCEL_TEAM_ID }}
vercel_project_id: ${{ secrets.DASHBOARD_STAGING_VERCEL_PROJECT_ID }}
vercel_state: BUILDING,READY,INITIALIZING
- name: Set Dashboard Preview URL
if: steps.fetch-dashboard-preview-url.outputs.preview_url != ''
run: echo "NHOST_TEST_DASHBOARD_URL=https://${{ steps.fetch-dashboard-preview-url.outputs.preview_url }}" >> $GITHUB_ENV
# * Run the `ci` script of the current package of the matrix. Dependencies build is cached by Turborepo
- name: Run e2e tests
run: pnpm --filter="${{ matrix.package.name }}" run e2e
- id: file-name
if: ${{ failure() }}
name: Transform package name into a valid file name
run: |
PACKAGE_FILE_NAME=$(echo "${{ matrix.package.name }}" | sed 's/@//g; s/\//-/g')
echo "fileName=$PACKAGE_FILE_NAME" >> $GITHUB_OUTPUT
# * Run this step only if the previous step failed, and Playwright generated a report
- name: Upload Playwright Report
if: ${{ failure() && hashFiles(format('{0}/playwright-report/**', matrix.package.path)) != ''}}
uses: actions/upload-artifact@v3
with:
name: playwright-${{ steps.file-name.outputs.fileName }}
path: ${{format('{0}/playwright-report/**', matrix.package.path)}}

View File

@@ -9,6 +9,7 @@ env:
NEXT_PUBLIC_ENV: dev
NEXT_TELEMETRY_DISABLED: 1
NEXT_PUBLIC_NHOST_BACKEND_URL: http://localhost:1337
jobs:
build:
name: Build

View File

@@ -1,89 +0,0 @@
name: Renovate
on:
pull_request:
branches: [main]
types: [closed]
paths-ignore:
- 'assets/**'
- '**.md'
- 'LICENSE'
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: nhost
jobs:
renovate-changeset:
name: Add changeset
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'renovate/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
# * Install Node and dependencies. Package downloads will be cached for the next jobs.
- name: Install Node and dependencies
uses: ./.github/actions/install-dependencies
with:
TURBO_TOKEN: ${{ env.TURBO_TOKEN }}
TURBO_TEAM: ${{ env.TURBO_TEAM }}
BUILD: 'none'
- name: Determine bumps
id: bumps
run: |
LAST_NON_PR_SHA=$(git log --no-merges main origin/${{ github.head_ref }} --format=format:%h -- | head -2 | tail -1)
echo "result<<EOF" >> $GITHUB_OUTPUT
pnpm recursive list --depth -1 --parseable \
--filter='!nhost-root' \
--filter=[$LAST_NON_PR_SHA] \
| xargs -I@ jq ".name" @/package.json \
| sort \
| uniq -u \
| awk '$0=$0": patch"' \
>> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Install dictionary
if: steps.bumps.outputs.result != ''
run: sudo apt-get install wbritish
- name: Generate changeset file name
id: file_name
if: steps.bumps.outputs.result != ''
run: |
FILE_NAME=$(shuf -n 3 /usr/share/dict/words | tr '\n' '-' | sed 's/-$//' | sed 's/'"'"'s//g' | tr '[:upper:]' '[:lower:]')
echo "result=./.changeset/${FILE_NAME}.md" >> $GITHUB_OUTPUT
- name: Create changeset file
if: steps.bumps.outputs.result != ''
run: |
cat <<EOF > ${{ steps.file_name.outputs.result }}
---
${{ steps.bumps.outputs.result }}
---
${{ github.event.pull_request.title }}
EOF
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GH_PAT }}
commit-message: ${{ github.event.pull_request.title }}
branch: renovate-changesets
delete-branch: true
title: 'chore: create changesest from Renovate bumps'
labels: |
dependencies
body: |
This PR creates the changesets from the Renovate dependencies that have been merged to main.
- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.GH_PAT }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
- name: Auto approve
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: juliangruber/approve-pull-request-action@v2
with:
github-token: ${{ secrets.GH_PAT }}
number: ${{ steps.cpr.outputs.pull-request-number }}

View File

@@ -23,8 +23,8 @@ module.exports = {
'e2e/**/*.ts',
'e2e/**/*.d.ts'
],
plugins: ['@typescript-eslint', 'cypress'],
extends: ['plugin:cypress/recommended'],
plugins: ['@typescript-eslint'],
extends: [],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module'

View File

@@ -1,8 +1,17 @@
# General Environment Variables
NEXT_PUBLIC_ENV=dev
NEXT_PUBLIC_NHOST_HASURA_URL=http://localhost:9695
NEXT_PUBLIC_NHOST_MIGRATIONS_URL=http://localhost:9693
NEXT_PUBLIC_NHOST_BACKEND_URL=http://localhost:1337
NEXT_PUBLIC_NHOST_PLATFORM=false
# Environment Variables for Self Hosting and Local Development
NEXT_PUBLIC_NHOST_AUTH_URL=https://local.auth.nhost.run/v1
NEXT_PUBLIC_NHOST_FUNCTIONS_URL=https://local.functions.nhost.run/v1
NEXT_PUBLIC_NHOST_GRAPHQL_URL=https://local.graphql.nhost.run/v1
NEXT_PUBLIC_NHOST_STORAGE_URL=https://local.storage.nhost.run/v1
NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL=https://local.hasura.nhost.run
NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL=https://local.hasura.nhost.run/v1/migrations
NEXT_PUBLIC_NHOST_HASURA_API_URL=https://local.hasura.nhost.run
# Environment Variables when running the Nhost Dashboard against the Nhost Backend
NEXT_PUBLIC_STRIPE_PK=<nhost_stripe_public_key>
NEXT_PUBLIC_GITHUB_APP_INSTALL_URL=<github_app_install_url>
NEXT_PUBLIC_ANALYTICS_WRITE_KEY=<analytics_write_key>

View File

@@ -49,4 +49,8 @@ tailwind.json
.idea
# Do not ignore Logs page
!src/**/logs*
!src/**/logs*
/test-results/
/playwright-report/
/playwright/.cache/
storageState.json

View File

@@ -51,7 +51,7 @@ export const decorators = [
(Story) => (
<NhostApolloProvider
fetchPolicy="cache-first"
graphqlUrl="http://localhost:1337/v1/graphql"
graphqlUrl="https://local.graphql.nhost.run/v1"
>
<Story />
</NhostApolloProvider>

View File

@@ -1,5 +1,98 @@
# @nhost/dashboard
## 0.13.10
### Patch Changes
- e93b06ab: fix(dashboard): remove left margin from workspace list on mobile
- 1c4806bf: chore(deps): bump `sharp` to 0.32.0
- @nhost/react-apollo@5.0.14
- @nhost/nextjs@1.13.18
## 0.13.9
### Patch Changes
- 912ed76c: chore(dashboard): bump `@apollo/client` to 3.7.10
- Updated dependencies [912ed76c]
- @nhost/react-apollo@5.0.13
## 0.13.8
### Patch Changes
- 7c127372: chore(dashboard): bump `react-error-boundary` to v4
## 0.13.7
### Patch Changes
- 9130ab12: chore(dashboard): bump `yup` to v1 and `@hookform/resolvers` to v3
## 0.13.6
### Patch Changes
- 253dd235: using new mutation to create projects + refactor Create Project page.
## 0.13.5
### Patch Changes
- @nhost/react-apollo@5.0.12
- @nhost/nextjs@1.13.17
## 0.13.4
### Patch Changes
- b48bc034: fix(dashboard): disable new users
- 798e591b: fix(dashboard): show correct date in data grid
## 0.13.3
### Patch Changes
- bfb4c1a6: chore(dashboard): remove `useAxios` property
- d8d8394b: Dashboard: allow to override hasura admin secret in docker
- Updated dependencies [ce1ee40d]
- @nhost/nextjs@1.13.16
- @nhost/react-apollo@5.0.11
## 0.13.2
### Patch Changes
- beed2eba: Fix docker entrypoint for dashboard
- 2c8559a3: fix(dashboard): refresh project list after deleting a project
- 4329d048: chore(dashboard): bump `graphiql` dependencies
## 0.13.1
### Patch Changes
- cbb1fc5b: chore(dashboard): cleanup GraphQL operations
## 0.13.0
### Minor Changes
- 088584e7: feat(dashboard): add support for custom local subdomains
### Patch Changes
- 2ac90dfd: fix(dashboard): improve mobile responsive layout
- Updated dependencies [f375eacc]
- @nhost/nextjs@1.13.15
- @nhost/react-apollo@5.0.10
## 0.12.4
### Patch Changes
- @nhost/react-apollo@5.0.9
- @nhost/nextjs@1.13.14
## 0.12.3
### Patch Changes

View File

@@ -19,10 +19,15 @@ ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_PUBLIC_ENV dev
ENV NEXT_PUBLIC_NHOST_PLATFORM false
# placeholders for ports, will be replaced on runtime by entrypoint script
ENV NEXT_PUBLIC_NHOST_MIGRATIONS_PORT __NEXT_PUBLIC_NHOST_MIGRATIONS_PORT__
ENV NEXT_PUBLIC_NHOST_HASURA_PORT __NEXT_PUBLIC_NHOST_HASURA_PORT__
ENV NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT __NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT__
# placeholders for URLs, will be replaced on runtime by entrypoint script
ENV NEXT_PUBLIC_NHOST_ADMIN_SECRET __NEXT_PUBLIC_NHOST_ADMIN_SECRET__
ENV NEXT_PUBLIC_NHOST_AUTH_URL __NEXT_PUBLIC_NHOST_AUTH_URL__
ENV NEXT_PUBLIC_NHOST_FUNCTIONS_URL __NEXT_PUBLIC_NHOST_FUNCTIONS_URL__
ENV NEXT_PUBLIC_NHOST_GRAPHQL_URL __NEXT_PUBLIC_NHOST_GRAPHQL_URL__
ENV NEXT_PUBLIC_NHOST_STORAGE_URL __NEXT_PUBLIC_NHOST_STORAGE_URL__
ENV NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL __NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL__
ENV NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL __NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL__
ENV NEXT_PUBLIC_NHOST_HASURA_API_URL __NEXT_PUBLIC_NHOST_HASURA_API_URL__
RUN yarn global add pnpm@7.17.0
COPY .gitignore .gitignore

View File

@@ -35,8 +35,17 @@ You can connect the Nhost Dashboard to your locally running backend by setting t
```bash
NEXT_PUBLIC_ENV=dev
NEXT_PUBLIC_NHOST_PLATFORM=false
NEXT_PUBLIC_NHOST_AUTH_URL=https://local.auth.nhost.run/v1
NEXT_PUBLIC_NHOST_FUNCTIONS_URL=https://local.functions.nhost.run/v1
NEXT_PUBLIC_NHOST_GRAPHQL_URL=https://local.graphql.nhost.run/v1
NEXT_PUBLIC_NHOST_STORAGE_URL=https://local.storage.nhost.run/v1
NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL=https://local.hasura.nhost.run
NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL=https://local.hasura.nhost.run/v1/migrations
NEXT_PUBLIC_NHOST_HASURA_API_URL=https://local.hasura.nhost.run
```
This will connect the Nhost Dashboard to your locally running Nhost backend.
### Storybook
Components are documented using [Storybook](https://storybook.js.org/). To run Storybook, run the following command:
@@ -45,23 +54,39 @@ Components are documented using [Storybook](https://storybook.js.org/). To run S
pnpm storybook
```
### Full list of environment variables
### General Environment Variables
| Name | Description |
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_PUBLIC_ENV` | `dev`, `staging` or `prod`. Should be set to `dev` in most cases. |
| `NEXT_PUBLIC_NHOST_PLATFORM` | This should be set to `false` to connect the Nhost Dashboard to a locally running Nhost backend. Setting this to `true` turns off local development. |
| `NEXT_PUBLIC_NHOST_LOCAL_MIGRATIONS_PORT` | Custom port that was passed to the CLI. Used only if local development is enabled. Default: `9693` |
| `NEXT_PUBLIC_NHOST_LOCAL_HASURA_PORT` | Custom port that was passed to the CLI. Used only if local development is enabled and `NEXT_PUBLIC_ENV` is `dev`. Default: `9695` |
| `NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT` | Custom port that was passed to the CLI. Used only if local development is enabled. Default: `1337` |
| `NEXT_PUBLIC_NHOST_BACKEND_URL` | Backend URL. Not necessary for local development. |
| `NEXT_PUBLIC_STRIPE_PK` | Stripe public key. Not necessary for local development. |
| `NEXT_PUBLIC_GITHUB_APP_INSTALL_URL` | URL of the GitHub application. Not necessary for local development. |
| `NEXT_PUBLIC_ANALYTICS_WRITE_KEY` | Analytics key. Not necessary for local development. |
| `NEXT_PUBLIC_NHOST_BRAGI_WEBSOCKET` | URL of the Bragi websocket. Not necessary for local development. |
| `NEXT_PUBLIC_MAINTENANCE_ACTIVE` | Determines whether or not maintenance mode is active. |
| `NEXT_PUBLIC_MAINTENANCE_END_DATE` | Date when maintenance mode will end. |
| `NEXT_PUBLIC_MAINTENANCE_UNLOCK_SECRET` | Secret that can be used to bypass maintenance mode. |
| Name | Description |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_PUBLIC_ENV` | `dev`, `staging` or `prod`. This should be set to `dev` in most cases. |
| `NEXT_PUBLIC_NHOST_ADMIN_SECRET` | Admin secret for Hasura. Default: `nhost-admin-secret` |
| `NEXT_PUBLIC_NHOST_PLATFORM` | This should be set to `false` to connect the Nhost Dashboard to a locally running or a self-hosted Nhost backend. Setting this to `true` will connect the Nhost Dashboard to the cloud environment. Default: `false` |
### Environment Variables for Local Development and Self-Hosting
| Name | Description |
| ---- | ----------- |
| `NEXT_PUBLIC_NHOST_AUTH_URL` | The URL of the Auth service. When working locally, point it to the Auth service started by the CLI. When self-hosting, point it to the self-hosted Auth service. |
| `NEXT_PUBLIC_NHOST_FUNCTIONS_URL` | The URL of the Functions service. When working locally, point it to the Functions service started by the CLI. When self-hosting, point it to the self-hosted Functions service. |
| `NEXT_PUBLIC_NHOST_GRAPHQL_URL` | The URL of the GraphQL service. When working locally, point it to the GraphQL service started by the CLI. When self-hosting, point it to the self-hosted GraphQL service. |
| `NEXT_PUBLIC_NHOST_STORAGE_URL` | The URL of the Storage service. When working locally, point it to the Storage service started by the CLI. When self-hosting, point it to the self-hosted Storage service. |
| `NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL` | The URL of the Hasura Console. When working locally, point it to the Hasura Console started by the CLI. When self-hosting, point it to the self-hosted Hasura Console. |
| `NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL` | The URL of Hasura's Migrations service. When working locally, point it to the Migrations service started by the CLI. |
| `NEXT_PUBLIC_NHOST_HASURA_API_URL` | The URL of Hasura's Schema and Metadata API. When working locally, point it to the Schema and Metadata API started by the CLI. When self-hosting, point it to the self-hosted Schema and Metadata API. |
### Other Environment Variables
| Name | Description |
| --------------------------------------- | ------------------------------------------------------------------------------------------- |
| `NEXT_PUBLIC_NHOST_BACKEND_URL` | Backend URL. This is only used if `NEXT_PUBLIC_NHOST_PLATFORM` is `true`. |
| `NEXT_PUBLIC_STRIPE_PK` | Stripe public key. This is only used if `NEXT_PUBLIC_NHOST_PLATFORM` is `true`. |
| `NEXT_PUBLIC_GITHUB_APP_INSTALL_URL` | URL of the GitHub application. This is only used if `NEXT_PUBLIC_NHOST_PLATFORM` is `true`. |
| `NEXT_PUBLIC_ANALYTICS_WRITE_KEY` | Analytics key. This is only used if `NEXT_PUBLIC_NHOST_PLATFORM` is `true`. |
| `NEXT_PUBLIC_NHOST_BRAGI_WEBSOCKET` | URL of the Bragi websocket. This is only used if `NEXT_PUBLIC_NHOST_PLATFORM` is `true`. |
| `NEXT_PUBLIC_MAINTENANCE_ACTIVE` | Determines whether or not maintenance mode is active. |
| `NEXT_PUBLIC_MAINTENANCE_END_DATE` | Date when maintenance mode will end. |
| `NEXT_PUBLIC_MAINTENANCE_UNLOCK_SECRET` | Secret that can be used to bypass maintenance mode. |
## ESLint Rules
@@ -86,3 +111,21 @@ pnpm storybook
| `@typescript-eslint/consistent-type-imports` | Enforces `import type { Type } from 'module'` syntax. It prevents false positive circular dependency errors. |
| `@typescript-eslint/naming-convention` | Enforces a consistent naming convention. |
| `no-restricted-imports` | Enforces absolute imports and consistent import paths for components from `src/components/ui` folder. |
### End-to-End Tests
End-to-end tests are written using [Playwright](https://playwright.dev/). To run the tests, run the following command:
```bash
pnpm e2e
```
Most of the tests require access to the Nhost test user. To run these tests, you need to set the following environment variables in `.env.test`:
```
NHOST_TEST_DASHBOARD_URL=<test_dashboard_url>
NHOST_TEST_USER_EMAIL=<test_user_email>
NHOST_TEST_USER_PASSWORD=<test_user_password>
NHOST_TEST_WORKSPACE_NAME=<test_workspace_name>
NHOST_TEST_PROJECT_NAME=<test_project_name>
```

View File

@@ -1,15 +1,25 @@
#!/bin/sh
set -e
set -euo pipefail
# read ports from env variables or use defaults
NEXT_PUBLIC_NHOST_MIGRATIONS_PORT="${NEXT_PUBLIC_NHOST_MIGRATIONS_PORT:=9693}"
NEXT_PUBLIC_NHOST_HASURA_PORT="${NEXT_PUBLIC_NHOST_HASURA_PORT:=9695}"
NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT="${NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT:=1337}"
# read URLs from env variables (with defaults)
NEXT_PUBLIC_NHOST_ADMIN_SECRET="${NEXT_PUBLIC_NHOST_ADMIN_SECRET:-nhost-admin-secret}"
NEXT_PUBLIC_NHOST_AUTH_URL="${NEXT_PUBLIC_NHOST_AUTH_URL:-http://localhost:1337/v1/auth}"
NEXT_PUBLIC_NHOST_FUNCTIONS_URL="${NEXT_PUBLIC_NHOST_FUNCTIONS_URL:-http://localhost:1337/v1/functions}"
NEXT_PUBLIC_NHOST_GRAPHQL_URL="${NEXT_PUBLIC_NHOST_GRAPHQL_URL:-http://localhost:1337/v1/graphql}"
NEXT_PUBLIC_NHOST_STORAGE_URL="${NEXT_PUBLIC_NHOST_STORAGE_URL:-http://localhost:1337/v1/storage}"
NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL="${NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL:-http://localhost:9695}"
NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL="${NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL:-http://localhost:9693}"
NEXT_PUBLIC_NHOST_HASURA_API_URL="${NEXT_PUBLIC_NHOST_HASURA_API_URL:-http://localhost:8080}"
# replace placeholders
find dashboard -type f -exec sed -i "s/__NEXT_PUBLIC_NHOST_MIGRATIONS_PORT__/${NEXT_PUBLIC_NHOST_MIGRATIONS_PORT}/g" {} +
find dashboard -type f -exec sed -i "s/__NEXT_PUBLIC_NHOST_HASURA_PORT__/${NEXT_PUBLIC_NHOST_HASURA_PORT}/g" {} +
find dashboard -type f -exec sed -i "s/__NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT__/${NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT}/g" {} +
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_ADMIN_SECRET__~${NEXT_PUBLIC_NHOST_ADMIN_SECRET}~g" {} +
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_AUTH_URL__~${NEXT_PUBLIC_NHOST_AUTH_URL}~g" {} +
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_FUNCTIONS_URL__~${NEXT_PUBLIC_NHOST_FUNCTIONS_URL}~g" {} +
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_GRAPHQL_URL__~${NEXT_PUBLIC_NHOST_GRAPHQL_URL}~g" {} +
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_STORAGE_URL__~${NEXT_PUBLIC_NHOST_STORAGE_URL}~g" {} +
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL__~${NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL}~g" {} +
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL__~${NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL}~g" {} +
find dashboard -type f -exec sed -i "s~__NEXT_PUBLIC_NHOST_HASURA_API_URL__~${NEXT_PUBLIC_NHOST_HASURA_API_URL}~g" {} +
exec "$@"

View File

@@ -0,0 +1,93 @@
import {
TEST_PROJECT_NAME,
TEST_PROJECT_SLUG,
TEST_WORKSPACE_SLUG,
} from '@/e2e/env';
import { openProject } from '@/e2e/utils';
import type { Page } from '@playwright/test';
import { expect, test } from '@playwright/test';
let page: Page;
test.describe.configure({ mode: 'serial' });
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
await page.goto('/');
await openProject({
page,
projectName: TEST_PROJECT_NAME,
workspaceSlug: TEST_WORKSPACE_SLUG,
projectSlug: TEST_PROJECT_SLUG,
});
await page
.getByRole('navigation', { name: /main navigation/i })
.getByRole('link', { name: /auth/i })
.click();
await page.waitForURL(`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/users`);
});
test.afterAll(async () => {
await page.close();
});
test('should create a user', async () => {
await expect(
page.getByRole('heading', { name: /there are no users yet/i }),
).toBeVisible();
await page
.getByRole('button', { name: /create user/i })
.first()
.click();
await expect(page.getByRole('dialog')).toBeVisible();
await expect(
page.getByRole('heading', { name: /create user/i }),
).toBeVisible();
await page
.getByRole('textbox', { name: /email/i })
.fill('testuser@example.com');
await page.getByRole('textbox', { name: /password/i }).fill('test.password');
await page.getByRole('button', { name: /create/i, exact: true }).click();
await expect(page.getByRole('dialog')).not.toBeVisible();
await expect(
page.getByRole('button', { name: /view testuser@example.com/i }),
).toBeVisible();
});
test('should delete a user', async () => {
await expect(
page.getByRole('button', { name: /view testuser@example.com/i }),
).toBeVisible();
await page
.getByRole('button', { name: /more options for testuser@example.com/i })
.click();
await page.getByRole('menuitem', { name: /delete user/i }).click();
await expect(page.getByRole('dialog')).toBeVisible();
await expect(
page.getByRole('heading', { name: /delete user/i }),
).toBeVisible();
await expect(
page.getByText(
/are you sure you want to delete the "testuser@example.com" user?/i,
),
).toBeVisible();
await page.getByRole('button', { name: /delete/i, exact: true }).click();
await expect(page.getByRole('dialog')).not.toBeVisible();
await expect(
page.getByRole('heading', { name: /there are no users yet/i }),
).toBeVisible();
});

View File

@@ -0,0 +1,276 @@
import {
TEST_PROJECT_NAME,
TEST_PROJECT_SLUG,
TEST_WORKSPACE_SLUG,
} from '@/e2e/env';
import { openProject, prepareTable } from '@/e2e/utils';
import { faker } from '@faker-js/faker';
import type { Page } from '@playwright/test';
import { expect, test } from '@playwright/test';
let page: Page;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
await page.goto('/');
await openProject({
page,
projectName: TEST_PROJECT_NAME,
workspaceSlug: TEST_WORKSPACE_SLUG,
projectSlug: TEST_PROJECT_SLUG,
});
await page
.getByRole('navigation', { name: /main navigation/i })
.getByRole('link', { name: /database/i })
.click();
});
test.afterAll(async () => {
await page.close();
});
test('should create a simple table', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const tableName = faker.random.word().toLowerCase();
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text' },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
await expect(
page.getByRole('link', { name: tableName, exact: true }),
).toBeVisible();
});
test('should create a table with unique constraints', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const tableName = faker.random.word().toLowerCase();
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text', unique: true },
{ name: 'isbn', type: 'text', unique: true },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
await expect(
page.getByRole('link', { name: tableName, exact: true }),
).toBeVisible();
});
test('should create a table with nullable columns', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const tableName = faker.random.word().toLowerCase();
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text', nullable: true },
{ name: 'description', type: 'text', nullable: true },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
await expect(
page.getByRole('link', { name: tableName, exact: true }),
).toBeVisible();
});
test('should create a table with an identity column', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const tableName = faker.random.word().toLowerCase();
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'int4' },
{ name: 'title', type: 'text', nullable: true },
{ name: 'description', type: 'text', nullable: true },
],
});
await page.getByRole('button', { name: /identity/i }).click();
await page.getByRole('option', { name: /id/i }).click();
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
await expect(
page.getByRole('link', { name: tableName, exact: true }),
).toBeVisible();
});
test('should create table with foreign key constraint', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const firstTableName = faker.random.word().toLowerCase();
await prepareTable({
page,
name: firstTableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'name', type: 'text' },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${firstTableName}`,
);
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const secondTableName = faker.random.word().toLowerCase();
await prepareTable({
page,
name: secondTableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text' },
{ name: 'author_id', type: 'uuid' },
],
});
await page.getByRole('button', { name: /add foreign key/i }).click();
// select column in current table
await page
.getByRole('button', { name: /column/i })
.first()
.click();
await page.getByRole('option', { name: /author_id/i }).click();
// select reference schema
await page.getByRole('button', { name: /schema/i }).click();
await page.getByRole('option', { name: /public/i }).click();
// select reference table
await page.getByRole('button', { name: /table/i }).click();
await page.getByRole('option', { name: firstTableName, exact: true }).click();
// select reference column
await page
.getByRole('button', { name: /column/i })
.nth(1)
.click();
await page.getByRole('option', { name: /id/i }).click();
await page.getByRole('button', { name: /add/i }).click();
await expect(
page.getByText(`public.${firstTableName}.id`, { exact: true }),
).toBeVisible();
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${secondTableName}`,
);
await expect(
page.getByRole('link', { name: secondTableName, exact: true }),
).toBeVisible();
});
test('should not be able to create a table with a name that already exists', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const tableName = faker.random.word().toLowerCase();
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'name', type: 'text' },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text' },
{ name: 'author_id', type: 'uuid' },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await expect(
page.getByText(/error: a table with this name already exists/i),
).toBeVisible();
});

View File

@@ -0,0 +1,191 @@
import {
TEST_PROJECT_NAME,
TEST_PROJECT_SLUG,
TEST_WORKSPACE_SLUG,
} from '@/e2e/env';
import { openProject, prepareTable } from '@/e2e/utils';
import { faker } from '@faker-js/faker';
import type { Page } from '@playwright/test';
import { expect, test } from '@playwright/test';
let page: Page;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
await page.goto('/');
await openProject({
page,
projectName: TEST_PROJECT_NAME,
workspaceSlug: TEST_WORKSPACE_SLUG,
projectSlug: TEST_PROJECT_SLUG,
});
await page
.getByRole('navigation', { name: /main navigation/i })
.getByRole('link', { name: /database/i })
.click();
});
test.afterAll(async () => {
await page.close();
});
test('should delete a table', async () => {
const tableName = faker.random.word().toLowerCase();
await page.getByRole('button', { name: /new table/i }).click();
await prepareTable({
page,
name: tableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text' },
],
});
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
);
const tableLink = page.getByRole('link', {
name: tableName,
exact: true,
});
await tableLink.hover();
await page
.getByRole('listitem')
.filter({ hasText: tableName })
.getByRole('button')
.click();
await page.getByRole('menuitem', { name: /delete table/i }).click();
await expect(
page.getByRole('heading', { name: /delete table/i }),
).toBeVisible();
await page.getByRole('button', { name: /delete/i }).click();
// navigate to next URL
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/**`,
);
await expect(
page.getByRole('link', { name: tableName, exact: true }),
).not.toBeVisible();
});
test('should not be able to delete a table if other tables have foreign keys referencing it', async () => {
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const firstTableName = faker.random.word().toLowerCase();
await prepareTable({
page,
name: firstTableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'name', type: 'text' },
],
});
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${firstTableName}`,
);
await page.getByRole('button', { name: /new table/i }).click();
await expect(page.getByText(/create a new table/i)).toBeVisible();
const secondTableName = faker.random.word().toLowerCase();
await prepareTable({
page,
name: secondTableName,
primaryKey: 'id',
columns: [
{ name: 'id', type: 'uuid', defaultValue: 'gen_random_uuid()' },
{ name: 'title', type: 'text' },
{ name: 'author_id', type: 'uuid' },
],
});
await page.getByRole('button', { name: /add foreign key/i }).click();
// select column in current table
await page
.getByRole('button', { name: /column/i })
.first()
.click();
await page.getByRole('option', { name: /author_id/i }).click();
// select reference schema
await page.getByRole('button', { name: /schema/i }).click();
await page.getByRole('option', { name: /public/i }).click();
// select reference table
await page.getByRole('button', { name: /table/i }).click();
await page.getByRole('option', { name: firstTableName, exact: true }).click();
// select reference column
await page
.getByRole('button', { name: /column/i })
.nth(1)
.click();
await page.getByRole('option', { name: /id/i }).click();
await page.getByRole('button', { name: /add/i }).click();
await expect(
page.getByText(`public.${firstTableName}.id`, { exact: true }),
).toBeVisible();
// create table
await page.getByRole('button', { name: /create/i }).click();
await page.waitForURL(
`/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/database/browser/default/public/${secondTableName}`,
);
await expect(
page.getByRole('link', { name: secondTableName, exact: true }),
).toBeVisible();
// try to delete the first table that is referenced by the second table
const tableLink = page.getByRole('link', {
name: firstTableName,
exact: true,
});
await tableLink.hover();
await page
.getByRole('listitem')
.filter({ hasText: firstTableName })
.getByRole('button')
.click();
await page.getByRole('menuitem', { name: /delete table/i }).click();
await expect(
page.getByRole('heading', { name: /delete table/i }),
).toBeVisible();
await page.getByRole('button', { name: /delete/i }).click();
await expect(
page.getByText(
/constraint [a-zA-Z_]+ on table [a-zA-Z_]+ depends on table [a-zA-Z_]+/i,
),
).toBeVisible();
});

42
dashboard/e2e/env.ts Normal file
View File

@@ -0,0 +1,42 @@
import slugify from 'slugify';
/**
* URL of the dashboard to test against.
*/
export const TEST_DASHBOARD_URL = process.env.NHOST_TEST_DASHBOARD_URL;
/**
* Name of the workspace to test against.
*/
export const TEST_WORKSPACE_NAME = process.env.NHOST_TEST_WORKSPACE_NAME;
/**
* Slugified name of the workspace to test against.
*/
export const TEST_WORKSPACE_SLUG = slugify(TEST_WORKSPACE_NAME, {
lower: true,
strict: true,
});
/**
* Name of the project to test against.
*/
export const TEST_PROJECT_NAME = process.env.NHOST_TEST_PROJECT_NAME;
/**
* Slugified name of the project to test against.
*/
export const TEST_PROJECT_SLUG = slugify(TEST_PROJECT_NAME, {
lower: true,
strict: true,
});
/**
* Email of the test account to use.
*/
export const TEST_USER_EMAIL = process.env.NHOST_TEST_USER_EMAIL;
/**
* Password of the test account to use.
*/
export const TEST_USER_PASSWORD = process.env.NHOST_TEST_USER_PASSWORD;

View File

@@ -0,0 +1,109 @@
import {
TEST_PROJECT_NAME,
TEST_PROJECT_SLUG,
TEST_WORKSPACE_NAME,
TEST_WORKSPACE_SLUG,
} from '@/e2e/env';
import { openProject } from '@/e2e/utils';
import type { Page } from '@playwright/test';
import { expect, test } from '@playwright/test';
let page: Page;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
await page.goto('/');
await openProject({
page,
projectName: TEST_PROJECT_NAME,
workspaceSlug: TEST_WORKSPACE_SLUG,
projectSlug: TEST_PROJECT_SLUG,
});
});
test.afterAll(async () => {
await page.close();
});
test('should show a sidebar with menu items', async () => {
const navLocator = page.getByRole('navigation', { name: /main navigation/i });
await expect(navLocator).toBeVisible();
await expect(navLocator.getByRole('list').getByRole('listitem')).toHaveCount(
10,
);
await expect(
navLocator.getByRole('link', { name: /overview/i }),
).toBeVisible();
await expect(
navLocator.getByRole('link', { name: /database/i }),
).toBeVisible();
await expect(
navLocator.getByRole('link', { name: /graphql/i }),
).toBeVisible();
await expect(navLocator.getByRole('link', { name: /hasura/i })).toBeVisible();
await expect(navLocator.getByRole('link', { name: /auth/i })).toBeVisible();
await expect(
navLocator.getByRole('link', { name: /storage/i }),
).toBeVisible();
await expect(
navLocator.getByRole('link', { name: /deployments/i }),
).toBeVisible();
await expect(
navLocator.getByRole('link', { name: /backups/i }),
).toBeVisible();
await expect(navLocator.getByRole('link', { name: /logs/i })).toBeVisible();
await expect(
navLocator.getByRole('link', { name: /settings/i }),
).toBeVisible();
});
test('should show a header with a logo, the workspace name, and the project name', async () => {
await expect(
page.getByRole('banner').getByRole('link', { name: TEST_WORKSPACE_NAME }),
).toBeVisible();
await expect(
page.getByRole('banner').getByRole('link', { name: TEST_PROJECT_NAME }),
).toBeVisible();
});
test("should show the project's name, the Upgrade button and the Settings button", async () => {
await expect(
page.getByRole('heading', { name: TEST_PROJECT_NAME }),
).toBeVisible();
await expect(page.getByText(/free plan/i)).toBeVisible();
await expect(page.getByRole('button', { name: /upgrade/i })).toBeVisible();
await expect(
page.getByRole('main').getByRole('link', { name: /settings/i }),
).toBeVisible();
});
test("should show the project's region and subdomain", async () => {
await expect(page.locator('p:has-text("Region") + div p').nth(0)).toHaveText(
/frankfurt \(eu-central-1\)/i,
);
await expect(
page.locator('p:has-text("Subdomain") + div p').nth(0),
).toHaveText(/[a-z]{20}/i);
});
test('should not have a GitHub repository connected', async () => {
await expect(
page.getByRole('button', { name: /connect to github/i }),
).toBeVisible();
});
test('should show proper limits for the free project', async () => {
// Limit for Database
await expect(page.getByText(/of 500 MB/i)).toBeVisible();
// Limit for Storage
await expect(page.getByText(/of 1 GB/i)).toBeVisible();
// Limit for Users
await expect(page.getByText(/of 10000/i)).toBeVisible();
// Limit for Functions
await expect(page.getByText(/of 10$/i, { exact: true })).toBeVisible();
});

113
dashboard/e2e/utils.ts Normal file
View File

@@ -0,0 +1,113 @@
import type { Page } from '@playwright/test';
/**
* Open a project by navigating to the project's overview page.
*
* @param page - The Playwright page object.
* @param workspaceSlug - The slug of the workspace that contains the project.
* @param projectSlug - The slug of the project to open.
* @param projectName - The name of the project to open.
* @returns A promise that resolves when the project is opened.
*/
export async function openProject({
page,
projectName,
workspaceSlug,
projectSlug,
}: {
page: Page;
workspaceSlug: string;
projectSlug: string;
projectName: string;
}) {
await page.getByRole('link', { name: projectName }).click();
await page.waitForURL(`/${workspaceSlug}/${projectSlug}`);
}
/**
* Prepares a table by filling out the form.
*
* @param page - The Playwright page object.
* @param name - The name of the table to create.
* @param columns - The columns to create in the table.
* @returns A promise that resolves when the table is prepared.
*/
export async function prepareTable({
page,
name: tableName,
primaryKey,
columns,
}: {
page: Page;
name: string;
primaryKey: string;
columns: Array<{
name: string;
type: string;
nullable?: boolean;
unique?: boolean;
defaultValue?: string;
}>;
}) {
if (!columns.some(({ name }) => name === primaryKey)) {
throw new Error('Primary key must be one of the columns.');
}
await page.getByRole('textbox', { name: /name/i }).first().fill(tableName);
await Promise.all(
columns.map(
async (
{ name: columnName, type, nullable, unique, defaultValue },
index,
) => {
// set name
await page.getByPlaceholder(/name/i).nth(index).fill(columnName);
// set type
await page
.getByRole('combobox', { name: /type/i })
.nth(index)
.fill(type);
await page.getByRole('option', { name: type }).first().click();
// optionally set default value
if (defaultValue) {
await page
.getByRole('combobox', { name: /default value/i })
.first()
.fill(defaultValue);
await page
.getByRole('option', { name: defaultValue })
.first()
.click();
}
// optionally check unique
if (unique) {
await page
.getByRole('checkbox', { name: /unique/i })
.nth(index)
.check();
}
// optionally check nullable
if (nullable) {
await page
.getByRole('checkbox', { name: /nullable/i })
.nth(index)
.check();
}
// add new column if not last
if (index < columns.length - 1) {
await page.getByRole('button', { name: /add column/i }).click();
}
},
),
);
// select the first column as primary key
await page.getByRole('button', { name: /primary key/i }).click();
await page.getByRole('option', { name: primaryKey, exact: true }).click();
}

27
dashboard/global-setup.ts Normal file
View File

@@ -0,0 +1,27 @@
import { chromium } from '@playwright/test';
import {
TEST_DASHBOARD_URL,
TEST_USER_EMAIL,
TEST_USER_PASSWORD,
} from './e2e/env';
async function globalSetup() {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto(TEST_DASHBOARD_URL);
await page.waitForURL(`${TEST_DASHBOARD_URL}/signin`);
await page.getByRole('link', { name: /continue with email/i }).click();
await page.waitForURL(`${TEST_DASHBOARD_URL}/signin/email`);
await page.getByLabel('Email').fill(TEST_USER_EMAIL);
await page.getByLabel('Password').fill(TEST_USER_PASSWORD);
await page.getByRole('button', { name: /sign in/i }).click();
await page.waitForURL(TEST_DASHBOARD_URL);
await page.context().storageState({ path: 'storageState.json' });
await browser.close();
}
export default globalSetup;

View File

@@ -1,5 +1,5 @@
schema:
- http://localhost:1337/v1/graphql:
- https://local.graphql.nhost.run/v1:
headers:
x-hasura-admin-secret: nhost-admin-secret
generates:

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/dashboard",
"version": "0.12.3",
"version": "0.13.10",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
@@ -14,10 +14,11 @@
"nhost:dev": "nhost dev -d",
"format": "prettier --write \"src/**/*.{js,ts,tsx,jsx,json,md}\" --plugin-search-dir=.",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook"
"build-storybook": "build-storybook",
"e2e": "npx playwright@1.31.2 install --with-deps && playwright test"
},
"dependencies": {
"@apollo/client": "^3.7.3",
"@apollo/client": "^3.7.10",
"@codemirror/language": "^6.3.0",
"@emotion/cache": "^11.10.5",
"@emotion/react": "^11.10.5",
@@ -25,11 +26,11 @@
"@emotion/styled": "^11.10.5",
"@fontsource/inter": "^4.5.14",
"@fontsource/roboto-mono": "^4.5.8",
"@graphiql/react": "^0.15.0",
"@graphiql/toolkit": "^0.8.0",
"@graphiql/react": "^0.17.0",
"@graphiql/toolkit": "^0.8.2",
"@headlessui/react": "^1.6.5",
"@heroicons/react": "^1.0.6",
"@hookform/resolvers": "^2.9.10",
"@hookform/resolvers": "^3.0.0",
"@mui/base": "^5.0.0-alpha.106",
"@mui/material": "^5.10.14",
"@mui/system": "^5.10.14",
@@ -37,7 +38,7 @@
"@nhost/nextjs": "workspace:*",
"@nhost/react-apollo": "workspace:*",
"@segment/snippet": "^4.15.3",
"@stripe/react-stripe-js": "^1.10.0",
"@stripe/react-stripe-js": "^2.0.0",
"@stripe/stripe-js": "^1.35.0",
"@tailwindcss/forms": "^0.5.3",
"@tanstack/react-query": "^4.16.1",
@@ -48,7 +49,7 @@
"clsx": "^1.2.1",
"date-fns": "^2.29.3",
"generate-password": "^1.7.0",
"graphiql": "^2.2.0",
"graphiql": "^2.4.0",
"graphql": "^16.6.0",
"graphql-request": "^4.3.0",
"graphql-tag": "^2.12.6",
@@ -62,7 +63,7 @@
"prettysize": "^2.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-error-boundary": "^3.1.4",
"react-error-boundary": "^4.0.0",
"react-hook-form": "^7.42.1",
"react-hot-toast": "^2.4.0",
"react-is": "18.2.0",
@@ -70,23 +71,25 @@
"react-merge-refs": "^1.1.0",
"react-syntax-highlighter": "^15.4.5",
"react-table": "^7.8.0",
"sharp": "^0.31.2",
"sharp": "^0.32.0",
"slugify": "^1.6.5",
"stripe": "^10.17.0",
"tailwind-merge": "^1.8.0",
"utility-types": "^3.10.0",
"validator": "^13.7.0",
"yup": "^0.32.11",
"yup": "^1.0.2",
"yup-password": "^0.2.2"
},
"devDependencies": {
"@babel/core": "^7.20.2",
"@faker-js/faker": "^7.6.0",
"@graphql-codegen/cli": "^3.0.0",
"@graphql-codegen/typescript": "^3.0.0",
"@graphql-codegen/typescript-graphql-request": "^4.5.1",
"@graphql-codegen/typescript-operations": "^3.0.0",
"@graphql-codegen/typescript-react-apollo": "^3.3.1",
"@next/bundle-analyzer": "^12.3.1",
"@playwright/test": "^1.31.2",
"@storybook/addon-actions": "^6.5.14",
"@storybook/addon-essentials": "^6.5.14",
"@storybook/addon-interactions": "^6.5.14",
@@ -116,6 +119,7 @@
"babel-loader": "^8.3.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"csstype": "^3.0.10",
"dotenv": "^16.0.3",
"encoding": "^0.1.13",
"eslint": "^8.28.0",
"eslint-config-airbnb": "19.0.4",
@@ -161,4 +165,4 @@
"msw": {
"workerDirectory": "public"
}
}
}

View File

@@ -0,0 +1,32 @@
import { defineConfig, devices } from '@playwright/test';
import dotenv from 'dotenv';
import path from 'path';
dotenv.config({ path: path.resolve(__dirname, '.env.test') });
export default defineConfig({
testDir: './e2e',
timeout: 30 * 1000,
expect: {
timeout: 5000,
},
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
globalSetup: require.resolve('./global-setup'),
use: {
actionTimeout: 0,
trace: 'on-first-retry',
storageState: 'storageState.json',
baseURL: process.env.NHOST_TEST_DASHBOARD_URL,
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
});

View File

@@ -9,28 +9,39 @@ import Link from '@/ui/v2/Link';
import Text from '@/ui/v2/Text';
import { copy } from '@/utils/copy';
import { getApplicationStatusString } from '@/utils/helpers';
import { triggerToast } from '@/utils/toast';
import getServerError from '@/utils/settings/getServerError';
import { formatDistance } from 'date-fns';
import { useRouter } from 'next/router';
import { toast } from 'react-hot-toast';
export default function ApplicationInfo() {
const { currentApplication } = useCurrentWorkspaceAndApplication();
const [deleteApplication, { client }] = useDeleteApplicationMutation({
const [deleteApplication] = useDeleteApplicationMutation({
refetchQueries: [GetOneUserDocument],
});
const router = useRouter();
async function handleClickRemove() {
await deleteApplication({
variables: {
appId: currentApplication.id,
},
});
await router.push('/');
await client.refetchQueries({
include: ['getOneUser'],
});
triggerToast(`${currentApplication.name} deleted`);
try {
await toast.promise(
deleteApplication({
variables: {
appId: currentApplication.id,
},
}),
{
loading: 'Deleting project...',
success: 'The project has been deleted successfully.',
error: getServerError(
'An error occurred while deleting the project. Please try again.',
),
},
);
await router.push('/');
} catch {
// Note: The toast will handle the error.
}
}
return (

View File

@@ -3,54 +3,81 @@ import { ChangePlanModal } from '@/components/applications/ChangePlanModal';
import { StagingMetadata } from '@/components/applications/StagingMetadata';
import { useDialog } from '@/components/common/DialogProvider';
import Container from '@/components/layout/Container';
import { useUpdateApplicationMutation } from '@/generated/graphql';
import {
GetOneUserDocument,
useGetFreeAndActiveProjectsQuery,
useUnpauseApplicationMutation,
} from '@/generated/graphql';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import { ApplicationStatus } from '@/types/application';
import { Modal } from '@/ui';
import { Alert } from '@/ui/Alert';
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
import Box from '@/ui/v2/Box';
import Button from '@/ui/v2/Button';
import Text from '@/ui/v2/Text';
import { discordAnnounce } from '@/utils/discordAnnounce';
import { triggerToast } from '@/utils/toast';
import { updateOwnCache } from '@/utils/updateOwnCache';
import { MAX_FREE_PROJECTS } from '@/utils/CONSTANTS';
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
import type { ApolloError } from '@apollo/client';
import { useUserData } from '@nhost/nextjs';
import Image from 'next/image';
import { useState } from 'react';
import { toast } from 'react-hot-toast';
import { RemoveApplicationModal } from './RemoveApplicationModal';
export default function ApplicationPaused() {
const { openAlertDialog } = useDialog();
const { currentWorkspace, currentApplication } =
useCurrentWorkspaceAndApplication();
const [changingApplicationStateLoading, setChangingApplicationStateLoading] =
useState(false);
const [updateApplication, { client }] = useUpdateApplicationMutation();
const { id, email } = useUserData();
const { id } = useUserData();
const isOwner = currentWorkspace.members.some(
({ userId, type }) => userId === id && type === 'owner',
);
const isPro = currentApplication.plan.name === 'Pro';
const [showDeletingModal, setShowDeletingModal] = useState(false);
const [unpauseApplication, { loading: changingApplicationStateLoading }] =
useUnpauseApplicationMutation({
refetchQueries: [GetOneUserDocument],
});
const { data, loading } = useGetFreeAndActiveProjectsQuery({
variables: { userId: id },
fetchPolicy: 'cache-and-network',
});
const numberOfFreeAndLiveProjects = data?.freeAndActiveProjects.length || 0;
const wakeUpDisabled = numberOfFreeAndLiveProjects >= MAX_FREE_PROJECTS;
async function handleTriggerUnpausing() {
setChangingApplicationStateLoading(true);
try {
await updateApplication({
variables: {
appId: currentApplication.id,
app: {
desiredState: ApplicationStatus.Live,
await toast.promise(
unpauseApplication({ variables: { appId: currentApplication.id } }),
{
loading: 'Starting the project...',
success: `The project has been started successfully.`,
error: (arg: ApolloError) => {
// we need to get the internal error message from the GraphQL error
const { internal } = arg.graphQLErrors[0]?.extensions || {};
const { message } = (internal as Record<string, any>)?.error || {};
// we use the default Apollo error message if we can't find the
// internal error message
return (
message ||
arg.message ||
'An error occurred while waking up the project. Please try again.'
);
},
},
});
await updateOwnCache(client);
discordAnnounce(
`App ${currentApplication.name} (${email}) set to awake.`,
getToastStyleProps(),
);
triggerToast(`${currentApplication.name} set to awake.`);
} catch (e) {
triggerToast(`Error trying to awake ${currentApplication.name}`);
} catch {
// Note: The toast will handle the error.
}
}
if (loading) {
return <ActivityIndicator label="Loading user data..." delay={1000} />;
}
return (
<>
<Modal
@@ -65,7 +92,7 @@ export default function ApplicationPaused() {
/>
</Modal>
<Container className="mx-auto mt-20 grid max-w-sm grid-flow-row gap-2 text-center">
<Container className="mx-auto mt-20 grid max-w-lg grid-flow-row gap-4 text-center">
<div className="mx-auto flex w-centImage flex-col text-center">
<Image
src="/assets/PausedApp.svg"
@@ -75,16 +102,18 @@ export default function ApplicationPaused() {
/>
</div>
<Text variant="h3" component="h1" className="mt-4">
{currentApplication.name} is sleeping
</Text>
<Box className="grid grid-flow-row gap-1">
<Text variant="h3" component="h1">
{currentApplication.name} is sleeping
</Text>
<Text className="mt-1">
Projects on the free plan stop responding to API calls after 7 days of
no traffic.
</Text>
<Text>
Starter projects stop responding to API calls after 7 days of
inactivity. Upgrade to Pro to avoid autosleep.
</Text>
</Box>
{!isPro && (
<Box className="grid grid-flow-row gap-2">
<Button
className="mx-auto w-full max-w-[280px]"
onClick={() => {
@@ -101,32 +130,41 @@ export default function ApplicationPaused() {
});
}}
>
Upgrade to Pro to avoid autosleep
</Button>
)}
<div className="grid grid-flow-row gap-2">
<Button
variant="borderless"
className="mx-auto w-full max-w-[280px]"
loading={changingApplicationStateLoading}
disabled={changingApplicationStateLoading}
onClick={handleTriggerUnpausing}
>
Wake Up
Upgrade to Pro
</Button>
{isOwner && (
<div className="grid grid-flow-row gap-2">
<Button
color="error"
variant="borderless"
className="mx-auto w-full max-w-[280px]"
onClick={() => setShowDeletingModal(true)}
loading={changingApplicationStateLoading}
disabled={changingApplicationStateLoading || wakeUpDisabled}
onClick={handleTriggerUnpausing}
>
Delete Project
Wake Up
</Button>
)}
</div>
{wakeUpDisabled && (
<Alert severity="warning" className="mx-auto max-w-xs text-left">
Note: Only one free project can be active at any given time.
Please pause your active free project before unpausing{' '}
{currentApplication.name}.
</Alert>
)}
{isOwner && (
<Button
color="error"
variant="borderless"
className="mx-auto w-full max-w-[280px]"
onClick={() => setShowDeletingModal(true)}
>
Delete Project
</Button>
)}
</div>
</Box>
<StagingMetadata>
<ApplicationInfo />
</StagingMetadata>

View File

@@ -32,12 +32,12 @@ function Plan({
return (
<button
type="button"
className="my-4 grid w-full grid-flow-col items-center justify-between px-1"
className="my-4 grid w-full grid-flow-col items-center justify-between gap-2 px-1"
onClick={setPlan}
tabIndex={-1}
>
<div className="grid grid-flow-row gap-y-0.5">
<div className="flex flex-row items-center">
<div className="grid grid-flow-col items-center justify-start gap-2">
<Checkbox
onChange={setPlan}
checked={selectedPlanId === planId}
@@ -47,12 +47,13 @@ function Plan({
<Text
variant="h3"
component="p"
className="ml-2 self-center font-medium"
className="self-center text-left font-medium"
>
{currentPlan.price > price ? 'Downgrade' : 'Upgrade'} to {planName}
</Text>
</div>
<Text variant="subtitle2" className="w-64 text-start">
<Text variant="subtitle2" className="w-full max-w-[256px] text-start">
{planDescriptions[planName]}
</Text>
</div>
@@ -142,7 +143,7 @@ export function ChangePlanModalWithData({ app, plans, close }: any) {
};
return (
<Box className="w-welcome rounded-lg p-6 text-left">
<Box className="w-full max-w-xl rounded-lg p-6 text-left">
<Modal
showModal={paymentModal}
close={closePaymentModal}

View File

@@ -12,7 +12,7 @@ import generateAppServiceUrl, {
defaultRemoteBackendSlugs,
} from '@/utils/common/generateAppServiceUrl';
import { copy } from '@/utils/copy';
import { LOCAL_HASURA_URL } from '@/utils/env';
import { getHasuraConsoleServiceUrl } from '@/utils/env';
import Image from 'next/image';
interface HasuraDataProps {
@@ -30,7 +30,7 @@ export function HasuraData({ close }: HasuraDataProps) {
const hasuraUrl =
process.env.NEXT_PUBLIC_ENV === 'dev' || !isPlatform
? `${LOCAL_HASURA_URL}/console`
? `${getHasuraConsoleServiceUrl()}`
: generateAppServiceUrl(
currentApplication?.subdomain,
currentApplication?.region.awsName,

View File

@@ -6,7 +6,10 @@ import Divider from '@/ui/v2/Divider';
import Text from '@/ui/v2/Text';
import { discordAnnounce } from '@/utils/discordAnnounce';
import { triggerToast } from '@/utils/toast';
import { useDeleteApplicationMutation } from '@/utils/__generated__/graphql';
import {
GetOneUserDocument,
useDeleteApplicationMutation,
} from '@/utils/__generated__/graphql';
import router from 'next/router';
import { useState } from 'react';
import { twMerge } from 'tailwind-merge';
@@ -42,7 +45,9 @@ export function RemoveApplicationModal({
description,
className,
}: RemoveApplicationModalProps) {
const [deleteApplication, { client }] = useDeleteApplicationMutation();
const [deleteApplication] = useDeleteApplicationMutation({
refetchQueries: [GetOneUserDocument],
});
const [loadingRemove, setLoadingRemove] = useState(false);
const { currentApplication } = useCurrentWorkspaceAndApplication();
@@ -73,9 +78,6 @@ export function RemoveApplicationModal({
}
close();
await router.push('/');
await client.refetchQueries({
include: ['getOneUser'],
});
triggerToast(`${currentApplication.name} deleted`);
}

View File

@@ -111,9 +111,8 @@ export function RenderWorkspacesWithApps({
)}
<StateBadge
status={checkStatusOfTheApplication(
app.appStates,
)}
state={checkStatusOfTheApplication(app.appStates)}
desiredState={app.desiredState}
title={getApplicationStatusString(
checkStatusOfTheApplication(app.appStates),
)}

View File

@@ -6,7 +6,7 @@ import type { PropsWithChildren } from 'react';
export function StagingMetadata({ children }: PropsWithChildren<unknown>) {
return (
isDevOrStaging() && (
<div className="mt-10">
<div className="mx-auto mt-10 max-w-sm">
<Box className="mx-auto flex flex-col rounded-md border p-5 text-center">
<Status status={StatusEnum.Deploying}>Internal info</Status>
{children}

View File

@@ -33,11 +33,10 @@ export function UnlockFeatureByUpgrading({
title: 'Upgrade your plan.',
payload: <ChangePlanModal />,
props: {
PaperProps: { className: 'p-0' },
PaperProps: { className: 'p-0 max-w-xl w-full' },
hidePrimaryAction: true,
hideSecondaryAction: true,
hideTitle: true,
maxWidth: 'lg',
},
});
}}

View File

@@ -1,3 +1,4 @@
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import { useRemoteApplicationGQLClient } from '@/hooks/useRemoteApplicationGQLClient';
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
import Option from '@/ui/v2/Option';
@@ -18,10 +19,12 @@ export interface UserSelectProps {
}
export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
const { currentApplication } = useCurrentWorkspaceAndApplication();
const userApplicationClient = useRemoteApplicationGQLClient();
const { data, loading, error } = useRemoteAppGetUsersCustomQuery({
client: userApplicationClient,
variables: { where: {}, limit: 250, offset: 0 },
skip: !currentApplication,
});
if (loading) {
@@ -36,8 +39,6 @@ export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
throw error;
}
const { users } = data;
return (
<Select
{...props}
@@ -57,7 +58,7 @@ export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
return;
}
const user: RemoteAppGetUsersCustomQuery['users'][0] = users.find(
const user: RemoteAppGetUsersCustomQuery['users'][0] = data?.users.find(
({ id }) => id === userId,
);
@@ -68,7 +69,7 @@ export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
>
<Option value="admin">Admin</Option>
{users.map(({ id, displayName, email, phoneNumber }) => (
{data?.users.map(({ id, displayName, email, phoneNumber }) => (
<Option key={id} value={id}>
{displayName || email || phoneNumber || id}
</Option>

View File

@@ -22,7 +22,9 @@ import {
import { loadStripe } from '@stripe/stripe-js';
import React, { useState } from 'react';
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PK!);
const stripePromise = process.env.NEXT_PUBLIC_STRIPE_PK
? loadStripe(process.env.NEXT_PUBLIC_STRIPE_PK)
: null;
type AddPaymentMethodFormProps = {
close: () => void;
@@ -74,7 +76,8 @@ function AddPaymentMethodForm({
if (createPaymentMethodError) {
throw new Error(
createPaymentMethodError.message || 'Unknown error occurred.',
createPaymentMethodError.message ||
'An unknown error occurred. Please try again.',
);
}
@@ -88,7 +91,10 @@ function AddPaymentMethodForm({
);
if (attachPaymentMethodError) {
throw Error((attachPaymentMethodError as any).response.data);
throw new Error(
(attachPaymentMethodError as any)?.response?.data ||
'An unknown error occurred. Please try again.',
);
}
// update workspace with new country code in database
@@ -149,7 +155,7 @@ function AddPaymentMethodForm({
};
return (
<Box className="w-modal2 px-6 pt-6 pb-6 text-left rounded-lg">
<Box className="w-modal2 rounded-lg px-6 pt-6 pb-6 text-left">
<div className="flex flex-col">
<form onSubmit={handleSubmit}>
<Text className="text-center text-lg font-medium">
@@ -201,7 +207,7 @@ function AddPaymentMethodForm({
type BillingPaymentMethodFormProps = {
close: () => void;
onPaymentMethodAdded?: () => Promise<void>;
onPaymentMethodAdded?: (e?: any) => Promise<void>;
workspaceId: string;
};

View File

@@ -46,7 +46,7 @@ export default function DataGridDateCell<TData extends object>({
: undefined;
const { year, month, day, hour, minute, second } = getDateComponents(date, {
adjustTimezone: specificType === 'timetz' || specificType === 'timestamptz',
adjustTimezone: ['date', 'timetz', 'timestamptz'].includes(specificType),
});
const { inputRef, focusCell, isEditing, cancelEditCell } =

View File

@@ -39,17 +39,17 @@ const ruleGroupSchema = Yup.object().shape({
const baseValidationSchema = Yup.object().shape({
filter: ruleGroupSchema.nullable().required('Please select a filter type.'),
columns: Yup.array().of(Yup.string()).nullable(true),
columns: Yup.array().of(Yup.string()).nullable(),
});
const selectValidationSchema = baseValidationSchema.shape({
limit: Yup.number()
.label('Limit')
.min(0, 'Limit must not be negative.')
.nullable(true),
allowAggregations: Yup.boolean().nullable(true),
queryRootFields: Yup.array().of(Yup.string()).nullable(true),
subscriptionRootFields: Yup.array().of(Yup.string()).nullable(true),
.nullable(),
allowAggregations: Yup.boolean().nullable(),
queryRootFields: Yup.array().of(Yup.string()).nullable(),
subscriptionRootFields: Yup.array().of(Yup.string()).nullable(),
});
const columnPresetSchema = Yup.object().shape({
@@ -88,17 +88,17 @@ const columnPresetSchema = Yup.object().shape({
});
const insertValidationSchema = baseValidationSchema.shape({
backendOnly: Yup.boolean().nullable(true),
columnPresets: Yup.array().of(columnPresetSchema).nullable(true),
backendOnly: Yup.boolean().nullable(),
columnPresets: Yup.array().of(columnPresetSchema).nullable(),
});
const updateValidationSchema = baseValidationSchema.shape({
backendOnly: Yup.boolean().nullable(true),
columnPresets: Yup.array().of(columnPresetSchema).nullable(true),
backendOnly: Yup.boolean().nullable(),
columnPresets: Yup.array().of(columnPresetSchema).nullable(),
});
const deleteValidationSchema = baseValidationSchema.shape({
columnPresets: Yup.array().of(columnPresetSchema).nullable(true),
columnPresets: Yup.array().of(columnPresetSchema).nullable(),
});
const validationSchemas: Record<DatabaseAction, Yup.ObjectSchema<any>> = {

View File

@@ -59,12 +59,12 @@ export default function DeploymentListItem({
return (
<ListItem.Root>
<ListItem.Button
className="grid grid-flow-col items-center justify-between gap-2 rounded-none px-2 py-2"
className="grid grid-flow-col items-center justify-between gap-2 rounded-none p-2"
component={NavLink}
href={`/${currentWorkspace.slug}/${currentApplication.slug}/deployments/${deployment.id}`}
aria-label={commitMessage || 'No commit message'}
>
<div className="flex cursor-pointer flex-row items-center justify-center space-x-2 self-center">
<div className="grid grid-flow-col items-center justify-center gap-2 self-center">
<ListItem.Avatar>
<Avatar
name={deployment.commitUserName}
@@ -85,7 +85,7 @@ export default function DeploymentListItem({
/>
</div>
<div className="grid grid-flow-col items-center gap-2">
<div className="grid grid-flow-col items-center justify-end gap-2">
{showRedeploy && (
<Tooltip
title={
@@ -142,16 +142,16 @@ export default function DeploymentListItem({
)}
{isLive && (
<div className="flex w-12 justify-end">
<div className="hidden w-12 justify-end sm:flex">
<Chip size="small" color="success" label="Live" />
</div>
)}
<div className="w-16 text-right font-mono text-sm- font-medium">
<div className="hidden w-16 text-right font-mono text-sm- font-medium sm:block">
{deployment.commitSHA.substring(0, 7)}
</div>
<div className="w-[80px] text-right font-mono text-sm- font-medium">
<div className="text-right font-mono text-sm- font-medium sm:w-20">
<AppDeploymentDuration
startedAt={deployment.deploymentStartedAt}
endedAt={deployment.deploymentEndedAt}

View File

@@ -45,14 +45,14 @@ export default function DeploymentStatusMessage({
if (!isDeployingToProduction && deployment?.deploymentEndedAt) {
return (
<span className="flex flex-row">
<span className="grid grid-flow-col">
<Avatar
component="span"
name={deployment.commitUserName}
avatarUrl={deployment.commitUserAvatarUrl}
className="mr-1 h-4 w-4 self-center"
/>
<Text component="span" className="self-center text-sm">
<Text component="span" className="self-center truncate text-sm">
{deployment.commitUserName} deployed{' '}
{formatDistance(new Date(deployment.deploymentEndedAt), new Date(), {
addSuffix: true,

View File

@@ -12,6 +12,7 @@ import useBuckets from '@/hooks/useBuckets';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import useFiles from '@/hooks/useFiles';
import useFilesAggregate from '@/hooks/useFilesAggregate';
import { getHasuraAdminSecret } from '@/utils/env';
import { showLoadingToast, triggerToast } from '@/utils/toast';
import type { Files } from '@/utils/__generated__/graphql';
import { Order_By as OrderBy } from '@/utils/__generated__/graphql';
@@ -261,7 +262,7 @@ export default function FilesDataGrid(props: FilesDataGridProps) {
const { fileMetadata, error: fileError } = await appClient.storage
.setAdminSecret(
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: currentApplication.config?.hasura.adminSecret,
)
.upload({

View File

@@ -12,6 +12,7 @@ import Button from '@/ui/v2/Button';
import Chip from '@/ui/v2/Chip';
import type { InputProps } from '@/ui/v2/Input';
import Input from '@/ui/v2/Input';
import { getHasuraAdminSecret } from '@/utils/env';
import { triggerToast } from '@/utils/toast';
import type { Files } from '@/utils/__generated__/graphql';
import type { PropsWithoutRef } from 'react';
@@ -71,7 +72,7 @@ export default function FilesDataGridControls({
try {
const storageWithAdminSecret = appClient.storage.setAdminSecret(
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: currentApplication.config?.hasura.adminSecret,
);

View File

@@ -99,7 +99,6 @@ export function InviteAnnounce() {
workspaceMemberInviteId: inviteId,
isAccepted: false,
},
{ useAxios: false },
);
if (ignoreError) {

View File

@@ -7,7 +7,7 @@ import Link from 'next/link';
export default function Sidebar() {
return (
<div className="grid grid-flow-row gap-8 mt-2 ml-10 w-full md:grid md:w-workspaceSidebar content-start">
<div className="mt-2 grid w-full grid-flow-row content-start gap-8 md:ml-10 md:grid md:w-workspaceSidebar">
<WorkspaceSection />
<Resources />

View File

@@ -2,8 +2,9 @@ import { UserDataProvider } from '@/context/workspace1-context';
import type { Project } from '@/types/application';
import { ApplicationStatus } from '@/types/application';
import type { Workspace } from '@/types/workspace';
import nhostGraphQLLink from '@/utils/msw/mocks/graphql/nhostGraphQLLink';
import { render, screen, waitForElementToBeRemoved } from '@/utils/testUtils';
import { graphql, rest } from 'msw';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import { afterAll, beforeAll, vi } from 'vitest';
import OverviewDeployments from '.';
@@ -73,13 +74,11 @@ const mockWorkspace: Workspace = {
applications: [mockApplication],
};
const mockGraphqlLink = graphql.link('http://localhost:1337/v1/graphql');
const server = setupServer(
rest.get('http://localhost:1337/v1/graphql', (req, res, ctx) =>
rest.get('https://local.graphql.nhost.run/v1', (_req, res, ctx) =>
res(ctx.status(200)),
),
mockGraphqlLink.operation(async (req, res, ctx) =>
nhostGraphQLLink.operation(async (_req, res, ctx) =>
res(
ctx.data({
deployments: [],
@@ -143,7 +142,7 @@ test('should render an empty state when GitHub is connected, but there are no de
test('should render a list of deployments', async () => {
server.use(
mockGraphqlLink.operation(async (req, res, ctx) => {
nhostGraphQLLink.operation(async (req, res, ctx) => {
const requestPayload = await req.json();
if (requestPayload.operationName === 'ScheduledOrPendingDeploymentsSub') {
@@ -193,7 +192,7 @@ test('should render a list of deployments', async () => {
test('should disable redeployments if a deployment is already in progress', async () => {
server.use(
mockGraphqlLink.operation(async (req, res, ctx) => {
nhostGraphQLLink.operation(async (req, res, ctx) => {
const requestPayload = await req.json();
if (requestPayload.operationName === 'ScheduledOrPendingDeploymentsSub') {

View File

@@ -76,7 +76,7 @@ function OverviewDeploymentList() {
if (!deployments?.length) {
return (
<Box className="grid grid-flow-row items-center justify-items-center gap-5 overflow-hidden rounded-lg border-1 py-12 px-48 shadow-sm">
<Box className="grid grid-flow-row items-center justify-items-center gap-5 overflow-hidden rounded-lg border-1 py-12 px-4 shadow-sm">
<RocketIcon
strokeWidth={1}
className="h-10 w-10"
@@ -86,7 +86,7 @@ function OverviewDeploymentList() {
<Text className="text-center font-medium" variant="h3">
No Deployments
</Text>
<Text variant="subtitle1" className="text-center">
<Text variant="subtitle1" className="max-w-md text-center">
We&apos;ll deploy changes automatically when you push to the
deployment branch in your connected GitHub repository
</Text>
@@ -166,14 +166,14 @@ export default function OverviewDeployments() {
<div className="flex flex-col">
<OverviewDeploymentsTopBar />
<Box className="grid grid-flow-row items-center justify-items-center gap-5 rounded-lg border-1 py-12 px-48 shadow-sm">
<Box className="grid grid-flow-row items-center justify-items-center gap-5 rounded-lg border-1 py-12 px-4 shadow-sm">
<RocketIcon strokeWidth={1} className="h-10 w-10" />
<div className="grid grid-flow-row gap-1">
<Text className="text-center font-medium" variant="h3">
No Deployments
</Text>
<Text variant="subtitle1" className="text-center">
<Text variant="subtitle1" className="max-w-sm text-center">
Connect your project with a GitHub repository to create your first
deployment
</Text>

View File

@@ -1,9 +1,9 @@
import { ChangePlanModal } from '@/components/applications/ChangePlanModal';
import { useDialog } from '@/components/common/DialogProvider';
import { useUI } from '@/context/UIContext';
import useIsPlatform from '@/hooks/common/useIsPlatform';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import Box from '@/ui/v2/Box';
import Button from '@/ui/v2/Button';
import Chip from '@/ui/v2/Chip';
import CogIcon from '@/ui/v2/icons/CogIcon';
@@ -43,9 +43,9 @@ export default function OverviewTopBar() {
}
return (
<div className="flex flex-row place-content-between items-center py-5">
<div className="flex flex-row items-center space-x-2">
<div className="grid grid-flow-col items-center gap-2">
<div className="grid items-center gap-4 pb-5 md:grid-flow-col md:place-content-between md:py-5">
<div className="grid items-center gap-2 md:grid-flow-col">
<div className="grid grid-flow-col items-center justify-start gap-2">
<div className="h-10 w-10 overflow-hidden rounded-lg">
<Image
src="/logos/new.svg"
@@ -60,43 +60,44 @@ export default function OverviewTopBar() {
</Text>
</div>
{isPro ? (
<Chip
className="self-center font-medium"
size="small"
label="Pro Plan"
color="primary"
/>
) : (
<>
<Box className="grid grid-flow-col items-center justify-start gap-2">
{isPro ? (
<Chip
className="self-center font-medium"
size="small"
label="Free Plan"
color="default"
variant="filled"
label="Pro Plan"
color="primary"
/>
<Button
variant="borderless"
className="mr-2"
onClick={() => {
openAlertDialog({
title: 'Upgrade your plan.',
payload: <ChangePlanModal />,
props: {
PaperProps: { className: 'p-0' },
hidePrimaryAction: true,
hideSecondaryAction: true,
hideTitle: true,
maxWidth: 'lg',
},
});
}}
>
Upgrade
</Button>
</>
)}
) : (
<>
<Chip
className="self-center font-medium"
size="small"
label="Free Plan"
color="default"
variant="filled"
/>
<Button
variant="borderless"
className="mr-2"
onClick={() => {
openAlertDialog({
title: 'Upgrade your plan.',
payload: <ChangePlanModal />,
props: {
PaperProps: { className: 'p-0 max-w-xl w-full' },
hidePrimaryAction: true,
hideSecondaryAction: true,
hideTitle: true,
},
});
}}
>
Upgrade
</Button>
</>
)}
</Box>
</div>
<Link
href={`/${currentWorkspace.slug}/${currentApplication.slug}/settings/general`}

View File

@@ -79,6 +79,7 @@ export function OverviewUsageMetrics() {
const isPlatform = useIsPlatform();
const { currentApplication } = useCurrentWorkspaceAndApplication();
const remoteAppClient = useRemoteApplicationGQLClient();
const [metrics, setMetrics] = useState({
functions: 0,
storage: 0,
@@ -98,6 +99,7 @@ export function OverviewUsageMetrics() {
const { data: remoteAppMetricsData } = useGetRemoteAppMetricsQuery({
client: remoteAppClient,
skip: !currentApplication,
});
useEffect(() => {

View File

@@ -35,7 +35,7 @@ export default function DisableNewUsersSettings() {
const form = useForm<DisableNewUsersFormValues>({
reValidateMode: 'onSubmit',
defaultValues: {
disabled: !!data?.config?.auth?.signUp?.enabled,
disabled: !data?.config?.auth?.signUp?.enabled,
},
});

View File

@@ -20,7 +20,7 @@ import generateAppServiceUrl, {
defaultLocalBackendSlugs,
defaultRemoteBackendSlugs,
} from '@/utils/common/generateAppServiceUrl';
import { LOCAL_HASURA_URL } from '@/utils/env';
import { getHasuraConsoleServiceUrl } from '@/utils/env';
import { generateRemoteAppUrl } from '@/utils/helpers';
import getJwtSecretsWithoutFalsyValues from '@/utils/settings/getJwtSecretsWithoutFalsyValues';
import { useGetEnvironmentVariablesQuery } from '@/utils/__generated__/graphql';
@@ -109,7 +109,7 @@ export default function SystemEnvironmentVariableSettings() {
key: 'NHOST_HASURA_URL',
value:
process.env.NEXT_PUBLIC_ENV === 'dev' || !isPlatform
? `${LOCAL_HASURA_URL}/console`
? `${getHasuraConsoleServiceUrl()}/console`
: generateAppServiceUrl(
currentApplication?.subdomain,
currentApplication?.region.awsName,

View File

@@ -24,22 +24,30 @@ import { twMerge } from 'tailwind-merge';
import * as Yup from 'yup';
const validationSchema = Yup.object({
teamId: Yup.string().label('Team ID').when('enabled', {
is: true,
then: Yup.string().required(),
}),
keyId: Yup.string().label('Key ID').when('enabled', {
is: true,
then: Yup.string().required(),
}),
clientId: Yup.string().label('Client ID').when('enabled', {
is: true,
then: Yup.string().required(),
}),
privateKey: Yup.string().label('Private Key').when('enabled', {
is: true,
then: Yup.string().required(),
}),
teamId: Yup.string()
.label('Team ID')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
keyId: Yup.string()
.label('Key ID')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
clientId: Yup.string()
.label('Client ID')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
privateKey: Yup.string()
.label('Private Key')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
enabled: Yup.boolean(),
});

View File

@@ -3,14 +3,18 @@ import { useFormContext } from 'react-hook-form';
import * as Yup from 'yup';
export const baseProviderValidationSchema = Yup.object({
clientId: Yup.string().label('Client ID').when('enabled', {
is: true,
then: Yup.string().required(),
}),
clientSecret: Yup.string().label('Client Secret').when('enabled', {
is: true,
then: Yup.string().required(),
}),
clientId: Yup.string()
.label('Client ID')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
clientSecret: Yup.string()
.label('Client Secret')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
enabled: Yup.bool(),
});

View File

@@ -22,19 +22,23 @@ import { twMerge } from 'tailwind-merge';
import * as Yup from 'yup';
const validationSchema = Yup.object({
accountSid: Yup.string().label('Account SID').when('enabled', {
is: true,
then: Yup.string().required(),
}),
authToken: Yup.string().label('Auth Token').when('enabled', {
is: true,
then: Yup.string().required(),
}),
accountSid: Yup.string()
.label('Account SID')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
authToken: Yup.string()
.label('Auth Token')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
messagingServiceId: Yup.string()
.label('Messaging Service ID')
.when('enabled', {
is: true,
then: Yup.string().required(),
then: (schema) => schema.required(),
}),
enabled: Yup.boolean().label('Enabled'),
});

View File

@@ -23,14 +23,18 @@ import { twMerge } from 'tailwind-merge';
import * as Yup from 'yup';
const validationSchema = Yup.object({
consumerSecret: Yup.string().label('Consumer Secret').when('enabled', {
is: true,
then: Yup.string().required(),
}),
consumerKey: Yup.string().label('Consumer Key').when('enabled', {
is: true,
then: Yup.string().required(),
}),
consumerSecret: Yup.string()
.label('Consumer Secret')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
consumerKey: Yup.string()
.label('Consumer Key')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
enabled: Yup.boolean(),
});

View File

@@ -24,22 +24,30 @@ import { twMerge } from 'tailwind-merge';
import * as Yup from 'yup';
const validationSchema = Yup.object({
clientId: Yup.string().label('Client ID').when('enabled', {
is: true,
then: Yup.string().required(),
}),
clientSecret: Yup.string().label('Client Secret').when('enabled', {
is: true,
then: Yup.string().required(),
}),
organization: Yup.string().label('Organization').when('enabled', {
is: true,
then: Yup.string().required(),
}),
connection: Yup.string().label('Connection').when('enabled', {
is: true,
then: Yup.string().required(),
}),
clientId: Yup.string()
.label('Client ID')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
clientSecret: Yup.string()
.label('Client Secret')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
organization: Yup.string()
.label('Organization')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
connection: Yup.string()
.label('Connection')
.when('enabled', {
is: true,
then: (schema) => schema.required(),
}),
enabled: Yup.boolean(),
});

View File

@@ -5,7 +5,11 @@ export interface StateBadgeProps {
/**
* This is the current state of the application.
*/
status: ApplicationStatus;
state: ApplicationStatus;
/**
* This is the desired state of the application.
*/
desiredState: ApplicationStatus;
/**
* The title to show on the application state badge.
*/
@@ -24,20 +28,28 @@ function getNormalizedTitle(title: string) {
return title;
}
export default function StateBadge({ title, status }: StateBadgeProps) {
export default function StateBadge({
title,
state,
desiredState,
}: StateBadgeProps) {
if (
desiredState === ApplicationStatus.Paused &&
state === ApplicationStatus.Live
) {
return <Chip size="small" color="default" label="Pausing" />;
}
const normalizedTitle = getNormalizedTitle(title);
if (
status === ApplicationStatus.Empty ||
status === ApplicationStatus.Unpausing
state === ApplicationStatus.Empty ||
state === ApplicationStatus.Unpausing
) {
return <Chip size="small" label={normalizedTitle} color="warning" />;
}
if (
status === ApplicationStatus.Errored ||
status === ApplicationStatus.Live
) {
if (state === ApplicationStatus.Errored || state === ApplicationStatus.Live) {
return <Chip size="small" label={normalizedTitle} color="success" />;
}

View File

@@ -6,7 +6,7 @@ import SvgIcon from '@/ui/v2/icons/SvgIcon';
import { styled } from '@mui/material';
import type { RadioProps as MaterialRadioProps } from '@mui/material/Radio';
import MaterialRadio from '@mui/material/Radio';
import type { ForwardedRef, PropsWithoutRef } from 'react';
import type { ForwardedRef, PropsWithoutRef, ReactNode } from 'react';
import { forwardRef } from 'react';
export interface RadioProps extends MaterialRadioProps {
@@ -17,7 +17,7 @@ export interface RadioProps extends MaterialRadioProps {
/**
* Label to be displayed next to the radio button.
*/
label?: string;
label?: ReactNode;
/**
* Props to be passed to individual component slots.
*/

View File

@@ -1,7 +1,9 @@
import { styled } from '@mui/material';
import Box from '@mui/material/Box';
import type { TooltipProps as MaterialTooltipProps } from '@mui/material/Tooltip';
import MaterialTooltip, { tooltipClasses } from '@mui/material/Tooltip';
import MaterialTooltip, {
tooltipClasses as materialTooltipClasses,
} from '@mui/material/Tooltip';
import type { ForwardedRef } from 'react';
import { forwardRef } from 'react';
@@ -21,7 +23,7 @@ export interface TooltipProps extends MaterialTooltipProps {
}
const StyledTooltip = styled(Box)(({ theme }) => ({
[`&.${tooltipClasses.tooltip}`]: {
[`&.${materialTooltipClasses.tooltip}`]: {
fontSize: '0.9375rem',
lineHeight: '1.375rem',
backgroundColor:
@@ -36,9 +38,23 @@ const StyledTooltip = styled(Box)(({ theme }) => ({
'0px 1px 4px rgba(14, 24, 39, 0.1), 0px 8px 24px rgba(14, 24, 39, 0.1)',
maxWidth: '17.5rem',
},
[`&.${tooltipClasses.tooltipPlacementBottom}`]: {
[`& .${materialTooltipClasses.arrow}`]: {
color:
theme.palette.mode === 'dark'
? theme.palette.grey[300]
: theme.palette.grey[700],
},
[`&.${materialTooltipClasses.tooltipPlacementBottom}`]: {
marginTop: `${theme.spacing(0.75)} !important`,
},
[`&.${materialTooltipClasses.tooltipPlacementBottom} .${materialTooltipClasses.arrow}`]:
{
marginTop: `${theme.spacing(-0.5)} !important`,
color:
theme.palette.mode === 'dark'
? theme.palette.grey[300]
: theme.palette.grey[700],
},
}));
function Tooltip(
@@ -69,6 +85,8 @@ function Tooltip(
);
}
export { materialTooltipClasses as tooltipClasses };
Tooltip.displayName = 'NhostTooltip';
export default forwardRef(Tooltip);

View File

@@ -21,14 +21,17 @@ export default function createTheme(mode: PaletteMode) {
},
h2: {
fontSize: '1.625rem',
lineHeight: '2.375rem',
fontWeight: 500,
},
h3: {
fontSize: '1.125rem',
lineHeight: '1.5rem',
fontWeight: 500,
},
h4: {
fontSize: '1rem',
lineHeight: '1.375rem',
fontWeight: 500,
},
subtitle1: {

View File

@@ -165,7 +165,7 @@ export default function CreateUserForm({
</Alert>
)}
<div className="grid grid-flow-row gap-2">
<Button type="submit" loading={isSubmitting} disabled={isSubmitting}>
<Button type="submit" disabled={isSubmitting}>
Create
</Button>

View File

@@ -242,7 +242,11 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
secondaryAction={
<Dropdown.Root>
<Dropdown.Trigger asChild hideChevron>
<IconButton variant="borderless" color="secondary">
<IconButton
variant="borderless"
color="secondary"
aria-label={`More options for ${user.displayName}`}
>
<DotsHorizontalIcon />
</IconButton>
</Dropdown.Trigger>
@@ -282,6 +286,7 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
<ListItem.Button
className="grid h-full w-full grid-cols-1 py-2.5 lg:grid-cols-6"
onClick={() => handleViewUser(user)}
aria-label={`View ${user.displayName}`}
>
<div className="col-span-2 grid grid-flow-col place-content-start gap-4">
<Avatar

View File

@@ -12,8 +12,8 @@ export function WorkspaceInvoices() {
return (
<div className="mt-18">
<div className="mx-auto max-w-3xl font-display grid grid-flow-row gap-2 justify-start">
<Text className="font-medium text-lg">Invoices</Text>
<div className="mx-auto grid max-w-3xl grid-flow-row justify-start gap-2 font-display">
<Text className="text-lg font-medium">Invoices</Text>
<Button
variant="outlined"
@@ -23,7 +23,6 @@ export function WorkspaceInvoices() {
const { res, error } = await nhost.functions.call(
'/stripe-create-portal',
{ workspaceId: currentWorkspace.id },
{ useAxios: false },
);
if (error) {

View File

@@ -1,14 +0,0 @@
fragment GetAppRoles on apps {
id
slug
subdomain
name
authUserDefaultAllowedRoles
authUserDefaultRole
}
query getAppRolesAndPermissions($id: uuid!) {
app(id: $id) {
...GetAppRoles
}
}

View File

@@ -0,0 +1,5 @@
mutation PauseApplication($appId: uuid!) {
updateApp(pk_columns: { id: $appId }, _set: { desiredState: 6 }) {
id
}
}

View File

@@ -0,0 +1,5 @@
mutation UnpauseApplication($appId: uuid!) {
updateApp(pk_columns: { id: $appId }, _set: { desiredState: 5 }) {
id
}
}

View File

@@ -1,15 +0,0 @@
query getFunctionsLogs($subdomain: String!) {
getFunctionLogs(subdomain: $subdomain) {
functionPath
createdAt
message
}
}
query getFunctionLog($subdomain: String!, $functionPaths: [String!]) {
getFunctionLogs(subdomain: $subdomain, functionPaths: $functionPaths) {
functionPath
createdAt
message
}
}

View File

@@ -1,7 +0,0 @@
query getGravatarSettings($id: uuid!) {
app(id: $id) {
authGravatarEnabled
authGravatarDefault
authGravatarRating
}
}

View File

@@ -1,7 +0,0 @@
mutation restoreDatabaseBackup($appId: uuid!, $backupId: uuid!) {
restoreDatabaseBackup(appId: $appId, backupId: $backupId)
}
mutation scheduleRestoreDatabaseBackup($appId: uuid!, $backupId: uuid!) {
scheduleRestoreDatabaseBackup(appId: $appId, backupId: $backupId)
}

View File

@@ -0,0 +1,11 @@
query GetFreeAndActiveProjects($userId: uuid!) {
freeAndActiveProjects: apps(
where: {
creatorUserId: { _eq: $userId }
plan: { isFree: { _eq: true } }
desiredState: { _eq: 5 }
}
) {
id
}
}

View File

@@ -1,5 +1,6 @@
import useIsPlatform from '@/hooks/common/useIsPlatform';
import { useNhostClient } from '@nhost/nextjs';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { useQuery } from '@tanstack/react-query';
/**
@@ -7,12 +8,19 @@ import { useQuery } from '@tanstack/react-query';
*/
export default function useIsHealthy() {
const isPlatform = useIsPlatform();
const client = useNhostClient();
const { currentApplication } = useCurrentWorkspaceAndApplication();
const appUrl = generateAppServiceUrl(
currentApplication?.subdomain,
currentApplication?.region?.awsName,
'auth',
);
const { failureCount, status } = useQuery(
['/healthz'],
() => fetch(`${client.auth.url}/healthz`),
() => fetch(`${appUrl}/healthz`),
{
enabled: !isPlatform,
enabled: !isPlatform && !!currentApplication,
retry: true,
retryDelay: 5000,
cacheTime: 0,

View File

@@ -1,6 +1,8 @@
import { isPlatform } from '@/utils/env';
/**
* Returns `true` if all features of the dashboard should be enabled.
*/
export default function useIsPlatform() {
return process.env.NEXT_PUBLIC_NHOST_PLATFORM === 'true';
return isPlatform();
}

View File

@@ -7,7 +7,7 @@ import type {
} from '@/types/dataBrowser';
import { getPreparedHasuraQuery } from '@/utils/dataBrowser/hasuraQueryHelpers';
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
import { getHasuraMigrationsApiUrl } from '@/utils/env';
import prepareCreateColumnQuery from './prepareCreateColumnQuery';
export interface CreateColumnMigrationVariables {
@@ -34,7 +34,7 @@ export default async function createColumnMigration({
column,
});
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
method: 'POST',
headers: {
'x-hasura-admin-secret': adminSecret,

View File

@@ -1,6 +1,7 @@
import useIsPlatform from '@/hooks/common/useIsPlatform';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -52,7 +53,7 @@ export default function useCreateColumnMutation({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -1,5 +1,6 @@
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -53,7 +54,7 @@ export default function useCreateRecordMutation<TData extends object = {}>({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -7,7 +7,7 @@ import type {
} from '@/types/dataBrowser';
import { getPreparedHasuraQuery } from '@/utils/dataBrowser/hasuraQueryHelpers';
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
import { getHasuraMigrationsApiUrl } from '@/utils/env';
import prepareCreateTableQuery from './prepareCreateTableQuery';
export interface CreateTableMigrationVariables {
@@ -28,7 +28,7 @@ export default async function createTableMigration({
}: CreateTableMigrationOptions & CreateTableMigrationVariables) {
const args = prepareCreateTableQuery({ dataSource, schema, table });
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
method: 'POST',
headers: {
'x-hasura-admin-secret': adminSecret,

View File

@@ -1,6 +1,7 @@
import useIsPlatform from '@/hooks/common/useIsPlatform';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -50,7 +51,7 @@ export default function useCreateTableMutation({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -1,5 +1,6 @@
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
import { useQuery } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -51,7 +52,7 @@ export default function useDatabaseQuery(
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -8,7 +8,7 @@ import type {
} from '@/types/dataBrowser';
import { getPreparedHasuraQuery } from '@/utils/dataBrowser/hasuraQueryHelpers';
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
import { getHasuraMigrationsApiUrl } from '@/utils/env';
export interface DeleteColumnMigrationVariables {
/**
@@ -46,7 +46,7 @@ export default async function deleteColumnMigration({
},
});
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
method: 'POST',
headers: {
'x-hasura-admin-secret': adminSecret,

View File

@@ -1,6 +1,7 @@
import useIsPlatform from '@/hooks/common/useIsPlatform';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -53,7 +54,7 @@ export default function useDeleteColumnMutation({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -1,5 +1,6 @@
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -49,7 +50,7 @@ export default function useDeleteRecordMutation({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -9,7 +9,7 @@ import {
getPreparedHasuraQuery,
} from '@/utils/dataBrowser/hasuraQueryHelpers';
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
import { getHasuraMigrationsApiUrl } from '@/utils/env';
export interface DeleteTableMigrationVariables {
/**
@@ -40,7 +40,7 @@ export default async function deleteTable({
),
];
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
method: 'POST',
headers: {
'x-hasura-admin-secret': adminSecret,

View File

@@ -1,6 +1,7 @@
import useIsPlatform from '@/hooks/common/useIsPlatform';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -48,7 +49,7 @@ export default function useDeleteTableMutation({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -7,7 +7,7 @@ import type {
QueryResult,
} from '@/types/dataBrowser';
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
import { getHasuraMigrationsApiUrl } from '@/utils/env';
export interface ManagePermissionMigrationVariables {
/**
@@ -113,7 +113,7 @@ export default async function managePermissionMigration({
};
}
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
method: 'POST',
headers: {
'x-hasura-admin-secret': adminSecret,

View File

@@ -1,6 +1,7 @@
import useIsPlatform from '@/hooks/common/useIsPlatform';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -56,7 +57,7 @@ export default function useManagePermissionMutation({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -1,5 +1,6 @@
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
import { useQuery } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -53,7 +54,7 @@ export default function useMetadataQuery(
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -1,5 +1,6 @@
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
import { useQuery } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -53,7 +54,7 @@ export default function useTableQuery(
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -6,7 +6,7 @@ import type {
QueryResult,
} from '@/types/dataBrowser';
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
import { getHasuraMigrationsApiUrl } from '@/utils/env';
import prepareTrackForeignKeyRelationsMetadata from './prepareTrackForeignKeyRelationsMetadata';
export interface TrackForeignKeyRelationsMigrationVariables {
@@ -46,7 +46,7 @@ export default async function trackForeignKeyRelationsMigration({
foreignKeyRelations,
});
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
method: 'POST',
headers: {
'x-hasura-admin-secret': adminSecret,

View File

@@ -1,6 +1,7 @@
import useIsPlatform from '@/hooks/common/useIsPlatform';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -50,7 +51,7 @@ export default function useTrackForeignKeyRelationMutation({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -6,7 +6,7 @@ import type {
QueryResult,
} from '@/types/dataBrowser';
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
import { getHasuraMigrationsApiUrl } from '@/utils/env';
export interface TrackTableMigrationVariables {
/**
@@ -24,7 +24,7 @@ export default async function trackTableMigration({
adminSecret,
table,
}: TrackTableMigrationOptions & TrackTableMigrationVariables) {
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
method: 'POST',
headers: {
'x-hasura-admin-secret': adminSecret,

View File

@@ -1,6 +1,7 @@
import useIsPlatform from '@/hooks/common/useIsPlatform';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -48,7 +49,7 @@ export default function useTrackTableMutation({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -7,7 +7,7 @@ import type {
} from '@/types/dataBrowser';
import { getEmptyDownMigrationMessage } from '@/utils/dataBrowser/hasuraQueryHelpers';
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
import { getHasuraMigrationsApiUrl } from '@/utils/env';
import prepareUpdateColumnQuery from './prepareUpdateColumnQuery';
export interface UpdateColumnMigrationVariables {
@@ -66,7 +66,7 @@ export default async function updateColumnMigration({
];
}
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
method: 'POST',
headers: {
'x-hasura-admin-secret': adminSecret,

View File

@@ -1,6 +1,7 @@
import useIsPlatform from '@/hooks/common/useIsPlatform';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -53,7 +54,7 @@ export default function useUpdateColumnMutation({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -1,5 +1,6 @@
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -53,7 +54,7 @@ export default function useUpdateRecordMutation<TData extends object = {}>({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -10,7 +10,7 @@ import type {
} from '@/types/dataBrowser';
import { getEmptyDownMigrationMessage } from '@/utils/dataBrowser/hasuraQueryHelpers';
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
import { getHasuraMigrationsApiUrl } from '@/utils/env';
import prepareUpdateTableQuery from './prepareUpdateTableQuery';
export interface UpdateTableMigrationVariables {
@@ -57,7 +57,7 @@ export default async function updateTableMigration({
return;
}
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
method: 'POST',
headers: {
'x-hasura-admin-secret': adminSecret,

View File

@@ -1,6 +1,7 @@
import useIsPlatform from '@/hooks/common/useIsPlatform';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type { MutationOptions } from '@tanstack/react-query';
import { useMutation } from '@tanstack/react-query';
import { useRouter } from 'next/router';
@@ -49,7 +50,7 @@ export default function useUpdateTableMutation({
appUrl: customAppUrl || appUrl,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: customAdminSecret ||
currentApplication?.config?.hasura.adminSecret,
dataSource: customDataSource || (dataSourceSlug as string),

View File

@@ -1,6 +1,7 @@
import type { QueryError, QueryResult } from '@/types/dataBrowser';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
import { isPlatform } from '@/utils/env';
export interface FetchProjectDatabaseSizeOptions {
/**
@@ -32,6 +33,7 @@ export default async function fetchProjectDatabaseSize({
region,
adminSecret,
}: FetchProjectDatabaseSizeOptions): Promise<FetchProjectDatabaseSizeReturnType> {
const IS_PLATFORM = isPlatform();
const response = await fetch(
`${generateAppServiceUrl(subdomain, region, 'hasura')}/v2/query`,
{
@@ -43,7 +45,7 @@ export default async function fetchProjectDatabaseSize({
type: 'run_sql',
args: {
sql: `SELECT pg_database_size('${
subdomain === 'localhost' ? 'postgres' : subdomain
!IS_PLATFORM ? 'postgres' : subdomain
}');`,
},
}),

View File

@@ -1,4 +1,5 @@
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import { getHasuraAdminSecret } from '@/utils/env';
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
import { useQuery } from '@tanstack/react-query';
import type { FetchProjectDatabaseSizeReturnType } from './fetchProjectDatabaseSize';
@@ -21,14 +22,11 @@ export default function useDatabaseSizeOfApplication(
queryKey,
() =>
fetchProjectDatabaseSize({
subdomain:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'localhost'
: currentApplication?.subdomain,
subdomain: currentApplication?.subdomain,
region: currentApplication?.region?.awsName,
adminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: currentApplication?.config?.hasura.adminSecret,
}),
{

View File

@@ -1,7 +1,13 @@
import { LOCAL_SUBDOMAIN } from '@/utils/env';
import {
getAuthServiceUrl,
getFunctionsServiceUrl,
getGraphqlServiceUrl,
getStorageServiceUrl,
} from '@/utils/env';
import { isDevOrStaging } from '@/utils/helpers';
import type { NhostNextClientConstructorParams } from '@nhost/nextjs';
import { NhostClient } from '@nhost/nextjs';
import useIsPlatform from './common/useIsPlatform';
import { useCurrentWorkspaceAndApplication } from './useCurrentWorkspaceAndApplication';
export type UseAppClientOptions = NhostNextClientConstructorParams;
@@ -17,11 +23,22 @@ export type UseAppClientReturn = NhostClient;
export function useAppClient(
options?: UseAppClientOptions,
): UseAppClientReturn {
const isPlatform = useIsPlatform();
const { currentApplication } = useCurrentWorkspaceAndApplication();
if (!isPlatform) {
return new NhostClient({
authUrl: getAuthServiceUrl(),
graphqlUrl: getGraphqlServiceUrl(),
storageUrl: getStorageServiceUrl(),
functionsUrl: getFunctionsServiceUrl(),
...options,
});
}
if (process.env.NEXT_PUBLIC_ENV === 'dev' || !currentApplication) {
return new NhostClient({
subdomain: LOCAL_SUBDOMAIN,
subdomain: 'local',
...options,
});
}

View File

@@ -1,4 +1,7 @@
import { useGetApplicationStateQuery } from '@/generated/graphql';
import {
GetOneUserDocument,
useGetApplicationStateQuery,
} from '@/generated/graphql';
import { ApplicationStatus } from '@/types/application';
import { discordAnnounce } from '@/utils/discordAnnounce';
import { useCallback, useEffect, useState } from 'react';
@@ -30,7 +33,7 @@ export function useCheckProvisioning() {
async function updateOwnCache() {
await client.refetchQueries({
include: ['getOneUser'],
include: [GetOneUserDocument],
});
}

View File

@@ -2,6 +2,7 @@ import { useUserDataContext } from '@/context/workspace1-context';
import type { Project } from '@/types/application';
import { ApplicationStatus } from '@/types/application';
import type { Workspace } from '@/types/workspace';
import { getHasuraAdminSecret } from '@/utils/env';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';
import useIsPlatform from './common/useIsPlatform';
@@ -40,7 +41,7 @@ export function useCurrentWorkspaceAndApplication(): UseCurrentWorkspaceAndAppli
},
],
deployments: [],
subdomain: 'localhost',
subdomain: 'local',
region: {
id: null,
countryCode: null,
@@ -57,7 +58,7 @@ export function useCurrentWorkspaceAndApplication(): UseCurrentWorkspaceAndAppli
plan: null,
config: {
hasura: {
adminSecret: 'nhost-admin-secret',
adminSecret: getHasuraAdminSecret(),
},
},
};

View File

@@ -1,4 +1,5 @@
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import type {
Files_Order_By as FilesOrderBy,
GetFilesQuery,
@@ -92,7 +93,7 @@ export default function useFiles({
headers: {
'x-hasura-admin-secret':
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: currentApplication?.config?.hasura.adminSecret,
},
mode: 'cors',

View File

@@ -11,7 +11,7 @@ export default function useNotFoundRedirect() {
const router = useRouter();
const {
query: { workspaceSlug, appSlug, updating },
} = useRouter();
} = router;
const notIn404Already = router.pathname !== '/404';
const noResolvedWorkspace = workspaceSlug && currentWorkspace === undefined;

View File

@@ -1,5 +1,6 @@
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client';
import { useMemo } from 'react';
@@ -10,30 +11,28 @@ import { useMemo } from 'react';
export function useRemoteApplicationGQLClient() {
const { currentApplication } = useCurrentWorkspaceAndApplication();
const userApplicationClient = useMemo(
() =>
new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({
uri: generateAppServiceUrl(
currentApplication?.subdomain,
currentApplication?.region.awsName,
'graphql',
),
headers: {
'x-hasura-admin-secret':
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
: currentApplication?.config?.hasura.adminSecret,
},
}),
const userApplicationClient = useMemo(() => {
if (!currentApplication) {
return new ApolloClient({ cache: new InMemoryCache() });
}
return new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({
uri: generateAppServiceUrl(
currentApplication?.subdomain,
currentApplication?.region.awsName,
'graphql',
),
headers: {
'x-hasura-admin-secret':
process.env.NEXT_PUBLIC_ENV === 'dev'
? getHasuraAdminSecret()
: currentApplication?.config?.hasura.adminSecret,
},
}),
[
currentApplication?.subdomain,
currentApplication?.region,
currentApplication?.config?.hasura.adminSecret,
],
);
});
}, [currentApplication]);
return userApplicationClient;
}

View File

@@ -1,5 +1,6 @@
import { useWorkspaceContext } from '@/context/workspace-context';
import { useUserDataContext } from '@/context/workspace1-context';
import { getHasuraAdminSecret } from '@/utils/env';
import { useRouter } from 'next/router';
import { useEffect } from 'react';
import { useCurrentWorkspaceAndApplication } from './useCurrentWorkspaceAndApplication';
@@ -39,7 +40,7 @@ export const useSetAppWorkspaceContextFromUserContext = () => {
appIsProvisioned: currentApplication.isProvisioned,
appAdminSecret:
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: currentApplication.config?.hasura.adminSecret,
repository: currentApplication.githubRepository,
provisioning:

Some files were not shown because too many files have changed in this diff Show More