Compare commits
107 Commits
@nhost/rea
...
@nhost/das
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b6df8b9d6 | ||
|
|
a2af5a674d | ||
|
|
c33c1fd6b9 | ||
|
|
041d9b98e3 | ||
|
|
e4b4940397 | ||
|
|
be91f4ed2a | ||
|
|
ec6ba846cf | ||
|
|
d8d8394b3b | ||
|
|
f051a121b2 | ||
|
|
6ed46ce2d4 | ||
|
|
bfb4c1a6cc | ||
|
|
776c8f9237 | ||
|
|
c0773d82e9 | ||
|
|
c46b1383f2 | ||
|
|
beed2eba21 | ||
|
|
70f9610041 | ||
|
|
e91de1088d | ||
|
|
ce1ee40dab | ||
|
|
bd7929f5ed | ||
|
|
2c8559a319 | ||
|
|
bd5ea5ee3a | ||
|
|
3538dbac39 | ||
|
|
03b5cda69a | ||
|
|
4329d04854 | ||
|
|
ca50c5ce0c | ||
|
|
a3271ed014 | ||
|
|
d4fc99a77c | ||
|
|
d90fcf3c24 | ||
|
|
ee70b226fc | ||
|
|
227ef968e6 | ||
|
|
430b37b2e1 | ||
|
|
124620c33e | ||
|
|
ce3ece1ad7 | ||
|
|
c81002622c | ||
|
|
35fa6bb043 | ||
|
|
a4469a5942 | ||
|
|
b8f11a13d7 | ||
|
|
1d1555593f | ||
|
|
001b3dccec | ||
|
|
6755dfb17b | ||
|
|
2ac90dfdec | ||
|
|
093f3906a4 | ||
|
|
6fb81a27ba | ||
|
|
9be41bf594 | ||
|
|
cbb1fc5bc8 | ||
|
|
99fcc36250 | ||
|
|
7e4a756cfe | ||
|
|
5bf61583e0 | ||
|
|
7eac17a1cb | ||
|
|
a41aeeb9ef | ||
|
|
e33df513ff | ||
|
|
323fd5cbe3 | ||
|
|
0ec3abf47c | ||
|
|
ffb3c426d3 | ||
|
|
889ee6589e | ||
|
|
b00d261916 | ||
|
|
6e05ab4628 | ||
|
|
5223ee9353 | ||
|
|
c8c5ace7cc | ||
|
|
c6a4c28579 | ||
|
|
850a049ca2 | ||
|
|
eff3f0aefd | ||
|
|
2b1338f716 | ||
|
|
2b58c60747 | ||
|
|
369b931689 | ||
|
|
3141ce5b68 | ||
|
|
6b8acd35bd | ||
|
|
44ff6a059f | ||
|
|
e88684ff2a | ||
|
|
892ad66ba1 | ||
|
|
7d577a68b7 | ||
|
|
982059e18e | ||
|
|
02c0586467 | ||
|
|
0753e6529c | ||
|
|
e87a14a3fe | ||
|
|
168616df38 | ||
|
|
d8c45b452d | ||
|
|
adeb2a6d90 | ||
|
|
921243e4d9 | ||
|
|
1c5178f5fb | ||
|
|
72ad9aa8ee | ||
|
|
1b45db8caf | ||
|
|
9ffb4d0295 | ||
|
|
e56340b792 | ||
|
|
814c6d997a | ||
|
|
7d7a352c33 | ||
|
|
53a704fc7d | ||
|
|
c23eddf33d | ||
|
|
d4147f4713 | ||
|
|
f375eaccf5 | ||
|
|
47f79ba9f3 | ||
|
|
2e010455cf | ||
|
|
7e63c822ec | ||
|
|
276b7d48c3 | ||
|
|
6925b0d510 | ||
|
|
6ff306c4e4 | ||
|
|
aa440fefe6 | ||
|
|
9fbafc6654 | ||
|
|
b086175045 | ||
|
|
36db12297b | ||
|
|
e5885d9bad | ||
|
|
15c13f3bbe | ||
|
|
8d47cafd86 | ||
|
|
408cb6d10c | ||
|
|
4d882703f2 | ||
|
|
437dacaa9e | ||
|
|
088584e79d |
2
.github/workflows/changesets.yaml
vendored
2
.github/workflows/changesets.yaml
vendored
@@ -98,7 +98,7 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
- name: Build and push to Docker Hub
|
- name: Build and push to Docker Hub
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v4
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
|||||||
89
.github/workflows/renovate.yaml
vendored
89
.github/workflows/renovate.yaml
vendored
@@ -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 }}
|
|
||||||
@@ -1,8 +1,17 @@
|
|||||||
|
# General Environment Variables
|
||||||
NEXT_PUBLIC_ENV=dev
|
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
|
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_STRIPE_PK=<nhost_stripe_public_key>
|
||||||
NEXT_PUBLIC_GITHUB_APP_INSTALL_URL=<github_app_install_url>
|
NEXT_PUBLIC_GITHUB_APP_INSTALL_URL=<github_app_install_url>
|
||||||
NEXT_PUBLIC_ANALYTICS_WRITE_KEY=<analytics_write_key>
|
NEXT_PUBLIC_ANALYTICS_WRITE_KEY=<analytics_write_key>
|
||||||
|
|||||||
@@ -1,5 +1,60 @@
|
|||||||
# @nhost/dashboard
|
# @nhost/dashboard
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
|
- 2b1338f7: chore(dashboard): bump `turbo` to 1.8.3
|
||||||
|
- 5223ee93: fix(dashboard): show correct deployment status on the main page
|
||||||
|
- 850a049c: chore(deps): update docker/build-push-action action to v4
|
||||||
|
- Updated dependencies [850a049c]
|
||||||
|
- @nhost/nextjs@1.13.13
|
||||||
|
- @nhost/react-apollo@5.0.8
|
||||||
|
|
||||||
## 0.12.2
|
## 0.12.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ RUN apk add --no-cache libc6-compat
|
|||||||
RUN apk update
|
RUN apk update
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN yarn global add turbo@1.6.3
|
RUN yarn global add turbo@1.8.3
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN turbo prune --scope="@nhost/dashboard" --docker
|
RUN turbo prune --scope="@nhost/dashboard" --docker
|
||||||
|
|
||||||
@@ -19,10 +19,15 @@ ENV NEXT_TELEMETRY_DISABLED 1
|
|||||||
ENV NEXT_PUBLIC_ENV dev
|
ENV NEXT_PUBLIC_ENV dev
|
||||||
ENV NEXT_PUBLIC_NHOST_PLATFORM false
|
ENV NEXT_PUBLIC_NHOST_PLATFORM false
|
||||||
|
|
||||||
# placeholders for ports, will be replaced on runtime by entrypoint script
|
# placeholders for URLs, will be replaced on runtime by entrypoint script
|
||||||
ENV NEXT_PUBLIC_NHOST_MIGRATIONS_PORT __NEXT_PUBLIC_NHOST_MIGRATIONS_PORT__
|
ENV NEXT_PUBLIC_NHOST_ADMIN_SECRET __NEXT_PUBLIC_NHOST_ADMIN_SECRET__
|
||||||
ENV NEXT_PUBLIC_NHOST_HASURA_PORT __NEXT_PUBLIC_NHOST_HASURA_PORT__
|
ENV NEXT_PUBLIC_NHOST_AUTH_URL __NEXT_PUBLIC_NHOST_AUTH_URL__
|
||||||
ENV NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT __NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT__
|
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
|
RUN yarn global add pnpm@7.17.0
|
||||||
COPY .gitignore .gitignore
|
COPY .gitignore .gitignore
|
||||||
|
|||||||
@@ -35,8 +35,17 @@ You can connect the Nhost Dashboard to your locally running backend by setting t
|
|||||||
```bash
|
```bash
|
||||||
NEXT_PUBLIC_ENV=dev
|
NEXT_PUBLIC_ENV=dev
|
||||||
NEXT_PUBLIC_NHOST_PLATFORM=false
|
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
|
### Storybook
|
||||||
|
|
||||||
Components are documented using [Storybook](https://storybook.js.org/). To run Storybook, run the following command:
|
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
|
pnpm storybook
|
||||||
```
|
```
|
||||||
|
|
||||||
### Full list of environment variables
|
### General Environment Variables
|
||||||
|
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `NEXT_PUBLIC_ENV` | `dev`, `staging` or `prod`. Should be set to `dev` in most cases. |
|
| `NEXT_PUBLIC_ENV` | `dev`, `staging` or `prod`. This 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_ADMIN_SECRET` | Admin secret for Hasura. Default: `nhost-admin-secret` |
|
||||||
| `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_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` |
|
||||||
| `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` |
|
### Environment Variables for Local Development and Self-Hosting
|
||||||
| `NEXT_PUBLIC_NHOST_BACKEND_URL` | Backend URL. Not necessary for local development. |
|
|
||||||
| `NEXT_PUBLIC_STRIPE_PK` | Stripe public key. Not necessary for local development. |
|
| Name | Description |
|
||||||
| `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_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_MAINTENANCE_ACTIVE` | Determines whether or not maintenance mode is active. |
|
| `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_MAINTENANCE_END_DATE` | Date when maintenance mode will end. |
|
| `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_MAINTENANCE_UNLOCK_SECRET` | Secret that can be used to bypass maintenance mode. |
|
| `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
|
## ESLint Rules
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,25 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -euo pipefail
|
||||||
|
|
||||||
# read ports from env variables or use defaults
|
# read URLs from env variables (with defaults)
|
||||||
NEXT_PUBLIC_NHOST_MIGRATIONS_PORT="${NEXT_PUBLIC_NHOST_MIGRATIONS_PORT:=9693}"
|
NEXT_PUBLIC_NHOST_ADMIN_SECRET="${NEXT_PUBLIC_NHOST_ADMIN_SECRET:-nhost-admin-secret}"
|
||||||
NEXT_PUBLIC_NHOST_HASURA_PORT="${NEXT_PUBLIC_NHOST_HASURA_PORT:=9695}"
|
NEXT_PUBLIC_NHOST_AUTH_URL="${NEXT_PUBLIC_NHOST_AUTH_URL:-http://localhost:1337/v1/auth}"
|
||||||
NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT="${NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT:=1337}"
|
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
|
# 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_ADMIN_SECRET__~${NEXT_PUBLIC_NHOST_ADMIN_SECRET}~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_AUTH_URL__~${NEXT_PUBLIC_NHOST_AUTH_URL}~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_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 "$@"
|
exec "$@"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/dashboard",
|
"name": "@nhost/dashboard",
|
||||||
"version": "0.12.2",
|
"version": "0.13.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "npx only-allow pnpm",
|
"preinstall": "npx only-allow pnpm",
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
"@emotion/styled": "^11.10.5",
|
"@emotion/styled": "^11.10.5",
|
||||||
"@fontsource/inter": "^4.5.14",
|
"@fontsource/inter": "^4.5.14",
|
||||||
"@fontsource/roboto-mono": "^4.5.8",
|
"@fontsource/roboto-mono": "^4.5.8",
|
||||||
"@graphiql/react": "^0.15.0",
|
"@graphiql/react": "^0.17.0",
|
||||||
"@graphiql/toolkit": "^0.8.0",
|
"@graphiql/toolkit": "^0.8.2",
|
||||||
"@headlessui/react": "^1.6.5",
|
"@headlessui/react": "^1.6.5",
|
||||||
"@heroicons/react": "^1.0.6",
|
"@heroicons/react": "^1.0.6",
|
||||||
"@hookform/resolvers": "^2.9.10",
|
"@hookform/resolvers": "^2.9.10",
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
"@nhost/nextjs": "workspace:*",
|
"@nhost/nextjs": "workspace:*",
|
||||||
"@nhost/react-apollo": "workspace:*",
|
"@nhost/react-apollo": "workspace:*",
|
||||||
"@segment/snippet": "^4.15.3",
|
"@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",
|
"@stripe/stripe-js": "^1.35.0",
|
||||||
"@tailwindcss/forms": "^0.5.3",
|
"@tailwindcss/forms": "^0.5.3",
|
||||||
"@tanstack/react-query": "^4.16.1",
|
"@tanstack/react-query": "^4.16.1",
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
"date-fns": "^2.29.3",
|
"date-fns": "^2.29.3",
|
||||||
"generate-password": "^1.7.0",
|
"generate-password": "^1.7.0",
|
||||||
"graphiql": "^2.2.0",
|
"graphiql": "^2.4.0",
|
||||||
"graphql": "^16.6.0",
|
"graphql": "^16.6.0",
|
||||||
"graphql-request": "^4.3.0",
|
"graphql-request": "^4.3.0",
|
||||||
"graphql-tag": "^2.12.6",
|
"graphql-tag": "^2.12.6",
|
||||||
@@ -116,6 +116,7 @@
|
|||||||
"babel-loader": "^8.3.0",
|
"babel-loader": "^8.3.0",
|
||||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
||||||
"csstype": "^3.0.10",
|
"csstype": "^3.0.10",
|
||||||
|
"encoding": "^0.1.13",
|
||||||
"eslint": "^8.28.0",
|
"eslint": "^8.28.0",
|
||||||
"eslint-config-airbnb": "19.0.4",
|
"eslint-config-airbnb": "19.0.4",
|
||||||
"eslint-config-airbnb-typescript": "^17.0.0",
|
"eslint-config-airbnb-typescript": "^17.0.0",
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { useDeleteApplicationMutation } from '@/generated/graphql';
|
import {
|
||||||
|
GetOneUserDocument,
|
||||||
|
useDeleteApplicationMutation,
|
||||||
|
} from '@/generated/graphql';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import Button from '@/ui/v2/Button';
|
import Button from '@/ui/v2/Button';
|
||||||
import ArrowRightIcon from '@/ui/v2/icons/ArrowRightIcon';
|
import ArrowRightIcon from '@/ui/v2/icons/ArrowRightIcon';
|
||||||
@@ -12,7 +15,9 @@ import { useRouter } from 'next/router';
|
|||||||
|
|
||||||
export default function ApplicationInfo() {
|
export default function ApplicationInfo() {
|
||||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||||
const [deleteApplication, { client }] = useDeleteApplicationMutation();
|
const [deleteApplication, { client }] = useDeleteApplicationMutation({
|
||||||
|
refetchQueries: [GetOneUserDocument],
|
||||||
|
});
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
async function handleClickRemove() {
|
async function handleClickRemove() {
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ function Plan({
|
|||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
type="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}
|
onClick={setPlan}
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
>
|
>
|
||||||
<div className="grid grid-flow-row gap-y-0.5">
|
<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
|
<Checkbox
|
||||||
onChange={setPlan}
|
onChange={setPlan}
|
||||||
checked={selectedPlanId === planId}
|
checked={selectedPlanId === planId}
|
||||||
@@ -47,12 +47,13 @@ function Plan({
|
|||||||
<Text
|
<Text
|
||||||
variant="h3"
|
variant="h3"
|
||||||
component="p"
|
component="p"
|
||||||
className="ml-2 self-center font-medium"
|
className="self-center text-left font-medium"
|
||||||
>
|
>
|
||||||
{currentPlan.price > price ? 'Downgrade' : 'Upgrade'} to {planName}
|
{currentPlan.price > price ? 'Downgrade' : 'Upgrade'} to {planName}
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
<Text variant="subtitle2" className="w-64 text-start">
|
|
||||||
|
<Text variant="subtitle2" className="w-full max-w-[256px] text-start">
|
||||||
{planDescriptions[planName]}
|
{planDescriptions[planName]}
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
@@ -142,7 +143,7 @@ export function ChangePlanModalWithData({ app, plans, close }: any) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
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
|
<Modal
|
||||||
showModal={paymentModal}
|
showModal={paymentModal}
|
||||||
close={closePaymentModal}
|
close={closePaymentModal}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import generateAppServiceUrl, {
|
|||||||
defaultRemoteBackendSlugs,
|
defaultRemoteBackendSlugs,
|
||||||
} from '@/utils/common/generateAppServiceUrl';
|
} from '@/utils/common/generateAppServiceUrl';
|
||||||
import { copy } from '@/utils/copy';
|
import { copy } from '@/utils/copy';
|
||||||
import { LOCAL_HASURA_URL } from '@/utils/env';
|
import { getHasuraConsoleServiceUrl } from '@/utils/env';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
|
|
||||||
interface HasuraDataProps {
|
interface HasuraDataProps {
|
||||||
@@ -30,7 +30,7 @@ export function HasuraData({ close }: HasuraDataProps) {
|
|||||||
|
|
||||||
const hasuraUrl =
|
const hasuraUrl =
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev' || !isPlatform
|
process.env.NEXT_PUBLIC_ENV === 'dev' || !isPlatform
|
||||||
? `${LOCAL_HASURA_URL}/console`
|
? `${getHasuraConsoleServiceUrl()}`
|
||||||
: generateAppServiceUrl(
|
: generateAppServiceUrl(
|
||||||
currentApplication?.subdomain,
|
currentApplication?.subdomain,
|
||||||
currentApplication?.region.awsName,
|
currentApplication?.region.awsName,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import DeploymentStatusMessage from '@/components/deployments/DeploymentStatusMessage';
|
||||||
import { FindOldApps } from '@/components/home';
|
import { FindOldApps } from '@/components/home';
|
||||||
import type { UserData } from '@/hooks/useGetAllUserWorkspacesAndApplications';
|
import type { UserData } from '@/hooks/useGetAllUserWorkspacesAndApplications';
|
||||||
import type { ApplicationState } from '@/types/application';
|
import type { ApplicationState } from '@/types/application';
|
||||||
import { ApplicationStatus } from '@/types/application';
|
import { ApplicationStatus } from '@/types/application';
|
||||||
import { Avatar } from '@/ui/Avatar';
|
|
||||||
import StateBadge from '@/ui/StateBadge';
|
import StateBadge from '@/ui/StateBadge';
|
||||||
import type { DeploymentStatus } from '@/ui/StatusCircle';
|
import type { DeploymentStatus } from '@/ui/StatusCircle';
|
||||||
import { StatusCircle } from '@/ui/StatusCircle';
|
import { StatusCircle } from '@/ui/StatusCircle';
|
||||||
@@ -10,59 +10,11 @@ import Divider from '@/ui/v2/Divider';
|
|||||||
import Link from '@/ui/v2/Link';
|
import Link from '@/ui/v2/Link';
|
||||||
import List from '@/ui/v2/List';
|
import List from '@/ui/v2/List';
|
||||||
import { ListItem } from '@/ui/v2/ListItem';
|
import { ListItem } from '@/ui/v2/ListItem';
|
||||||
import Text from '@/ui/v2/Text';
|
|
||||||
import { getApplicationStatusString } from '@/utils/helpers';
|
import { getApplicationStatusString } from '@/utils/helpers';
|
||||||
import { formatDistance } from 'date-fns';
|
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import NavLink from 'next/link';
|
import NavLink from 'next/link';
|
||||||
import { Fragment } from 'react';
|
import { Fragment } from 'react';
|
||||||
|
|
||||||
function ApplicationCreatedAt({ createdAt }: any) {
|
|
||||||
return (
|
|
||||||
<Text component="span" className="text-sm">
|
|
||||||
created{' '}
|
|
||||||
{formatDistance(new Date(createdAt), new Date(), {
|
|
||||||
addSuffix: true,
|
|
||||||
})}
|
|
||||||
</Text>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function LastSuccessfulDeployment({ deployment }: any) {
|
|
||||||
return (
|
|
||||||
<span className="flex flex-row">
|
|
||||||
<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">
|
|
||||||
{deployment.commitUserName} deployed{' '}
|
|
||||||
{formatDistance(new Date(deployment.deploymentEndedAt), new Date(), {
|
|
||||||
addSuffix: true,
|
|
||||||
})}
|
|
||||||
</Text>
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function CurrentDeployment({ deployment }: any) {
|
|
||||||
return (
|
|
||||||
<span className="flex flex-row">
|
|
||||||
<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">
|
|
||||||
{deployment.commitUserName} updated just now
|
|
||||||
</Text>
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function checkStatusOfTheApplication(
|
export function checkStatusOfTheApplication(
|
||||||
stateHistory: ApplicationState[] | [],
|
stateHistory: ApplicationState[] | [],
|
||||||
) {
|
) {
|
||||||
@@ -141,27 +93,23 @@ export function RenderWorkspacesWithApps({
|
|||||||
</NavLink>
|
</NavLink>
|
||||||
<List className="grid grid-flow-row border-y">
|
<List className="grid grid-flow-row border-y">
|
||||||
{workspaceProjects.map((app, index) => {
|
{workspaceProjects.map((app, index) => {
|
||||||
const isDeployingToProduction = app.deployments[0]
|
const [latestDeployment] = app.deployments;
|
||||||
? ['SCHEDULED', 'PENDING', 'DEPLOYING'].includes(
|
|
||||||
app.deployments[0].deploymentStatus,
|
|
||||||
)
|
|
||||||
: false;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment key={app.slug}>
|
<Fragment key={app.slug}>
|
||||||
<ListItem.Root
|
<ListItem.Root
|
||||||
secondaryAction={
|
secondaryAction={
|
||||||
<div className="grid grid-flow-col gap-px">
|
<div className="grid grid-flow-col gap-px">
|
||||||
{app.deployments[0] && (
|
{latestDeployment && (
|
||||||
<div className="mr-2 flex self-center align-middle">
|
<div className="mr-2 flex self-center align-middle">
|
||||||
<StatusCircle
|
<StatusCircle
|
||||||
status={
|
status={
|
||||||
app.deployments[0]
|
latestDeployment.deploymentStatus as DeploymentStatus
|
||||||
.deploymentStatus as DeploymentStatus
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<StateBadge
|
<StateBadge
|
||||||
status={checkStatusOfTheApplication(
|
status={checkStatusOfTheApplication(
|
||||||
app.appStates,
|
app.appStates,
|
||||||
@@ -192,27 +140,10 @@ export function RenderWorkspacesWithApps({
|
|||||||
<ListItem.Text
|
<ListItem.Text
|
||||||
primary={app.name}
|
primary={app.name}
|
||||||
secondary={
|
secondary={
|
||||||
<>
|
<DeploymentStatusMessage
|
||||||
{isDeployingToProduction && (
|
appCreatedAt={app.createdAt}
|
||||||
<CurrentDeployment
|
deployment={latestDeployment}
|
||||||
deployment={app.deployments[0]}
|
/>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!isDeployingToProduction &&
|
|
||||||
app.deployments[0] && (
|
|
||||||
<LastSuccessfulDeployment
|
|
||||||
deployment={app.deployments[0]}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!isDeployingToProduction &&
|
|
||||||
!app.deployments[0] && (
|
|
||||||
<ApplicationCreatedAt
|
|
||||||
createdAt={app.createdAt}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</ListItem.Button>
|
</ListItem.Button>
|
||||||
|
|||||||
@@ -33,11 +33,10 @@ export function UnlockFeatureByUpgrading({
|
|||||||
title: 'Upgrade your plan.',
|
title: 'Upgrade your plan.',
|
||||||
payload: <ChangePlanModal />,
|
payload: <ChangePlanModal />,
|
||||||
props: {
|
props: {
|
||||||
PaperProps: { className: 'p-0' },
|
PaperProps: { className: 'p-0 max-w-xl w-full' },
|
||||||
hidePrimaryAction: true,
|
hidePrimaryAction: true,
|
||||||
hideSecondaryAction: true,
|
hideSecondaryAction: true,
|
||||||
hideTitle: true,
|
hideTitle: true,
|
||||||
maxWidth: 'lg',
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import { useRemoteApplicationGQLClient } from '@/hooks/useRemoteApplicationGQLClient';
|
import { useRemoteApplicationGQLClient } from '@/hooks/useRemoteApplicationGQLClient';
|
||||||
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
|
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
|
||||||
import Option from '@/ui/v2/Option';
|
import Option from '@/ui/v2/Option';
|
||||||
@@ -18,10 +19,12 @@ export interface UserSelectProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
|
export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
|
||||||
|
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||||
const userApplicationClient = useRemoteApplicationGQLClient();
|
const userApplicationClient = useRemoteApplicationGQLClient();
|
||||||
const { data, loading, error } = useRemoteAppGetUsersCustomQuery({
|
const { data, loading, error } = useRemoteAppGetUsersCustomQuery({
|
||||||
client: userApplicationClient,
|
client: userApplicationClient,
|
||||||
variables: { where: {}, limit: 250, offset: 0 },
|
variables: { where: {}, limit: 250, offset: 0 },
|
||||||
|
skip: !currentApplication,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
@@ -36,8 +39,6 @@ export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { users } = data;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
{...props}
|
{...props}
|
||||||
@@ -57,7 +58,7 @@ export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const user: RemoteAppGetUsersCustomQuery['users'][0] = users.find(
|
const user: RemoteAppGetUsersCustomQuery['users'][0] = data?.users.find(
|
||||||
({ id }) => id === userId,
|
({ id }) => id === userId,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ export function UserSelect({ onUserChange, ...props }: UserSelectProps) {
|
|||||||
>
|
>
|
||||||
<Option value="admin">Admin</Option>
|
<Option value="admin">Admin</Option>
|
||||||
|
|
||||||
{users.map(({ id, displayName, email, phoneNumber }) => (
|
{data?.users.map(({ id, displayName, email, phoneNumber }) => (
|
||||||
<Option key={id} value={id}>
|
<Option key={id} value={id}>
|
||||||
{displayName || email || phoneNumber || id}
|
{displayName || email || phoneNumber || id}
|
||||||
</Option>
|
</Option>
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ import {
|
|||||||
import { loadStripe } from '@stripe/stripe-js';
|
import { loadStripe } from '@stripe/stripe-js';
|
||||||
import React, { useState } from 'react';
|
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 = {
|
type AddPaymentMethodFormProps = {
|
||||||
close: () => void;
|
close: () => void;
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ export default function DeploymentListItem({
|
|||||||
return (
|
return (
|
||||||
<ListItem.Root>
|
<ListItem.Root>
|
||||||
<ListItem.Button
|
<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}
|
component={NavLink}
|
||||||
href={`/${currentWorkspace.slug}/${currentApplication.slug}/deployments/${deployment.id}`}
|
href={`/${currentWorkspace.slug}/${currentApplication.slug}/deployments/${deployment.id}`}
|
||||||
aria-label={commitMessage || 'No commit message'}
|
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>
|
<ListItem.Avatar>
|
||||||
<Avatar
|
<Avatar
|
||||||
name={deployment.commitUserName}
|
name={deployment.commitUserName}
|
||||||
@@ -85,7 +85,7 @@ export default function DeploymentListItem({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-flow-col items-center gap-2">
|
<div className="grid grid-flow-col items-center justify-end gap-2">
|
||||||
{showRedeploy && (
|
{showRedeploy && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={
|
title={
|
||||||
@@ -142,16 +142,16 @@ export default function DeploymentListItem({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{isLive && (
|
{isLive && (
|
||||||
<div className="flex w-12 justify-end">
|
<div className="hidden w-12 justify-end sm:flex">
|
||||||
<Chip size="small" color="success" label="Live" />
|
<Chip size="small" color="success" label="Live" />
|
||||||
</div>
|
</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)}
|
{deployment.commitSHA.substring(0, 7)}
|
||||||
</div>
|
</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
|
<AppDeploymentDuration
|
||||||
startedAt={deployment.deploymentStartedAt}
|
startedAt={deployment.deploymentStartedAt}
|
||||||
endedAt={deployment.deploymentEndedAt}
|
endedAt={deployment.deploymentEndedAt}
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
import type { Deployment } from '@/types/application';
|
||||||
|
import { render, screen } from '@/utils/testUtils';
|
||||||
|
import { test, vi } from 'vitest';
|
||||||
|
import DeploymentStatusMessage from './DeploymentStatusMessage';
|
||||||
|
|
||||||
|
const defaultDeployment: Deployment = {
|
||||||
|
id: 'de305d54-75b4-431b-adb2-eb6b9e546013',
|
||||||
|
commitUserName: 'john.doe',
|
||||||
|
commitUserAvatarUrl: 'https://example.com/avatar.png',
|
||||||
|
deploymentStartedAt: '2023-02-24T12:00:00.000Z',
|
||||||
|
deploymentEndedAt: null,
|
||||||
|
deploymentStatus: 'SCHEDULED',
|
||||||
|
commitSHA: '1234567890',
|
||||||
|
commitMessage: 'Update README.md',
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
vi.useFakeTimers();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
vi.useRealTimers();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should render the avatar of the user who deployed the application', () => {
|
||||||
|
render(
|
||||||
|
<DeploymentStatusMessage
|
||||||
|
deployment={defaultDeployment}
|
||||||
|
appCreatedAt="2023-02-24"
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
screen.getByRole('img', {
|
||||||
|
name: `Avatar of ${defaultDeployment.commitUserName}`,
|
||||||
|
}),
|
||||||
|
).toHaveAttribute(
|
||||||
|
'style',
|
||||||
|
`background-image: url(${defaultDeployment.commitUserAvatarUrl});`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should render "updated just now" when the deployment is in progress and has not ended', () => {
|
||||||
|
render(
|
||||||
|
<DeploymentStatusMessage
|
||||||
|
deployment={defaultDeployment}
|
||||||
|
appCreatedAt="2023-02-24"
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(screen.getByText(/updated just now/i)).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should render "updated just now" when the deployment\'s status is DEPLOYED, but it doesn\'t have an end date for some reason', () => {
|
||||||
|
render(
|
||||||
|
<DeploymentStatusMessage
|
||||||
|
deployment={{
|
||||||
|
...defaultDeployment,
|
||||||
|
deploymentStatus: 'DEPLOYED',
|
||||||
|
deploymentEndedAt: null,
|
||||||
|
}}
|
||||||
|
appCreatedAt="2023-02-24"
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(screen.getByText(/updated just now/i)).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should render "deployed 1 day ago" when the deployment has ended', () => {
|
||||||
|
vi.setSystemTime(new Date('2023-02-25T12:25:00.000Z'));
|
||||||
|
|
||||||
|
render(
|
||||||
|
<DeploymentStatusMessage
|
||||||
|
deployment={{
|
||||||
|
...defaultDeployment,
|
||||||
|
deploymentStatus: 'DEPLOYED',
|
||||||
|
deploymentEndedAt: '2023-02-24T12:15:00.000Z',
|
||||||
|
}}
|
||||||
|
appCreatedAt="2023-02-24"
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(screen.getByText(/deployed 1 day ago/i)).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should render "created 1 day ago" if the application does not have a deployment', () => {
|
||||||
|
vi.setSystemTime(new Date('2023-02-25T12:25:00.000Z'));
|
||||||
|
|
||||||
|
render(
|
||||||
|
<DeploymentStatusMessage deployment={null} appCreatedAt="2023-02-24" />,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(screen.getByText(/created 1 day ago/i)).toBeInTheDocument();
|
||||||
|
});
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
import type { Deployment } from '@/types/application';
|
||||||
|
import { Avatar } from '@/ui/Avatar';
|
||||||
|
import Text from '@/ui/v2/Text';
|
||||||
|
import formatDistance from 'date-fns/formatDistance';
|
||||||
|
|
||||||
|
export interface DeploymentStatusMessageProps {
|
||||||
|
/**
|
||||||
|
* The deployment to render the status message for.
|
||||||
|
*/
|
||||||
|
deployment: Partial<Deployment>;
|
||||||
|
/**
|
||||||
|
* The date the application was created.
|
||||||
|
*/
|
||||||
|
appCreatedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function DeploymentStatusMessage({
|
||||||
|
deployment,
|
||||||
|
appCreatedAt,
|
||||||
|
}: DeploymentStatusMessageProps) {
|
||||||
|
const isDeployingToProduction = [
|
||||||
|
'SCHEDULED',
|
||||||
|
'PENDING',
|
||||||
|
'DEPLOYING',
|
||||||
|
].includes(deployment?.deploymentStatus);
|
||||||
|
|
||||||
|
if (
|
||||||
|
isDeployingToProduction ||
|
||||||
|
(deployment && !deployment.deploymentEndedAt)
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
<span className="flex flex-row">
|
||||||
|
<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">
|
||||||
|
{deployment.commitUserName} updated just now
|
||||||
|
</Text>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isDeployingToProduction && deployment?.deploymentEndedAt) {
|
||||||
|
return (
|
||||||
|
<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 truncate text-sm">
|
||||||
|
{deployment.commitUserName} deployed{' '}
|
||||||
|
{formatDistance(new Date(deployment.deploymentEndedAt), new Date(), {
|
||||||
|
addSuffix: true,
|
||||||
|
})}
|
||||||
|
</Text>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Text component="span" className="text-sm">
|
||||||
|
created{' '}
|
||||||
|
{formatDistance(new Date(appCreatedAt), new Date(), {
|
||||||
|
addSuffix: true,
|
||||||
|
})}
|
||||||
|
</Text>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export * from './DeploymentStatusMessage';
|
||||||
|
export { default } from './DeploymentStatusMessage';
|
||||||
@@ -12,6 +12,7 @@ import useBuckets from '@/hooks/useBuckets';
|
|||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import useFiles from '@/hooks/useFiles';
|
import useFiles from '@/hooks/useFiles';
|
||||||
import useFilesAggregate from '@/hooks/useFilesAggregate';
|
import useFilesAggregate from '@/hooks/useFilesAggregate';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import { showLoadingToast, triggerToast } from '@/utils/toast';
|
import { showLoadingToast, triggerToast } from '@/utils/toast';
|
||||||
import type { Files } from '@/utils/__generated__/graphql';
|
import type { Files } from '@/utils/__generated__/graphql';
|
||||||
import { Order_By as OrderBy } 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
|
const { fileMetadata, error: fileError } = await appClient.storage
|
||||||
.setAdminSecret(
|
.setAdminSecret(
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: currentApplication.config?.hasura.adminSecret,
|
: currentApplication.config?.hasura.adminSecret,
|
||||||
)
|
)
|
||||||
.upload({
|
.upload({
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import Button from '@/ui/v2/Button';
|
|||||||
import Chip from '@/ui/v2/Chip';
|
import Chip from '@/ui/v2/Chip';
|
||||||
import type { InputProps } from '@/ui/v2/Input';
|
import type { InputProps } from '@/ui/v2/Input';
|
||||||
import Input from '@/ui/v2/Input';
|
import Input from '@/ui/v2/Input';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import { triggerToast } from '@/utils/toast';
|
import { triggerToast } from '@/utils/toast';
|
||||||
import type { Files } from '@/utils/__generated__/graphql';
|
import type { Files } from '@/utils/__generated__/graphql';
|
||||||
import type { PropsWithoutRef } from 'react';
|
import type { PropsWithoutRef } from 'react';
|
||||||
@@ -71,7 +72,7 @@ export default function FilesDataGridControls({
|
|||||||
try {
|
try {
|
||||||
const storageWithAdminSecret = appClient.storage.setAdminSecret(
|
const storageWithAdminSecret = appClient.storage.setAdminSecret(
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: currentApplication.config?.hasura.adminSecret,
|
: currentApplication.config?.hasura.adminSecret,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ export function InviteAnnounce() {
|
|||||||
workspaceMemberInviteId: inviteId,
|
workspaceMemberInviteId: inviteId,
|
||||||
isAccepted: false,
|
isAccepted: false,
|
||||||
},
|
},
|
||||||
{ useAxios: false },
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ignoreError) {
|
if (ignoreError) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ function OverviewDeploymentList() {
|
|||||||
|
|
||||||
if (!deployments?.length) {
|
if (!deployments?.length) {
|
||||||
return (
|
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
|
<RocketIcon
|
||||||
strokeWidth={1}
|
strokeWidth={1}
|
||||||
className="h-10 w-10"
|
className="h-10 w-10"
|
||||||
@@ -86,7 +86,7 @@ function OverviewDeploymentList() {
|
|||||||
<Text className="text-center font-medium" variant="h3">
|
<Text className="text-center font-medium" variant="h3">
|
||||||
No Deployments
|
No Deployments
|
||||||
</Text>
|
</Text>
|
||||||
<Text variant="subtitle1" className="text-center">
|
<Text variant="subtitle1" className="max-w-md text-center">
|
||||||
We'll deploy changes automatically when you push to the
|
We'll deploy changes automatically when you push to the
|
||||||
deployment branch in your connected GitHub repository
|
deployment branch in your connected GitHub repository
|
||||||
</Text>
|
</Text>
|
||||||
@@ -166,14 +166,14 @@ export default function OverviewDeployments() {
|
|||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<OverviewDeploymentsTopBar />
|
<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" />
|
<RocketIcon strokeWidth={1} className="h-10 w-10" />
|
||||||
|
|
||||||
<div className="grid grid-flow-row gap-1">
|
<div className="grid grid-flow-row gap-1">
|
||||||
<Text className="text-center font-medium" variant="h3">
|
<Text className="text-center font-medium" variant="h3">
|
||||||
No Deployments
|
No Deployments
|
||||||
</Text>
|
</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
|
Connect your project with a GitHub repository to create your first
|
||||||
deployment
|
deployment
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { ChangePlanModal } from '@/components/applications/ChangePlanModal';
|
import { ChangePlanModal } from '@/components/applications/ChangePlanModal';
|
||||||
|
|
||||||
import { useDialog } from '@/components/common/DialogProvider';
|
import { useDialog } from '@/components/common/DialogProvider';
|
||||||
import { useUI } from '@/context/UIContext';
|
import { useUI } from '@/context/UIContext';
|
||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
|
import Box from '@/ui/v2/Box';
|
||||||
import Button from '@/ui/v2/Button';
|
import Button from '@/ui/v2/Button';
|
||||||
import Chip from '@/ui/v2/Chip';
|
import Chip from '@/ui/v2/Chip';
|
||||||
import CogIcon from '@/ui/v2/icons/CogIcon';
|
import CogIcon from '@/ui/v2/icons/CogIcon';
|
||||||
@@ -43,9 +43,9 @@ export default function OverviewTopBar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-row place-content-between items-center py-5">
|
<div className="grid items-center gap-4 pb-5 md:grid-flow-col md:place-content-between md:py-5">
|
||||||
<div className="flex flex-row items-center space-x-2">
|
<div className="grid items-center gap-2 md:grid-flow-col">
|
||||||
<div className="grid grid-flow-col items-center gap-2">
|
<div className="grid grid-flow-col items-center justify-start gap-2">
|
||||||
<div className="h-10 w-10 overflow-hidden rounded-lg">
|
<div className="h-10 w-10 overflow-hidden rounded-lg">
|
||||||
<Image
|
<Image
|
||||||
src="/logos/new.svg"
|
src="/logos/new.svg"
|
||||||
@@ -60,43 +60,44 @@ export default function OverviewTopBar() {
|
|||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isPro ? (
|
<Box className="grid grid-flow-col items-center justify-start gap-2">
|
||||||
<Chip
|
{isPro ? (
|
||||||
className="self-center font-medium"
|
|
||||||
size="small"
|
|
||||||
label="Pro Plan"
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Chip
|
<Chip
|
||||||
className="self-center font-medium"
|
className="self-center font-medium"
|
||||||
size="small"
|
size="small"
|
||||||
label="Free Plan"
|
label="Pro Plan"
|
||||||
color="default"
|
color="primary"
|
||||||
variant="filled"
|
|
||||||
/>
|
/>
|
||||||
<Button
|
) : (
|
||||||
variant="borderless"
|
<>
|
||||||
className="mr-2"
|
<Chip
|
||||||
onClick={() => {
|
className="self-center font-medium"
|
||||||
openAlertDialog({
|
size="small"
|
||||||
title: 'Upgrade your plan.',
|
label="Free Plan"
|
||||||
payload: <ChangePlanModal />,
|
color="default"
|
||||||
props: {
|
variant="filled"
|
||||||
PaperProps: { className: 'p-0' },
|
/>
|
||||||
hidePrimaryAction: true,
|
<Button
|
||||||
hideSecondaryAction: true,
|
variant="borderless"
|
||||||
hideTitle: true,
|
className="mr-2"
|
||||||
maxWidth: 'lg',
|
onClick={() => {
|
||||||
},
|
openAlertDialog({
|
||||||
});
|
title: 'Upgrade your plan.',
|
||||||
}}
|
payload: <ChangePlanModal />,
|
||||||
>
|
props: {
|
||||||
Upgrade
|
PaperProps: { className: 'p-0 max-w-xl w-full' },
|
||||||
</Button>
|
hidePrimaryAction: true,
|
||||||
</>
|
hideSecondaryAction: true,
|
||||||
)}
|
hideTitle: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Upgrade
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
</div>
|
</div>
|
||||||
<Link
|
<Link
|
||||||
href={`/${currentWorkspace.slug}/${currentApplication.slug}/settings/general`}
|
href={`/${currentWorkspace.slug}/${currentApplication.slug}/settings/general`}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ export function OverviewUsageMetrics() {
|
|||||||
const isPlatform = useIsPlatform();
|
const isPlatform = useIsPlatform();
|
||||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||||
const remoteAppClient = useRemoteApplicationGQLClient();
|
const remoteAppClient = useRemoteApplicationGQLClient();
|
||||||
|
|
||||||
const [metrics, setMetrics] = useState({
|
const [metrics, setMetrics] = useState({
|
||||||
functions: 0,
|
functions: 0,
|
||||||
storage: 0,
|
storage: 0,
|
||||||
@@ -98,6 +99,7 @@ export function OverviewUsageMetrics() {
|
|||||||
|
|
||||||
const { data: remoteAppMetricsData } = useGetRemoteAppMetricsQuery({
|
const { data: remoteAppMetricsData } = useGetRemoteAppMetricsQuery({
|
||||||
client: remoteAppClient,
|
client: remoteAppClient,
|
||||||
|
skip: !currentApplication,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import generateAppServiceUrl, {
|
|||||||
defaultLocalBackendSlugs,
|
defaultLocalBackendSlugs,
|
||||||
defaultRemoteBackendSlugs,
|
defaultRemoteBackendSlugs,
|
||||||
} from '@/utils/common/generateAppServiceUrl';
|
} from '@/utils/common/generateAppServiceUrl';
|
||||||
import { LOCAL_HASURA_URL } from '@/utils/env';
|
import { getHasuraConsoleServiceUrl } from '@/utils/env';
|
||||||
import { generateRemoteAppUrl } from '@/utils/helpers';
|
import { generateRemoteAppUrl } from '@/utils/helpers';
|
||||||
import getJwtSecretsWithoutFalsyValues from '@/utils/settings/getJwtSecretsWithoutFalsyValues';
|
import getJwtSecretsWithoutFalsyValues from '@/utils/settings/getJwtSecretsWithoutFalsyValues';
|
||||||
import { useGetEnvironmentVariablesQuery } from '@/utils/__generated__/graphql';
|
import { useGetEnvironmentVariablesQuery } from '@/utils/__generated__/graphql';
|
||||||
@@ -109,7 +109,7 @@ export default function SystemEnvironmentVariableSettings() {
|
|||||||
key: 'NHOST_HASURA_URL',
|
key: 'NHOST_HASURA_URL',
|
||||||
value:
|
value:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev' || !isPlatform
|
process.env.NEXT_PUBLIC_ENV === 'dev' || !isPlatform
|
||||||
? `${LOCAL_HASURA_URL}/console`
|
? `${getHasuraConsoleServiceUrl()}/console`
|
||||||
: generateAppServiceUrl(
|
: generateAppServiceUrl(
|
||||||
currentApplication?.subdomain,
|
currentApplication?.subdomain,
|
||||||
currentApplication?.region.awsName,
|
currentApplication?.region.awsName,
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ export function Avatar({
|
|||||||
<Box
|
<Box
|
||||||
style={Object.assign(style, { backgroundImage: `url(${avatarUrl})` })}
|
style={Object.assign(style, { backgroundImage: `url(${avatarUrl})` })}
|
||||||
className={classes}
|
className={classes}
|
||||||
aria-label="Avatar"
|
aria-label={name ? `Avatar of ${name}` : 'Avatar'}
|
||||||
|
role="img"
|
||||||
{...rest}
|
{...rest}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -21,14 +21,17 @@ export default function createTheme(mode: PaletteMode) {
|
|||||||
},
|
},
|
||||||
h2: {
|
h2: {
|
||||||
fontSize: '1.625rem',
|
fontSize: '1.625rem',
|
||||||
|
lineHeight: '2.375rem',
|
||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
},
|
},
|
||||||
h3: {
|
h3: {
|
||||||
fontSize: '1.125rem',
|
fontSize: '1.125rem',
|
||||||
|
lineHeight: '1.5rem',
|
||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
},
|
},
|
||||||
h4: {
|
h4: {
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
|
lineHeight: '1.375rem',
|
||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
},
|
},
|
||||||
subtitle1: {
|
subtitle1: {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ export function WorkspaceInvoices() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mt-18">
|
<div className="mt-18">
|
||||||
<div className="mx-auto max-w-3xl font-display grid grid-flow-row gap-2 justify-start">
|
<div className="mx-auto grid max-w-3xl grid-flow-row justify-start gap-2 font-display">
|
||||||
<Text className="font-medium text-lg">Invoices</Text>
|
<Text className="text-lg font-medium">Invoices</Text>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
@@ -23,7 +23,6 @@ export function WorkspaceInvoices() {
|
|||||||
const { res, error } = await nhost.functions.call(
|
const { res, error } = await nhost.functions.call(
|
||||||
'/stripe-create-portal',
|
'/stripe-create-portal',
|
||||||
{ workspaceId: currentWorkspace.id },
|
{ workspaceId: currentWorkspace.id },
|
||||||
{ useAxios: false },
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
fragment GetAppRoles on apps {
|
|
||||||
id
|
|
||||||
slug
|
|
||||||
subdomain
|
|
||||||
name
|
|
||||||
authUserDefaultAllowedRoles
|
|
||||||
authUserDefaultRole
|
|
||||||
}
|
|
||||||
|
|
||||||
query getAppRolesAndPermissions($id: uuid!) {
|
|
||||||
app(id: $id) {
|
|
||||||
...GetAppRoles
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
query getGravatarSettings($id: uuid!) {
|
|
||||||
app(id: $id) {
|
|
||||||
authGravatarEnabled
|
|
||||||
authGravatarDefault
|
|
||||||
authGravatarRating
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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)
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
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';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7,12 +8,19 @@ import { useQuery } from '@tanstack/react-query';
|
|||||||
*/
|
*/
|
||||||
export default function useIsHealthy() {
|
export default function useIsHealthy() {
|
||||||
const isPlatform = useIsPlatform();
|
const isPlatform = useIsPlatform();
|
||||||
const client = useNhostClient();
|
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||||
|
|
||||||
|
const appUrl = generateAppServiceUrl(
|
||||||
|
currentApplication?.subdomain,
|
||||||
|
currentApplication?.region?.awsName,
|
||||||
|
'auth',
|
||||||
|
);
|
||||||
|
|
||||||
const { failureCount, status } = useQuery(
|
const { failureCount, status } = useQuery(
|
||||||
['/healthz'],
|
['/healthz'],
|
||||||
() => fetch(`${client.auth.url}/healthz`),
|
() => fetch(`${appUrl}/healthz`),
|
||||||
{
|
{
|
||||||
enabled: !isPlatform,
|
enabled: !isPlatform && !!currentApplication,
|
||||||
retry: true,
|
retry: true,
|
||||||
retryDelay: 5000,
|
retryDelay: 5000,
|
||||||
cacheTime: 0,
|
cacheTime: 0,
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
import { isPlatform } from '@/utils/env';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns `true` if all features of the dashboard should be enabled.
|
* Returns `true` if all features of the dashboard should be enabled.
|
||||||
*/
|
*/
|
||||||
export default function useIsPlatform() {
|
export default function useIsPlatform() {
|
||||||
return process.env.NEXT_PUBLIC_NHOST_PLATFORM === 'true';
|
return isPlatform();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import type {
|
|||||||
} from '@/types/dataBrowser';
|
} from '@/types/dataBrowser';
|
||||||
import { getPreparedHasuraQuery } from '@/utils/dataBrowser/hasuraQueryHelpers';
|
import { getPreparedHasuraQuery } from '@/utils/dataBrowser/hasuraQueryHelpers';
|
||||||
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
||||||
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
|
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||||
import prepareCreateColumnQuery from './prepareCreateColumnQuery';
|
import prepareCreateColumnQuery from './prepareCreateColumnQuery';
|
||||||
|
|
||||||
export interface CreateColumnMigrationVariables {
|
export interface CreateColumnMigrationVariables {
|
||||||
@@ -34,7 +34,7 @@ export default async function createColumnMigration({
|
|||||||
column,
|
column,
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
|
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'x-hasura-admin-secret': adminSecret,
|
'x-hasura-admin-secret': adminSecret,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -52,7 +53,7 @@ export default function useCreateColumnMutation({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -53,7 +54,7 @@ export default function useCreateRecordMutation<TData extends object = {}>({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import type {
|
|||||||
} from '@/types/dataBrowser';
|
} from '@/types/dataBrowser';
|
||||||
import { getPreparedHasuraQuery } from '@/utils/dataBrowser/hasuraQueryHelpers';
|
import { getPreparedHasuraQuery } from '@/utils/dataBrowser/hasuraQueryHelpers';
|
||||||
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
||||||
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
|
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||||
import prepareCreateTableQuery from './prepareCreateTableQuery';
|
import prepareCreateTableQuery from './prepareCreateTableQuery';
|
||||||
|
|
||||||
export interface CreateTableMigrationVariables {
|
export interface CreateTableMigrationVariables {
|
||||||
@@ -28,7 +28,7 @@ export default async function createTableMigration({
|
|||||||
}: CreateTableMigrationOptions & CreateTableMigrationVariables) {
|
}: CreateTableMigrationOptions & CreateTableMigrationVariables) {
|
||||||
const args = prepareCreateTableQuery({ dataSource, schema, table });
|
const args = prepareCreateTableQuery({ dataSource, schema, table });
|
||||||
|
|
||||||
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
|
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'x-hasura-admin-secret': adminSecret,
|
'x-hasura-admin-secret': adminSecret,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -50,7 +51,7 @@ export default function useCreateTableMutation({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -51,7 +52,7 @@ export default function useDatabaseQuery(
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import type {
|
|||||||
} from '@/types/dataBrowser';
|
} from '@/types/dataBrowser';
|
||||||
import { getPreparedHasuraQuery } from '@/utils/dataBrowser/hasuraQueryHelpers';
|
import { getPreparedHasuraQuery } from '@/utils/dataBrowser/hasuraQueryHelpers';
|
||||||
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
||||||
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
|
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||||
|
|
||||||
export interface DeleteColumnMigrationVariables {
|
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',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'x-hasura-admin-secret': adminSecret,
|
'x-hasura-admin-secret': adminSecret,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -53,7 +54,7 @@ export default function useDeleteColumnMutation({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -49,7 +50,7 @@ export default function useDeleteRecordMutation({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
getPreparedHasuraQuery,
|
getPreparedHasuraQuery,
|
||||||
} from '@/utils/dataBrowser/hasuraQueryHelpers';
|
} from '@/utils/dataBrowser/hasuraQueryHelpers';
|
||||||
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
||||||
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
|
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||||
|
|
||||||
export interface DeleteTableMigrationVariables {
|
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',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'x-hasura-admin-secret': adminSecret,
|
'x-hasura-admin-secret': adminSecret,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -48,7 +49,7 @@ export default function useDeleteTableMutation({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import type {
|
|||||||
QueryResult,
|
QueryResult,
|
||||||
} from '@/types/dataBrowser';
|
} from '@/types/dataBrowser';
|
||||||
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
||||||
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
|
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||||
|
|
||||||
export interface ManagePermissionMigrationVariables {
|
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',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'x-hasura-admin-secret': adminSecret,
|
'x-hasura-admin-secret': adminSecret,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -56,7 +57,7 @@ export default function useManagePermissionMutation({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -53,7 +54,7 @@ export default function useMetadataQuery(
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -53,7 +54,7 @@ export default function useTableQuery(
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type {
|
|||||||
QueryResult,
|
QueryResult,
|
||||||
} from '@/types/dataBrowser';
|
} from '@/types/dataBrowser';
|
||||||
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
||||||
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
|
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||||
import prepareTrackForeignKeyRelationsMetadata from './prepareTrackForeignKeyRelationsMetadata';
|
import prepareTrackForeignKeyRelationsMetadata from './prepareTrackForeignKeyRelationsMetadata';
|
||||||
|
|
||||||
export interface TrackForeignKeyRelationsMigrationVariables {
|
export interface TrackForeignKeyRelationsMigrationVariables {
|
||||||
@@ -46,7 +46,7 @@ export default async function trackForeignKeyRelationsMigration({
|
|||||||
foreignKeyRelations,
|
foreignKeyRelations,
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
|
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'x-hasura-admin-secret': adminSecret,
|
'x-hasura-admin-secret': adminSecret,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -50,7 +51,7 @@ export default function useTrackForeignKeyRelationMutation({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type {
|
|||||||
QueryResult,
|
QueryResult,
|
||||||
} from '@/types/dataBrowser';
|
} from '@/types/dataBrowser';
|
||||||
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
||||||
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
|
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||||
|
|
||||||
export interface TrackTableMigrationVariables {
|
export interface TrackTableMigrationVariables {
|
||||||
/**
|
/**
|
||||||
@@ -24,7 +24,7 @@ export default async function trackTableMigration({
|
|||||||
adminSecret,
|
adminSecret,
|
||||||
table,
|
table,
|
||||||
}: TrackTableMigrationOptions & TrackTableMigrationVariables) {
|
}: TrackTableMigrationOptions & TrackTableMigrationVariables) {
|
||||||
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
|
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'x-hasura-admin-secret': adminSecret,
|
'x-hasura-admin-secret': adminSecret,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -48,7 +49,7 @@ export default function useTrackTableMutation({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import type {
|
|||||||
} from '@/types/dataBrowser';
|
} from '@/types/dataBrowser';
|
||||||
import { getEmptyDownMigrationMessage } from '@/utils/dataBrowser/hasuraQueryHelpers';
|
import { getEmptyDownMigrationMessage } from '@/utils/dataBrowser/hasuraQueryHelpers';
|
||||||
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
||||||
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
|
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||||
import prepareUpdateColumnQuery from './prepareUpdateColumnQuery';
|
import prepareUpdateColumnQuery from './prepareUpdateColumnQuery';
|
||||||
|
|
||||||
export interface UpdateColumnMigrationVariables {
|
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',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'x-hasura-admin-secret': adminSecret,
|
'x-hasura-admin-secret': adminSecret,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -53,7 +54,7 @@ export default function useUpdateColumnMutation({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -53,7 +54,7 @@ export default function useUpdateRecordMutation<TData extends object = {}>({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import type {
|
|||||||
} from '@/types/dataBrowser';
|
} from '@/types/dataBrowser';
|
||||||
import { getEmptyDownMigrationMessage } from '@/utils/dataBrowser/hasuraQueryHelpers';
|
import { getEmptyDownMigrationMessage } from '@/utils/dataBrowser/hasuraQueryHelpers';
|
||||||
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
||||||
import { LOCAL_MIGRATIONS_URL } from '@/utils/env';
|
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||||
import prepareUpdateTableQuery from './prepareUpdateTableQuery';
|
import prepareUpdateTableQuery from './prepareUpdateTableQuery';
|
||||||
|
|
||||||
export interface UpdateTableMigrationVariables {
|
export interface UpdateTableMigrationVariables {
|
||||||
@@ -57,7 +57,7 @@ export default async function updateTableMigration({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(`${LOCAL_MIGRATIONS_URL}/apis/migrate`, {
|
const response = await fetch(`${getHasuraMigrationsApiUrl()}/apis/migrate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'x-hasura-admin-secret': adminSecret,
|
'x-hasura-admin-secret': adminSecret,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
import useIsPlatform from '@/hooks/common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { MutationOptions } from '@tanstack/react-query';
|
import type { MutationOptions } from '@tanstack/react-query';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -49,7 +50,7 @@ export default function useUpdateTableMutation({
|
|||||||
appUrl: customAppUrl || appUrl,
|
appUrl: customAppUrl || appUrl,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: customAdminSecret ||
|
: customAdminSecret ||
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
currentApplication?.config?.hasura.adminSecret,
|
||||||
dataSource: customDataSource || (dataSourceSlug as string),
|
dataSource: customDataSource || (dataSourceSlug as string),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { QueryError, QueryResult } from '@/types/dataBrowser';
|
import type { QueryError, QueryResult } from '@/types/dataBrowser';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
import normalizeQueryError from '@/utils/dataBrowser/normalizeQueryError';
|
||||||
|
import { isPlatform } from '@/utils/env';
|
||||||
|
|
||||||
export interface FetchProjectDatabaseSizeOptions {
|
export interface FetchProjectDatabaseSizeOptions {
|
||||||
/**
|
/**
|
||||||
@@ -32,6 +33,7 @@ export default async function fetchProjectDatabaseSize({
|
|||||||
region,
|
region,
|
||||||
adminSecret,
|
adminSecret,
|
||||||
}: FetchProjectDatabaseSizeOptions): Promise<FetchProjectDatabaseSizeReturnType> {
|
}: FetchProjectDatabaseSizeOptions): Promise<FetchProjectDatabaseSizeReturnType> {
|
||||||
|
const IS_PLATFORM = isPlatform();
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${generateAppServiceUrl(subdomain, region, 'hasura')}/v2/query`,
|
`${generateAppServiceUrl(subdomain, region, 'hasura')}/v2/query`,
|
||||||
{
|
{
|
||||||
@@ -43,7 +45,7 @@ export default async function fetchProjectDatabaseSize({
|
|||||||
type: 'run_sql',
|
type: 'run_sql',
|
||||||
args: {
|
args: {
|
||||||
sql: `SELECT pg_database_size('${
|
sql: `SELECT pg_database_size('${
|
||||||
subdomain === 'localhost' ? 'postgres' : subdomain
|
!IS_PLATFORM ? 'postgres' : subdomain
|
||||||
}');`,
|
}');`,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import type { FetchProjectDatabaseSizeReturnType } from './fetchProjectDatabaseSize';
|
import type { FetchProjectDatabaseSizeReturnType } from './fetchProjectDatabaseSize';
|
||||||
@@ -21,14 +22,11 @@ export default function useDatabaseSizeOfApplication(
|
|||||||
queryKey,
|
queryKey,
|
||||||
() =>
|
() =>
|
||||||
fetchProjectDatabaseSize({
|
fetchProjectDatabaseSize({
|
||||||
subdomain:
|
subdomain: currentApplication?.subdomain,
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
|
||||||
? 'localhost'
|
|
||||||
: currentApplication?.subdomain,
|
|
||||||
region: currentApplication?.region?.awsName,
|
region: currentApplication?.region?.awsName,
|
||||||
adminSecret:
|
adminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: currentApplication?.config?.hasura.adminSecret,
|
: currentApplication?.config?.hasura.adminSecret,
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
import { LOCAL_SUBDOMAIN } from '@/utils/env';
|
import {
|
||||||
|
getAuthServiceUrl,
|
||||||
|
getFunctionsServiceUrl,
|
||||||
|
getGraphqlServiceUrl,
|
||||||
|
getStorageServiceUrl,
|
||||||
|
} from '@/utils/env';
|
||||||
import { isDevOrStaging } from '@/utils/helpers';
|
import { isDevOrStaging } from '@/utils/helpers';
|
||||||
import type { NhostNextClientConstructorParams } from '@nhost/nextjs';
|
import type { NhostNextClientConstructorParams } from '@nhost/nextjs';
|
||||||
import { NhostClient } from '@nhost/nextjs';
|
import { NhostClient } from '@nhost/nextjs';
|
||||||
|
import useIsPlatform from './common/useIsPlatform';
|
||||||
import { useCurrentWorkspaceAndApplication } from './useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from './useCurrentWorkspaceAndApplication';
|
||||||
|
|
||||||
export type UseAppClientOptions = NhostNextClientConstructorParams;
|
export type UseAppClientOptions = NhostNextClientConstructorParams;
|
||||||
@@ -17,11 +23,22 @@ export type UseAppClientReturn = NhostClient;
|
|||||||
export function useAppClient(
|
export function useAppClient(
|
||||||
options?: UseAppClientOptions,
|
options?: UseAppClientOptions,
|
||||||
): UseAppClientReturn {
|
): UseAppClientReturn {
|
||||||
|
const isPlatform = useIsPlatform();
|
||||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
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) {
|
if (process.env.NEXT_PUBLIC_ENV === 'dev' || !currentApplication) {
|
||||||
return new NhostClient({
|
return new NhostClient({
|
||||||
subdomain: LOCAL_SUBDOMAIN,
|
subdomain: 'local',
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { useGetApplicationStateQuery } from '@/generated/graphql';
|
import {
|
||||||
|
GetOneUserDocument,
|
||||||
|
useGetApplicationStateQuery,
|
||||||
|
} from '@/generated/graphql';
|
||||||
import { ApplicationStatus } from '@/types/application';
|
import { ApplicationStatus } from '@/types/application';
|
||||||
import { discordAnnounce } from '@/utils/discordAnnounce';
|
import { discordAnnounce } from '@/utils/discordAnnounce';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
@@ -30,7 +33,7 @@ export function useCheckProvisioning() {
|
|||||||
|
|
||||||
async function updateOwnCache() {
|
async function updateOwnCache() {
|
||||||
await client.refetchQueries({
|
await client.refetchQueries({
|
||||||
include: ['getOneUser'],
|
include: [GetOneUserDocument],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useUserDataContext } from '@/context/workspace1-context';
|
|||||||
import type { Project } from '@/types/application';
|
import type { Project } from '@/types/application';
|
||||||
import { ApplicationStatus } from '@/types/application';
|
import { ApplicationStatus } from '@/types/application';
|
||||||
import type { Workspace } from '@/types/workspace';
|
import type { Workspace } from '@/types/workspace';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import useIsPlatform from './common/useIsPlatform';
|
import useIsPlatform from './common/useIsPlatform';
|
||||||
@@ -40,7 +41,7 @@ export function useCurrentWorkspaceAndApplication(): UseCurrentWorkspaceAndAppli
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
deployments: [],
|
deployments: [],
|
||||||
subdomain: 'localhost',
|
subdomain: 'local',
|
||||||
region: {
|
region: {
|
||||||
id: null,
|
id: null,
|
||||||
countryCode: null,
|
countryCode: null,
|
||||||
@@ -57,7 +58,7 @@ export function useCurrentWorkspaceAndApplication(): UseCurrentWorkspaceAndAppli
|
|||||||
plan: null,
|
plan: null,
|
||||||
config: {
|
config: {
|
||||||
hasura: {
|
hasura: {
|
||||||
adminSecret: 'nhost-admin-secret',
|
adminSecret: getHasuraAdminSecret(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import type {
|
import type {
|
||||||
Files_Order_By as FilesOrderBy,
|
Files_Order_By as FilesOrderBy,
|
||||||
GetFilesQuery,
|
GetFilesQuery,
|
||||||
@@ -92,7 +93,7 @@ export default function useFiles({
|
|||||||
headers: {
|
headers: {
|
||||||
'x-hasura-admin-secret':
|
'x-hasura-admin-secret':
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: currentApplication?.config?.hasura.adminSecret,
|
: currentApplication?.config?.hasura.adminSecret,
|
||||||
},
|
},
|
||||||
mode: 'cors',
|
mode: 'cors',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client';
|
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
@@ -10,30 +11,28 @@ import { useMemo } from 'react';
|
|||||||
export function useRemoteApplicationGQLClient() {
|
export function useRemoteApplicationGQLClient() {
|
||||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||||
|
|
||||||
const userApplicationClient = useMemo(
|
const userApplicationClient = useMemo(() => {
|
||||||
() =>
|
if (!currentApplication) {
|
||||||
new ApolloClient({
|
return new ApolloClient({ cache: new InMemoryCache() });
|
||||||
cache: new InMemoryCache(),
|
}
|
||||||
link: new HttpLink({
|
|
||||||
uri: generateAppServiceUrl(
|
return new ApolloClient({
|
||||||
currentApplication?.subdomain,
|
cache: new InMemoryCache(),
|
||||||
currentApplication?.region.awsName,
|
link: new HttpLink({
|
||||||
'graphql',
|
uri: generateAppServiceUrl(
|
||||||
),
|
currentApplication?.subdomain,
|
||||||
headers: {
|
currentApplication?.region.awsName,
|
||||||
'x-hasura-admin-secret':
|
'graphql',
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
),
|
||||||
? 'nhost-admin-secret'
|
headers: {
|
||||||
: currentApplication?.config?.hasura.adminSecret,
|
'x-hasura-admin-secret':
|
||||||
},
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
}),
|
? getHasuraAdminSecret()
|
||||||
|
: currentApplication?.config?.hasura.adminSecret,
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
[
|
});
|
||||||
currentApplication?.subdomain,
|
}, [currentApplication]);
|
||||||
currentApplication?.region,
|
|
||||||
currentApplication?.config?.hasura.adminSecret,
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
return userApplicationClient;
|
return userApplicationClient;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useWorkspaceContext } from '@/context/workspace-context';
|
import { useWorkspaceContext } from '@/context/workspace-context';
|
||||||
import { useUserDataContext } from '@/context/workspace1-context';
|
import { useUserDataContext } from '@/context/workspace1-context';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useCurrentWorkspaceAndApplication } from './useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from './useCurrentWorkspaceAndApplication';
|
||||||
@@ -39,7 +40,7 @@ export const useSetAppWorkspaceContextFromUserContext = () => {
|
|||||||
appIsProvisioned: currentApplication.isProvisioned,
|
appIsProvisioned: currentApplication.isProvisioned,
|
||||||
appAdminSecret:
|
appAdminSecret:
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: currentApplication.config?.hasura.adminSecret,
|
: currentApplication.config?.hasura.adminSecret,
|
||||||
repository: currentApplication.githubRepository,
|
repository: currentApplication.githubRepository,
|
||||||
provisioning:
|
provisioning:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import SettingsContainer from '@/components/settings/SettingsContainer';
|
|||||||
import SettingsLayout from '@/components/settings/SettingsLayout';
|
import SettingsLayout from '@/components/settings/SettingsLayout';
|
||||||
import { useUI } from '@/context/UIContext';
|
import { useUI } from '@/context/UIContext';
|
||||||
import {
|
import {
|
||||||
|
GetOneUserDocument,
|
||||||
useDeleteApplicationMutation,
|
useDeleteApplicationMutation,
|
||||||
useUpdateAppMutation,
|
useUpdateAppMutation,
|
||||||
} from '@/generated/graphql';
|
} from '@/generated/graphql';
|
||||||
@@ -15,7 +16,6 @@ import { discordAnnounce } from '@/utils/discordAnnounce';
|
|||||||
import { slugifyString } from '@/utils/helpers';
|
import { slugifyString } from '@/utils/helpers';
|
||||||
import getServerError from '@/utils/settings/getServerError';
|
import getServerError from '@/utils/settings/getServerError';
|
||||||
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
|
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
|
||||||
import { updateOwnCache } from '@/utils/updateOwnCache';
|
|
||||||
import { useApolloClient } from '@apollo/client';
|
import { useApolloClient } from '@apollo/client';
|
||||||
import { yupResolver } from '@hookform/resolvers/yup';
|
import { yupResolver } from '@hookform/resolvers/yup';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
@@ -42,6 +42,7 @@ export default function SettingsGeneralPage() {
|
|||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
const [deleteApplication] = useDeleteApplicationMutation({
|
const [deleteApplication] = useDeleteApplicationMutation({
|
||||||
variables: { appId: currentApplication?.id },
|
variables: { appId: currentApplication?.id },
|
||||||
|
refetchQueries: [GetOneUserDocument],
|
||||||
});
|
});
|
||||||
const { currentWorkspace } = useCurrentWorkspaceAndApplication();
|
const { currentWorkspace } = useCurrentWorkspaceAndApplication();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -134,7 +135,6 @@ export default function SettingsGeneralPage() {
|
|||||||
getToastStyleProps(),
|
getToastStyleProps(),
|
||||||
);
|
);
|
||||||
await router.push('/');
|
await router.push('/');
|
||||||
await updateOwnCache(client);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import FilesDataGrid from '@/components/files/FilesDataGrid';
|
|||||||
import ProjectLayout from '@/components/layout/ProjectLayout';
|
import ProjectLayout from '@/components/layout/ProjectLayout';
|
||||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||||
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
import generateAppServiceUrl from '@/utils/common/generateAppServiceUrl';
|
||||||
|
import { getHasuraAdminSecret } from '@/utils/env';
|
||||||
import { NhostApolloProvider } from '@nhost/react-apollo';
|
import { NhostApolloProvider } from '@nhost/react-apollo';
|
||||||
import type { ReactElement } from 'react';
|
import type { ReactElement } from 'react';
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ export default function StoragePage() {
|
|||||||
headers={{
|
headers={{
|
||||||
'x-hasura-admin-secret':
|
'x-hasura-admin-secret':
|
||||||
process.env.NEXT_PUBLIC_ENV === 'dev'
|
process.env.NEXT_PUBLIC_ENV === 'dev'
|
||||||
? 'nhost-admin-secret'
|
? getHasuraAdminSecret()
|
||||||
: currentApplication.config?.hasura.adminSecret,
|
: currentApplication.config?.hasura.adminSecret,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -553,8 +553,7 @@ export function NewProjectPageContent({
|
|||||||
<Text className="font-medium">Warning</Text>{' '}
|
<Text className="font-medium">Warning</Text>{' '}
|
||||||
<Text className="font-medium">
|
<Text className="font-medium">
|
||||||
{submitState.error &&
|
{submitState.error &&
|
||||||
getErrorMessage(submitState.error, 'application')}{' '}
|
getErrorMessage(submitState.error, 'application')}
|
||||||
asdsda
|
|
||||||
</Text>
|
</Text>
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
|||||||
2771
dashboard/src/utils/__generated__/graphql.ts
generated
2771
dashboard/src/utils/__generated__/graphql.ts
generated
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,13 @@ beforeEach(() => {
|
|||||||
process.env = {
|
process.env = {
|
||||||
NEXT_PUBLIC_NHOST_PLATFORM: 'false',
|
NEXT_PUBLIC_NHOST_PLATFORM: 'false',
|
||||||
NEXT_PUBLIC_ENV: 'dev',
|
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,
|
...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', () => {
|
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(
|
expect(generateAppServiceUrl('test', 'eu-west-1', 'hasura')).toBe(
|
||||||
'http://localhost:1337',
|
'http://localhost:8082',
|
||||||
);
|
);
|
||||||
|
|
||||||
process.env.NEXT_PUBLIC_NHOST_PLATFORM = 'true';
|
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', () => {
|
test('should be able to override the default remote backend slugs', () => {
|
||||||
process.env.NEXT_PUBLIC_NHOST_PLATFORM = 'true';
|
process.env.NEXT_PUBLIC_NHOST_PLATFORM = 'true';
|
||||||
process.env.NEXT_PUBLIC_ENV = 'production';
|
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');
|
).toBe('https://test.hasura.eu-west-1.nhost.run/lorem-ipsum');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should generate a basic subdomain without region in local mode', () => {
|
test('should construct service URLs based on environment variables', () => {
|
||||||
expect(generateAppServiceUrl('test', 'eu-west-1', 'auth')).toBe(
|
process.env.NEXT_PUBLIC_NHOST_HASURA_API_URL = 'https://localdev0.nhost.run';
|
||||||
`http://localhost:1337/v1/auth`,
|
|
||||||
|
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(
|
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(
|
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(
|
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', () => {
|
test('should generate a basic subdomain with a custom port if provided', () => {
|
||||||
const CUSTOM_BACKEND_PORT = '1338';
|
process.env.NEXT_PUBLIC_NHOST_BACKEND_URL = `http://localhost:1338`;
|
||||||
process.env.NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT = CUSTOM_BACKEND_PORT;
|
process.env.NEXT_PUBLIC_NHOST_PLATFORM = 'true';
|
||||||
|
|
||||||
expect(generateAppServiceUrl('test', 'eu-west-1', 'auth')).toBe(
|
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(
|
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(
|
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(
|
expect(generateAppServiceUrl('test', 'eu-west-1', 'functions')).toBe(
|
||||||
`http://localhost:${CUSTOM_BACKEND_PORT}/v1/functions`,
|
`http://localhost:1338/v1/functions`,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
import {
|
||||||
|
getAuthServiceUrl,
|
||||||
|
getFunctionsServiceUrl,
|
||||||
|
getGraphqlServiceUrl,
|
||||||
|
getHasuraApiUrl,
|
||||||
|
getStorageServiceUrl,
|
||||||
|
isPlatform,
|
||||||
|
} from '@/utils/env';
|
||||||
|
|
||||||
export type NhostService =
|
export type NhostService =
|
||||||
| 'auth'
|
| 'auth'
|
||||||
| 'graphql'
|
| '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 subdomain - The project's subdomain
|
||||||
* @param region - The project's region
|
* @param region - The project's region
|
||||||
@@ -47,19 +57,30 @@ export default function generateAppServiceUrl(
|
|||||||
localBackendSlugs = defaultLocalBackendSlugs,
|
localBackendSlugs = defaultLocalBackendSlugs,
|
||||||
remoteBackendSlugs = defaultRemoteBackendSlugs,
|
remoteBackendSlugs = defaultRemoteBackendSlugs,
|
||||||
) {
|
) {
|
||||||
if (process.env.NEXT_PUBLIC_NHOST_PLATFORM !== 'true') {
|
const IS_PLATFORM = isPlatform();
|
||||||
return `http://localhost:${
|
|
||||||
process.env.NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT || 1337
|
if (!IS_PLATFORM) {
|
||||||
}${localBackendSlugs[service]}`;
|
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') {
|
if (process.env.NEXT_PUBLIC_ENV === 'dev') {
|
||||||
return `${
|
return `${process.env.NEXT_PUBLIC_NHOST_BACKEND_URL}${localBackendSlugs[service]}`;
|
||||||
process.env.NEXT_PUBLIC_NHOST_BACKEND_URL ||
|
|
||||||
`http://localhost:${
|
|
||||||
process.env.NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT || 1337
|
|
||||||
}`
|
|
||||||
}${localBackendSlugs[service]}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.NEXT_PUBLIC_ENV === 'staging') {
|
if (process.env.NEXT_PUBLIC_ENV === 'staging') {
|
||||||
|
|||||||
@@ -1,36 +1,92 @@
|
|||||||
/**
|
/**
|
||||||
* URL of Hasura's Migration API. This is only used when local development is
|
* Determines whether the Nhost Dashboard is running in a cloud environment.
|
||||||
* enabled.
|
|
||||||
*/
|
*/
|
||||||
export const LOCAL_MIGRATIONS_URL = `http://localhost:${
|
export function isPlatform() {
|
||||||
process.env.NEXT_PUBLIC_NHOST_LOCAL_MIGRATIONS_PORT || 9693
|
return process.env.NEXT_PUBLIC_NHOST_PLATFORM === 'true';
|
||||||
}`;
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
}`;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backend URL for the locally running instance. This is only used when running
|
* Backend URL for the locally running instance. This is only used when running
|
||||||
* the Nhost Dashboard locally.
|
* the Nhost Dashboard locally.
|
||||||
*/
|
*/
|
||||||
export const LOCAL_BACKEND_URL = `http://localhost:${
|
export function getLocalBackendUrl() {
|
||||||
process.env.NEXT_PUBLIC_NHOST_LOCAL_BACKEND_PORT || 1337
|
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'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import features from '@/data/features.json';
|
import features from '@/data/features.json';
|
||||||
import { ApplicationStatus } from '@/types/application';
|
import { ApplicationStatus } from '@/types/application';
|
||||||
|
import { getLocalBackendUrl } from '@/utils/env';
|
||||||
import slugify from 'slugify';
|
import slugify from 'slugify';
|
||||||
import { LOCAL_BACKEND_URL } from './env';
|
|
||||||
import type { DeploymentRowFragment } from './__generated__/graphql';
|
import type { DeploymentRowFragment } from './__generated__/graphql';
|
||||||
|
|
||||||
export function getLastLiveDeployment(deployments?: DeploymentRowFragment[]) {
|
export function getLastLiveDeployment(deployments?: DeploymentRowFragment[]) {
|
||||||
@@ -57,11 +57,11 @@ export function getCurrentEnvironment(): Environment {
|
|||||||
|
|
||||||
export function generateRemoteAppUrl(subdomain: string): string {
|
export function generateRemoteAppUrl(subdomain: string): string {
|
||||||
if (process.env.NEXT_PUBLIC_NHOST_PLATFORM !== 'true') {
|
if (process.env.NEXT_PUBLIC_NHOST_PLATFORM !== 'true') {
|
||||||
return LOCAL_BACKEND_URL;
|
return getLocalBackendUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.NEXT_PUBLIC_ENV === 'dev') {
|
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') {
|
if (process.env.NEXT_PUBLIC_ENV === 'staging') {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { rest } from 'msw';
|
import { rest } from 'msw';
|
||||||
|
|
||||||
const hasuraMetadataQuery = rest.post(
|
const hasuraMetadataQuery = rest.post(
|
||||||
'http://localhost:1337/v1/metadata',
|
'http://localhost:8080/v1/metadata',
|
||||||
(_req, res, ctx) =>
|
(_req, res, ctx) =>
|
||||||
res(
|
res(
|
||||||
ctx.delay(250),
|
ctx.delay(250),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { rest } from 'msw';
|
import { rest } from 'msw';
|
||||||
|
|
||||||
const tableQuery = rest.post(
|
const tableQuery = rest.post(
|
||||||
'http://localhost:1337/v2/query',
|
'http://localhost:8080/v2/query',
|
||||||
async (req, res, ctx) => {
|
async (req, res, ctx) => {
|
||||||
const body = await req.json();
|
const body = await req.json();
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,25 @@
|
|||||||
|
import {
|
||||||
|
getAuthServiceUrl,
|
||||||
|
getFunctionsServiceUrl,
|
||||||
|
getGraphqlServiceUrl,
|
||||||
|
getStorageServiceUrl,
|
||||||
|
isPlatform,
|
||||||
|
} from '@/utils/env';
|
||||||
import { NhostClient } from '@nhost/nextjs';
|
import { NhostClient } from '@nhost/nextjs';
|
||||||
import { LOCAL_SUBDOMAIN } from './env';
|
|
||||||
|
|
||||||
export const nhost =
|
// eslint-disable-next-line no-nested-ternary
|
||||||
process.env.NEXT_PUBLIC_NHOST_PLATFORM === 'true'
|
export const nhost = isPlatform()
|
||||||
? new NhostClient({ backendUrl: process.env.NEXT_PUBLIC_NHOST_BACKEND_URL })
|
? new NhostClient({ backendUrl: process.env.NEXT_PUBLIC_NHOST_BACKEND_URL })
|
||||||
: new NhostClient({ subdomain: LOCAL_SUBDOMAIN });
|
: getAuthServiceUrl() &&
|
||||||
|
getGraphqlServiceUrl() &&
|
||||||
|
getStorageServiceUrl() &&
|
||||||
|
getFunctionsServiceUrl()
|
||||||
|
? new NhostClient({
|
||||||
|
authUrl: getAuthServiceUrl(),
|
||||||
|
graphqlUrl: getGraphqlServiceUrl(),
|
||||||
|
storageUrl: getStorageServiceUrl(),
|
||||||
|
functionsUrl: getFunctionsServiceUrl(),
|
||||||
|
})
|
||||||
|
: new NhostClient({ subdomain: 'local' });
|
||||||
|
|
||||||
export default nhost;
|
export default nhost;
|
||||||
|
|||||||
@@ -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 = {
|
export const mockRouter: NextRouter = {
|
||||||
basePath: '',
|
basePath: '',
|
||||||
pathname: '/',
|
pathname: '/',
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @nhost/docs
|
# @nhost/docs
|
||||||
|
|
||||||
|
## 0.0.14
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- bfb4c1a6: fix(docs): restore autogenerated `@nhost/nhost-js` docs
|
||||||
|
|
||||||
## 0.0.13
|
## 0.0.13
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ In this section:
|
|||||||
- [Overview](/reference/javascript)
|
- [Overview](/reference/javascript)
|
||||||
- [Authentication](/reference/javascript/auth)
|
- [Authentication](/reference/javascript/auth)
|
||||||
- [Storage](/reference/javascript/storage)
|
- [Storage](/reference/javascript/storage)
|
||||||
- [Functions](/reference/javascript/functions)
|
- [Functions](/reference/javascript/nhost-js/functions)
|
||||||
- [GraphQL](/reference/javascript/graphql)
|
- [GraphQL](/reference/javascript/graphql)
|
||||||
|
|
||||||
### React
|
### React
|
||||||
|
|||||||
@@ -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<any> & { useAxios: "true" } & [`NhostFunctionCallConfig`](/reference/javascript/functions/types/nhost-function-call-config) & { 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) & { useAxios: "false" }</code>
|
|
||||||
|
|
||||||
---
|
|
||||||
@@ -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 | string</code>
|
|
||||||
|
|
||||||
---
|
|
||||||
@@ -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. |
|
|
||||||
|
|
||||||
---
|
|
||||||
@@ -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<string, string></code>
|
|
||||||
|
|
||||||
---
|
|
||||||
@@ -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 }
|
|
||||||
```
|
|
||||||
@@ -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.
|
|
||||||
|
|
||||||
---
|
|
||||||
@@ -10,7 +10,7 @@ The Nhost JavaScript client is the primary way of interacting with your Nhost pr
|
|||||||
|
|
||||||
- [Authentication](/reference/javascript/auth)
|
- [Authentication](/reference/javascript/auth)
|
||||||
- [Storage](/reference/javascript/storage)
|
- [Storage](/reference/javascript/storage)
|
||||||
- [Functions](/reference/javascript/functions)
|
- [Functions](/reference/javascript/nhost-js/functions)
|
||||||
- [GraphQL](/reference/javascript/graphql)
|
- [GraphQL](/reference/javascript/graphql)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/docs",
|
"name": "@nhost/docs",
|
||||||
"version": "0.0.13",
|
"version": "0.0.14",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docusaurus": "docusaurus",
|
"docusaurus": "docusaurus",
|
||||||
|
|||||||
@@ -111,12 +111,12 @@ const sidebars = {
|
|||||||
label: 'Functions',
|
label: 'Functions',
|
||||||
link: {
|
link: {
|
||||||
type: 'doc',
|
type: 'doc',
|
||||||
id: 'reference/javascript/functions/index'
|
id: 'reference/docgen/javascript/nhost-js/content/nhost-functions-client/index'
|
||||||
},
|
},
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
type: 'autogenerated',
|
type: 'autogenerated',
|
||||||
dirName: 'reference/javascript/functions/content'
|
dirName: 'reference/docgen/javascript/nhost-js/content/nhost-functions-client/content'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
# @nhost-examples/nextjs
|
# @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
|
## 0.1.7
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
export * from './queries'
|
export * from './queries'
|
||||||
export const BACKEND_URL = 'http://127.0.0.1:1337'
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost-examples/nextjs",
|
"name": "@nhost-examples/nextjs",
|
||||||
"version": "0.1.7",
|
"version": "0.1.8",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { inspect } from '@xstate/inspect'
|
|||||||
import type { AppProps } from 'next/app'
|
import type { AppProps } from 'next/app'
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import NavBar from '../components/NavBar'
|
import NavBar from '../components/NavBar'
|
||||||
import { BACKEND_URL } from '../helpers'
|
|
||||||
import '../styles/globals.css?inline'
|
import '../styles/globals.css?inline'
|
||||||
|
|
||||||
const devTools = typeof window !== 'undefined' && !!process.env.NEXT_PUBLIC_DEBUG
|
const devTools = typeof window !== 'undefined' && !!process.env.NEXT_PUBLIC_DEBUG
|
||||||
@@ -16,7 +15,7 @@ if (devTools) {
|
|||||||
iframe: false
|
iframe: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const nhost = new NhostClient({ backendUrl: BACKEND_URL, devTools })
|
const nhost = new NhostClient({ subdomain: 'localhost', devTools })
|
||||||
const title = 'Nhost with NextJs'
|
const title = 'Nhost with NextJs'
|
||||||
function MyApp({ Component, pageProps }: AppProps) {
|
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
|
// * Monorepo-related. See: https://stackoverflow.com/questions/71843247/react-nextjs-type-error-component-cannot-be-used-as-a-jsx-component
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ import { Container, Title } from '@mantine/core'
|
|||||||
import { getNhostSession, NhostSession, useAccessToken } from '@nhost/nextjs'
|
import { getNhostSession, NhostSession, useAccessToken } from '@nhost/nextjs'
|
||||||
|
|
||||||
import { authProtected } from '../components/protected-route'
|
import { authProtected } from '../components/protected-route'
|
||||||
import { BACKEND_URL } from '../helpers'
|
|
||||||
|
|
||||||
export const getServerSideProps: GetServerSideProps = async (context) => {
|
export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||||
const nhostSession = await getNhostSession(BACKEND_URL, context)
|
const nhostSession = await getNhostSession({ subdomain: 'localhost' }, context)
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
nhostSession
|
nhostSession
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ import { GetServerSideProps } from 'next'
|
|||||||
import { Container, Title } from '@mantine/core'
|
import { Container, Title } from '@mantine/core'
|
||||||
import { getNhostSession, NhostSession, useAccessToken, useAuthenticated } from '@nhost/nextjs'
|
import { getNhostSession, NhostSession, useAccessToken, useAuthenticated } from '@nhost/nextjs'
|
||||||
|
|
||||||
import { BACKEND_URL } from '../helpers'
|
|
||||||
|
|
||||||
export const getServerSideProps: GetServerSideProps = async (context) => {
|
export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||||
const nhostSession = await getNhostSession(BACKEND_URL, context)
|
const nhostSession = await getNhostSession({ subdomain: 'localhost' }, context)
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
nhostSession
|
nhostSession
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
# @nhost-examples/vue-quickstart
|
# @nhost-examples/vue-quickstart
|
||||||
|
|
||||||
|
## 0.0.8
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 850a049c: chore(deps): update docker/build-push-action action to v4
|
||||||
|
- Updated dependencies [7eac17a1]
|
||||||
|
- Updated dependencies [850a049c]
|
||||||
|
- @nhost/vue@1.13.13
|
||||||
|
- @nhost/apollo@5.0.7
|
||||||
|
|
||||||
## 0.0.7
|
## 0.0.7
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost-examples/vue-quickstart",
|
"name": "@nhost-examples/vue-quickstart",
|
||||||
"version": "0.0.7",
|
"version": "0.0.8",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
|
|||||||
@@ -1,5 +1,34 @@
|
|||||||
# @nhost/apollo
|
# @nhost/apollo
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
|
- 850a049c: chore(deps): update docker/build-push-action action to v4
|
||||||
|
- Updated dependencies [850a049c]
|
||||||
|
- @nhost/nhost-js@2.0.7
|
||||||
|
|
||||||
## 5.0.6
|
## 5.0.6
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nhost/apollo",
|
"name": "@nhost/apollo",
|
||||||
"version": "5.0.6",
|
"version": "5.1.0",
|
||||||
"description": "Nhost Apollo Client library",
|
"description": "Nhost Apollo Client library",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user