Compare commits

...

102 Commits

Author SHA1 Message Date
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
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ó
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ó
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
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ó
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
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
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
Szilárd Dóró
e88684ff2a Merge branch 'main' into fix/local-urls 2023-02-24 15:41:03 +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ó
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
132 changed files with 1111 additions and 3473 deletions

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

@@ -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

@@ -1,5 +1,63 @@
# @nhost/dashboard
## 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

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

@@ -1,6 +1,6 @@
{
"name": "@nhost/dashboard",
"version": "0.12.3",
"version": "0.13.5",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
@@ -25,8 +25,8 @@
"@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",
@@ -37,7 +37,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 +48,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",

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

@@ -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;

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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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:

View File

@@ -6,6 +6,7 @@ import SettingsContainer from '@/components/settings/SettingsContainer';
import SettingsLayout from '@/components/settings/SettingsLayout';
import { useUI } from '@/context/UIContext';
import {
GetOneUserDocument,
useDeleteApplicationMutation,
useUpdateAppMutation,
} from '@/generated/graphql';
@@ -15,7 +16,6 @@ import { discordAnnounce } from '@/utils/discordAnnounce';
import { slugifyString } from '@/utils/helpers';
import getServerError from '@/utils/settings/getServerError';
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
import { updateOwnCache } from '@/utils/updateOwnCache';
import { useApolloClient } from '@apollo/client';
import { yupResolver } from '@hookform/resolvers/yup';
import { useRouter } from 'next/router';
@@ -42,6 +42,7 @@ export default function SettingsGeneralPage() {
const client = useApolloClient();
const [deleteApplication] = useDeleteApplicationMutation({
variables: { appId: currentApplication?.id },
refetchQueries: [GetOneUserDocument],
});
const { currentWorkspace } = useCurrentWorkspaceAndApplication();
const router = useRouter();
@@ -134,7 +135,6 @@ export default function SettingsGeneralPage() {
getToastStyleProps(),
);
await router.push('/');
await updateOwnCache(client);
};
return (

View File

@@ -4,6 +4,7 @@ import FilesDataGrid from '@/components/files/FilesDataGrid';
import ProjectLayout from '@/components/layout/ProjectLayout';
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import { NhostApolloProvider } from '@nhost/react-apollo';
import type { ReactElement } from 'react';
@@ -25,7 +26,7 @@ export default function StoragePage() {
headers={{
'x-hasura-admin-secret':
process.env.NEXT_PUBLIC_ENV === 'dev'
? 'nhost-admin-secret'
? getHasuraAdminSecret()
: currentApplication.config?.hasura.adminSecret,
}}
>

View File

@@ -553,8 +553,7 @@ export function NewProjectPageContent({
<Text className="font-medium">Warning</Text>{' '}
<Text className="font-medium">
{submitState.error &&
getErrorMessage(submitState.error, 'application')}{' '}
asdsda
getErrorMessage(submitState.error, 'application')}
</Text>
</Alert>
)}

File diff suppressed because it is too large Load Diff

View File

@@ -14,6 +14,13 @@ beforeEach(() => {
process.env = {
NEXT_PUBLIC_NHOST_PLATFORM: 'false',
NEXT_PUBLIC_ENV: 'dev',
NEXT_PUBLIC_NHOST_AUTH_URL: 'https://localdev.nhost.run/v1/auth',
NEXT_PUBLIC_NHOST_FUNCTIONS_URL: 'https://localdev.nhost.run/v1/functions',
NEXT_PUBLIC_NHOST_GRAPHQL_URL: 'https://localdev.nhost.run/v1/graphql',
NEXT_PUBLIC_NHOST_STORAGE_URL: 'https://localdev.nhost.run/v1/storage',
NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL: 'http://localhost:9695',
NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL: 'http://localhost:9693',
NEXT_PUBLIC_NHOST_HASURA_API_URL: 'http://localhost:8080',
...env,
};
});
@@ -73,8 +80,10 @@ test('should generate staging subdomains in staging environment', () => {
});
test('should generate no slug for Hasura neither in local mode nor in remote mode', () => {
process.env.NEXT_PUBLIC_NHOST_HASURA_API_URL = 'http://localhost:8082';
expect(generateAppServiceUrl('test', 'eu-west-1', 'hasura')).toBe(
'http://localhost:1337',
'http://localhost:8082',
);
process.env.NEXT_PUBLIC_NHOST_PLATFORM = 'true';
@@ -91,15 +100,6 @@ test('should generate no slug for Hasura neither in local mode nor in remote mod
);
});
test('should be able to override the default local backend slugs', () => {
expect(
generateAppServiceUrl('test', 'eu-west-1', 'storage', {
...defaultLocalBackendSlugs,
storage: '/v1/storage',
}),
).toBe('http://localhost:1337/v1/storage');
});
test('should be able to override the default remote backend slugs', () => {
process.env.NEXT_PUBLIC_NHOST_PLATFORM = 'true';
process.env.NEXT_PUBLIC_ENV = 'production';
@@ -115,41 +115,59 @@ test('should be able to override the default remote backend slugs', () => {
).toBe('https://test.hasura.eu-west-1.nhost.run/lorem-ipsum');
});
test('should generate a basic subdomain without region in local mode', () => {
expect(generateAppServiceUrl('test', 'eu-west-1', 'auth')).toBe(
`http://localhost:1337/v1/auth`,
test('should construct service URLs based on environment variables', () => {
process.env.NEXT_PUBLIC_NHOST_HASURA_API_URL = 'https://localdev0.nhost.run';
expect(generateAppServiceUrl('test', 'eu-west-1', 'hasura')).toBe(
`https://localdev0.nhost.run`,
);
process.env.NEXT_PUBLIC_NHOST_AUTH_URL =
'https://localdev1.nhost.run/v1/auth';
expect(generateAppServiceUrl('test', 'eu-west-1', 'auth')).toBe(
`https://localdev1.nhost.run/v1/auth`,
);
process.env.NEXT_PUBLIC_NHOST_STORAGE_URL =
'https://localdev2.nhost.run/v1/storage';
expect(generateAppServiceUrl('test', 'eu-west-1', 'storage')).toBe(
'http://localhost:1337/v1/files',
'https://localdev2.nhost.run/v1/storage',
);
process.env.NEXT_PUBLIC_NHOST_GRAPHQL_URL =
'https://localdev3.nhost.run/v1/graphql';
expect(generateAppServiceUrl('test', 'eu-west-1', 'graphql')).toBe(
'http://localhost:1337/v1/graphql',
'https://localdev3.nhost.run/v1/graphql',
);
process.env.NEXT_PUBLIC_NHOST_FUNCTIONS_URL =
'https://localdev4.nhost.run/v1/functions';
expect(generateAppServiceUrl('test', 'eu-west-1', 'functions')).toBe(
'http://localhost:1337/v1/functions',
'https://localdev4.nhost.run/v1/functions',
);
});
test('should generate a basic subdomain with a custom port if provided', () => {
const CUSTOM_BACKEND_PORT = '1338';
process.env.NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT = CUSTOM_BACKEND_PORT;
process.env.NEXT_PUBLIC_NHOST_BACKEND_URL = `http://localhost:1338`;
process.env.NEXT_PUBLIC_NHOST_PLATFORM = 'true';
expect(generateAppServiceUrl('test', 'eu-west-1', 'auth')).toBe(
`http://localhost:${CUSTOM_BACKEND_PORT}/v1/auth`,
`http://localhost:1338/v1/auth`,
);
expect(generateAppServiceUrl('test', 'eu-west-1', 'storage')).toBe(
`http://localhost:${CUSTOM_BACKEND_PORT}/v1/files`,
`http://localhost:1338/v1/files`,
);
expect(generateAppServiceUrl('test', 'eu-west-1', 'graphql')).toBe(
`http://localhost:${CUSTOM_BACKEND_PORT}/v1/graphql`,
`http://localhost:1338/v1/graphql`,
);
expect(generateAppServiceUrl('test', 'eu-west-1', 'functions')).toBe(
`http://localhost:${CUSTOM_BACKEND_PORT}/v1/functions`,
`http://localhost:1338/v1/functions`,
);
});

View File

@@ -1,3 +1,12 @@
import {
getAuthServiceUrl,
getFunctionsServiceUrl,
getGraphqlServiceUrl,
getHasuraApiUrl,
getStorageServiceUrl,
isPlatform,
} from '@/utils/env';
export type NhostService =
| 'auth'
| 'graphql'
@@ -31,7 +40,8 @@ export const defaultRemoteBackendSlugs: Record<NhostService, string> = {
};
/**
* Generates a service specific URL for a project.
* Generates a service specific URL for a project. Provided `subdomain` is
* omitted if the dashboard is running in local mode.
*
* @param subdomain - The project's subdomain
* @param region - The project's region
@@ -47,19 +57,30 @@ export default function generateAppServiceUrl(
localBackendSlugs = defaultLocalBackendSlugs,
remoteBackendSlugs = defaultRemoteBackendSlugs,
) {
if (process.env.NEXT_PUBLIC_NHOST_PLATFORM !== 'true') {
return `http://localhost:${
process.env.NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT || 1337
}${localBackendSlugs[service]}`;
const IS_PLATFORM = isPlatform();
if (!IS_PLATFORM) {
const serviceUrls: Record<typeof service, string> = {
auth: getAuthServiceUrl(),
graphql: getGraphqlServiceUrl(),
storage: getStorageServiceUrl(),
functions: getFunctionsServiceUrl(),
hasura: getHasuraApiUrl(),
};
if (!serviceUrls[service]) {
throw new Error(
`Service URL for "${service}" is not defined. Please check your .env file.`,
);
}
return serviceUrls[service];
}
// This is only used when running the dashboard locally against its own
// backend.
if (process.env.NEXT_PUBLIC_ENV === 'dev') {
return `${
process.env.NEXT_PUBLIC_NHOST_BACKEND_URL ||
`http://localhost:${
process.env.NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT || 1337
}`
}${localBackendSlugs[service]}`;
return `${process.env.NEXT_PUBLIC_NHOST_BACKEND_URL}${localBackendSlugs[service]}`;
}
if (process.env.NEXT_PUBLIC_ENV === 'staging') {

View File

@@ -1,36 +1,92 @@
/**
* URL of Hasura's Migration API. This is only used when local development is
* enabled.
* Determines whether the Nhost Dashboard is running in a cloud environment.
*/
export const LOCAL_MIGRATIONS_URL = `http://localhost:${
process.env.NEXT_PUBLIC_NHOST_LOCAL_MIGRATIONS_PORT || 9693
}`;
/**
* Port of the locally running backend.s
*/
export const LOCAL_BACKEND_PORT =
process.env.NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT;
/**
* Local subdomain. This is only used when local development is enabled.
*/
export const LOCAL_SUBDOMAIN = LOCAL_BACKEND_PORT
? `localhost:${LOCAL_BACKEND_PORT}`
: 'localhost';
/**
* URL of Hasura Console. This is only used when running the Nhost Dashboard
* locally.
*/
export const LOCAL_HASURA_URL = `http://localhost:${
process.env.NEXT_PUBLIC_NHOST_LOCAL_HASURA_PORT || 9695
}`;
export function isPlatform() {
return process.env.NEXT_PUBLIC_NHOST_PLATFORM === 'true';
}
/**
* Backend URL for the locally running instance. This is only used when running
* the Nhost Dashboard locally.
*/
export const LOCAL_BACKEND_URL = `http://localhost:${
process.env.NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT || 1337
}`;
export function getLocalBackendUrl() {
return `http://localhost:${
process.env.NEXT_PUBLIC_NHOST_LOCAL_SERVICES_PORT || '1337'
}`;
}
/**
* Admin secret for Hasura.
*/
export function getHasuraAdminSecret() {
return process.env.NEXT_PUBLIC_NHOST_ADMIN_SECRET || 'nhost-admin-secret';
}
/**
* Custom URL of the Auth service.
*/
export function getAuthServiceUrl() {
return (
process.env.NEXT_PUBLIC_NHOST_AUTH_URL || 'https://local.auth.nhost.run/v1'
);
}
/**
* Custom URL of the GraphQL service.
*/
export function getGraphqlServiceUrl() {
return (
process.env.NEXT_PUBLIC_NHOST_GRAPHQL_URL ||
'https://local.graphql.nhost.run/v1'
);
}
/**
* Custom URL of the Storage service.
*/
export function getStorageServiceUrl() {
return (
process.env.NEXT_PUBLIC_NHOST_STORAGE_URL ||
'https://local.storage.nhost.run/v1'
);
}
/**
* Custom URL of the Functions service.
*/
export function getFunctionsServiceUrl() {
return (
process.env.NEXT_PUBLIC_NHOST_FUNCTIONS_URL ||
'https://local.functions.nhost.run/v1'
);
}
/**
* Custom URL of the Hasura service.
*/
export function getHasuraConsoleServiceUrl() {
return (
process.env.NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL ||
'https://local.hasura.nhost.run'
);
}
/**
* Custom URL of the Hasura Migrations API.
*/
export function getHasuraMigrationsApiUrl() {
return (
process.env.NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL ||
'https://local.hasura.nhost.run/v1/migrations'
);
}
/**
* Custom URL of the Hasura Schema and Metadata API.
*/
export function getHasuraApiUrl() {
return (
process.env.NEXT_PUBLIC_NHOST_HASURA_API_URL ||
'https://local.hasura.nhost.run'
);
}

View File

@@ -1,7 +1,7 @@
import features from '@/data/features.json';
import { ApplicationStatus } from '@/types/application';
import { getLocalBackendUrl } from '@/utils/env';
import slugify from 'slugify';
import { LOCAL_BACKEND_URL } from './env';
import type { DeploymentRowFragment } from './__generated__/graphql';
export function getLastLiveDeployment(deployments?: DeploymentRowFragment[]) {
@@ -57,11 +57,11 @@ export function getCurrentEnvironment(): Environment {
export function generateRemoteAppUrl(subdomain: string): string {
if (process.env.NEXT_PUBLIC_NHOST_PLATFORM !== 'true') {
return LOCAL_BACKEND_URL;
return getLocalBackendUrl();
}
if (process.env.NEXT_PUBLIC_ENV === 'dev') {
return process.env.NEXT_PUBLIC_NHOST_BACKEND_URL || LOCAL_BACKEND_URL;
return process.env.NEXT_PUBLIC_NHOST_BACKEND_URL;
}
if (process.env.NEXT_PUBLIC_ENV === 'staging') {

View File

@@ -1,7 +1,7 @@
import { rest } from 'msw';
const hasuraMetadataQuery = rest.post(
'http://localhost:1337/v1/metadata',
'http://localhost:8080/v1/metadata',
(_req, res, ctx) =>
res(
ctx.delay(250),

View File

@@ -1,7 +1,7 @@
import { rest } from 'msw';
const tableQuery = rest.post(
'http://localhost:1337/v2/query',
'http://localhost:8080/v2/query',
async (req, res, ctx) => {
const body = await req.json();

View File

@@ -1,9 +1,25 @@
import {
getAuthServiceUrl,
getFunctionsServiceUrl,
getGraphqlServiceUrl,
getStorageServiceUrl,
isPlatform,
} from '@/utils/env';
import { NhostClient } from '@nhost/nextjs';
import { LOCAL_SUBDOMAIN } from './env';
export const nhost =
process.env.NEXT_PUBLIC_NHOST_PLATFORM === 'true'
? new NhostClient({ backendUrl: process.env.NEXT_PUBLIC_NHOST_BACKEND_URL })
: new NhostClient({ subdomain: LOCAL_SUBDOMAIN });
// eslint-disable-next-line no-nested-ternary
export const nhost = isPlatform()
? new NhostClient({ backendUrl: process.env.NEXT_PUBLIC_NHOST_BACKEND_URL })
: getAuthServiceUrl() &&
getGraphqlServiceUrl() &&
getStorageServiceUrl() &&
getFunctionsServiceUrl()
? new NhostClient({
authUrl: getAuthServiceUrl(),
graphqlUrl: getGraphqlServiceUrl(),
storageUrl: getStorageServiceUrl(),
functionsUrl: getFunctionsServiceUrl(),
})
: new NhostClient({ subdomain: 'local' });
export default nhost;

View File

@@ -31,6 +31,19 @@ const queryClient = new QueryClient({
},
});
process.env = {
NODE_ENV: 'development',
NEXT_PUBLIC_NHOST_PLATFORM: 'false',
NEXT_PUBLIC_ENV: 'dev',
NEXT_PUBLIC_NHOST_AUTH_URL: 'https://localdev.nhost.run/v1/auth',
NEXT_PUBLIC_NHOST_FUNCTIONS_URL: 'https://localdev.nhost.run/v1/functions',
NEXT_PUBLIC_NHOST_GRAPHQL_URL: 'https://localdev.nhost.run/v1/graphql',
NEXT_PUBLIC_NHOST_STORAGE_URL: 'https://localdev.nhost.run/v1/storage',
NEXT_PUBLIC_NHOST_HASURA_CONSOLE_URL: 'http://localhost:9695',
NEXT_PUBLIC_NHOST_HASURA_MIGRATIONS_API_URL: 'http://localhost:9693',
NEXT_PUBLIC_NHOST_HASURA_API_URL: 'http://localhost:8080',
};
export const mockRouter: NextRouter = {
basePath: '',
pathname: '/',

View File

@@ -1,5 +1,11 @@
# @nhost/docs
## 0.0.14
### Patch Changes
- bfb4c1a6: fix(docs): restore autogenerated `@nhost/nhost-js` docs
## 0.0.13
### Patch Changes

View File

@@ -10,7 +10,7 @@ In this section:
- [Overview](/reference/javascript)
- [Authentication](/reference/javascript/auth)
- [Storage](/reference/javascript/storage)
- [Functions](/reference/javascript/functions)
- [Functions](/reference/javascript/nhost-js/functions)
- [GraphQL](/reference/javascript/graphql)
### React

View File

@@ -1,60 +0,0 @@
---
title: call()
sidebar_label: call()
slug: /reference/javascript/functions/call
description: Use `nhost.functions.call` to call (sending a POST request to) a serverless function.
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/clients/functions/index.ts#L55
---
# `call()`
## Overload 1 of 2
Use `nhost.functions.call` to call (sending a POST request to) a serverless function.
:::caution Deprecated
Axios will be replaced by cross-fetch in the near future. Only the headers configuration will be kept.
:::
### Parameters
---
**<span className="parameter-name">url</span>** <span className="optional-status">required</span> <code>string</code>
---
**<span className="parameter-name">data</span>** <span className="optional-status">optional</span> <code>D</code>
---
**<span className="parameter-name">config</span>** <span className="optional-status">optional</span> <code>AxiosRequestConfig&lt;any&gt; &amp; { useAxios: "true" } &amp; [`NhostFunctionCallConfig`](/reference/javascript/functions/types/nhost-function-call-config) &amp; { useAxios: "true" }</code>
---
## Overload 2 of 2
Use `nhost.functions.call` to call (sending a POST request to) a serverless function.
```ts
await nhost.functions.call('send-welcome-email', {
email: 'joe@example.com',
name: 'Joe Doe'
})
```
### Parameters
---
**<span className="parameter-name">url</span>** <span className="optional-status">required</span> <code>string</code>
---
**<span className="parameter-name">data</span>** <span className="optional-status">required</span> <code>D</code>
---
**<span className="parameter-name">config</span>** <span className="optional-status">optional</span> <code>[`NhostFunctionCallConfig`](/reference/javascript/functions/types/nhost-function-call-config) &amp; { useAxios: "false" }</code>
---

View File

@@ -1,23 +0,0 @@
---
title: setAccessToken()
sidebar_label: setAccessToken()
slug: /reference/javascript/functions/set-access-token
description: Use `nhost.functions.setAccessToken` to a set an access token to be used in subsequent functions requests. Note that if you're signin in users with `nhost.auth.signIn()` the access token will be set automatically.
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/clients/functions/index.ts#L155
---
# `setAccessToken()`
Use `nhost.functions.setAccessToken` to a set an access token to be used in subsequent functions requests. Note that if you're signin in users with `nhost.auth.signIn()` the access token will be set automatically.
```ts
nhost.functions.setAccessToken('some-access-token')
```
## Parameters
---
**<span className="parameter-name">accessToken</span>** <span className="optional-status">required</span> <code>undefined &#124; string</code>
---

View File

@@ -1,22 +0,0 @@
---
title: NhostFunctionsClient
sidebar_label: Functions
description: No description provided.
slug: /reference/javascript/functions
custom_edit_url: https://github.com/nhost/nhost/edit/main/docs/docs/reference/javascript/functions/index.mdx
---
# `NhostFunctionsClient`
## Parameters
---
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`NhostFunctionsConstructorParams`](/reference/javascript/functions/types/nhost-functions-constructor-params)
| Property | Type | Required | Notes |
| :--------------------------------------------------------------------------------------------- | :------------------ | :------: | :---------------------------------------------------------------------------------------- |
| <span className="parameter-name"><span className="light-grey">params.</span>url</span> | <code>string</code> | ✔️ | Serverless Functions endpoint. |
| <span className="parameter-name"><span className="light-grey">params.</span>adminSecret</span> | <code>string</code> | | Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all requests. |
---

View File

@@ -1,19 +0,0 @@
---
title: NhostFunctionCallConfig
sidebar_label: NhostFunctionCallConfig
description: Subset of RequestInit parameters that are supported by the functions client
displayed_sidebar: referenceSidebar
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/clients/functions/types.ts#L41
---
# `NhostFunctionCallConfig`
Subset of RequestInit parameters that are supported by the functions client
## Parameters
---
**<span className="parameter-name">headers</span>** <span className="optional-status">optional</span> <code>Record&lt;string, string&gt;</code>
---

View File

@@ -1,15 +0,0 @@
---
title: NhostFunctionCallResponse
sidebar_label: NhostFunctionCallResponse
description: No description provided.
displayed_sidebar: referenceSidebar
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/clients/functions/types.ts#L15
---
# `NhostFunctionCallResponse`
```ts
type NhostFunctionCallResponse =
| { res: { data: T; status: number; statusText: string }; error: null }
| { res: null; error: ErrorPayload }
```

View File

@@ -1,25 +0,0 @@
---
title: NhostFunctionsConstructorParams
sidebar_label: NhostFunctionsConstructorParams
description: No description provided.
displayed_sidebar: referenceSidebar
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/clients/functions/types.ts#L4
---
# `NhostFunctionsConstructorParams`
## Parameters
---
**<span className="parameter-name">url</span>** <span className="optional-status">required</span> <code>string</code>
Serverless Functions endpoint.
---
**<span className="parameter-name">adminSecret</span>** <span className="optional-status">optional</span> <code>string</code>
Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all requests.
---

View File

@@ -10,7 +10,7 @@ The Nhost JavaScript client is the primary way of interacting with your Nhost pr
- [Authentication](/reference/javascript/auth)
- [Storage](/reference/javascript/storage)
- [Functions](/reference/javascript/functions)
- [Functions](/reference/javascript/nhost-js/functions)
- [GraphQL](/reference/javascript/graphql)
## Installation

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/docs",
"version": "0.0.13",
"version": "0.0.14",
"private": true,
"scripts": {
"docusaurus": "docusaurus",

View File

@@ -111,12 +111,12 @@ const sidebars = {
label: 'Functions',
link: {
type: 'doc',
id: 'reference/javascript/functions/index'
id: 'reference/docgen/javascript/nhost-js/content/nhost-functions-client/index'
},
items: [
{
type: 'autogenerated',
dirName: 'reference/javascript/functions/content'
dirName: 'reference/docgen/javascript/nhost-js/content/nhost-functions-client/content'
}
]
},

View File

@@ -1,5 +1,15 @@
# @nhost-examples/nextjs
## 0.1.8
### Patch Changes
- ce1ee40d: fix(nextjs): allow `subdomain`, `region` and service URLs
- Updated dependencies [ce1ee40d]
- @nhost/nextjs@1.13.16
- @nhost/react@2.0.10
- @nhost/react-apollo@5.0.11
## 0.1.7
### Patch Changes

View File

@@ -1,2 +1 @@
export * from './queries'
export const BACKEND_URL = 'http://127.0.0.1:1337'

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/nextjs",
"version": "0.1.7",
"version": "0.1.8",
"private": true,
"scripts": {
"dev": "next dev",

View File

@@ -6,7 +6,6 @@ import { inspect } from '@xstate/inspect'
import type { AppProps } from 'next/app'
import Head from 'next/head'
import NavBar from '../components/NavBar'
import { BACKEND_URL } from '../helpers'
import '../styles/globals.css?inline'
const devTools = typeof window !== 'undefined' && !!process.env.NEXT_PUBLIC_DEBUG
@@ -16,7 +15,7 @@ if (devTools) {
iframe: false
})
}
const nhost = new NhostClient({ backendUrl: BACKEND_URL, devTools })
const nhost = new NhostClient({ subdomain: 'localhost', devTools })
const title = 'Nhost with NextJs'
function MyApp({ Component, pageProps }: AppProps) {
// * Monorepo-related. See: https://stackoverflow.com/questions/71843247/react-nextjs-type-error-component-cannot-be-used-as-a-jsx-component

View File

@@ -4,10 +4,9 @@ import { Container, Title } from '@mantine/core'
import { getNhostSession, NhostSession, useAccessToken } from '@nhost/nextjs'
import { authProtected } from '../components/protected-route'
import { BACKEND_URL } from '../helpers'
export const getServerSideProps: GetServerSideProps = async (context) => {
const nhostSession = await getNhostSession(BACKEND_URL, context)
const nhostSession = await getNhostSession({ subdomain: 'localhost' }, context)
return {
props: {
nhostSession

View File

@@ -3,10 +3,8 @@ import { GetServerSideProps } from 'next'
import { Container, Title } from '@mantine/core'
import { getNhostSession, NhostSession, useAccessToken, useAuthenticated } from '@nhost/nextjs'
import { BACKEND_URL } from '../helpers'
export const getServerSideProps: GetServerSideProps = async (context) => {
const nhostSession = await getNhostSession(BACKEND_URL, context)
const nhostSession = await getNhostSession({ subdomain: 'localhost' }, context)
return {
props: {
nhostSession

View File

@@ -1,5 +1,32 @@
# @nhost/apollo
## 5.1.1
### Patch Changes
- @nhost/nhost-js@2.1.1
## 5.1.0
### Patch Changes
- Updated dependencies [bfb4c1a6]
- @nhost/nhost-js@2.1.0
## 5.0.9
### Patch Changes
- Updated dependencies [088584e7]
- @nhost/nhost-js@2.0.9
## 5.0.8
### Patch Changes
- Updated dependencies [1d155559]
- @nhost/nhost-js@2.0.8
## 5.0.7
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/apollo",
"version": "5.0.7",
"version": "5.1.1",
"description": "Nhost Apollo Client library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,34 @@
# @nhost/react-apollo
## 5.0.12
### Patch Changes
- @nhost/apollo@5.1.1
- @nhost/react@2.0.11
## 5.0.11
### Patch Changes
- @nhost/apollo@5.1.0
- @nhost/react@2.0.10
## 5.0.10
### Patch Changes
- Updated dependencies [f375eacc]
- @nhost/react@2.0.9
- @nhost/apollo@5.0.9
## 5.0.9
### Patch Changes
- @nhost/apollo@5.0.8
- @nhost/react@2.0.8
## 5.0.8
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-apollo",
"version": "5.0.8",
"version": "5.0.12",
"description": "Nhost React Apollo client",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,30 @@
# @nhost/react-urql
## 2.0.11
### Patch Changes
- @nhost/react@2.0.11
## 2.0.10
### Patch Changes
- @nhost/react@2.0.10
## 2.0.9
### Patch Changes
- Updated dependencies [f375eacc]
- @nhost/react@2.0.9
## 2.0.8
### Patch Changes
- @nhost/react@2.0.8
## 2.0.7
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-urql",
"version": "2.0.7",
"version": "2.0.11",
"description": "Nhost React URQL client",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,11 @@
# @nhost/graphql-js
## 0.1.0
### Minor Changes
- bfb4c1a6: chore(sdk): remove deprecated `useAxios` property
## 0.0.5
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/graphql-js",
"version": "0.0.5",
"version": "0.1.0",
"description": "Nhost GraphQL client",
"license": "MIT",
"keywords": [

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