Compare commits

...

68 Commits

Author SHA1 Message Date
github-actions[bot]
fdc50b32d8 chore: update versions (#2484)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/apollo@6.0.2

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/nhost-js@3.0.2

## @nhost/google-translation@0.0.7

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit

## @nhost/react-apollo@7.0.2

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/apollo@6.0.2
    -   @nhost/react@3.0.2

## @nhost/react-urql@4.0.2

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/react@3.0.2

## @nhost/stripe-graphql-js@1.0.6

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit

## @nhost/graphql-js@0.1.5

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit

## @nhost/hasura-auth-js@2.1.11

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit

## @nhost/hasura-storage-js@2.2.6

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit

## @nhost/nextjs@2.0.2

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/react@3.0.2

## @nhost/nhost-js@3.0.2

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/hasura-storage-js@2.2.6
    -   @nhost/hasura-auth-js@2.1.11
    -   @nhost/graphql-js@0.1.5

## @nhost/react@3.0.2

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/nhost-js@3.0.2

## @nhost/vue@2.0.3

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/nhost-js@3.0.2

## @nhost/dashboard@1.6.1

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
- 3b8473b: chore: update turbo to `1.11.3` and pnpm to `8.10.5` in
Dockerfile
-   Updated dependencies [8d91f71]
    -   @nhost/react-apollo@7.0.2
    -   @nhost/nextjs@2.0.2

## @nhost-examples/cli@0.1.3

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/nhost-js@3.0.2

## @nhost-examples/codegen-react-apollo@0.1.11

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/react-apollo@7.0.2
    -   @nhost/react@3.0.2

## @nhost-examples/codegen-react-query@0.1.12

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/react@3.0.2

## @nhost-examples/codegen-react-urql@0.0.8

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/react-urql@4.0.2
    -   @nhost/react@3.0.2

## @nhost-examples/docker-compose@0.0.7

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit

## @nhost-examples/multi-tenant-one-to-many@2.0.1

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/nhost-js@3.0.2

## @nhost-examples/nextjs@0.1.13

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/react-apollo@7.0.2
    -   @nhost/nextjs@2.0.2
    -   @nhost/react@3.0.2

## @nhost-examples/node-storage@0.0.5

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/nhost-js@3.0.2

## @nhost-examples/nextjs-server-components@0.1.5

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/nhost-js@3.0.2

## @nhost-examples/sveltekit@0.2.2

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit

## @nhost-examples/react-apollo@0.1.18

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/react-apollo@7.0.2
    -   @nhost/react@3.0.2

## @nhost-examples/react-gqty@1.0.1

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/react@3.0.2

## @nhost-examples/serverless-functions@0.0.10

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/stripe-graphql-js@1.0.6

## @nhost-examples/vue-apollo@0.0.10

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/apollo@6.0.2
    -   @nhost/nhost-js@3.0.2
    -   @nhost/vue@2.0.3

## @nhost-examples/vue-quickstart@0.0.10

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit
-   Updated dependencies [8d91f71]
    -   @nhost/apollo@6.0.2
    -   @nhost/vue@2.0.3

## @nhost/docgen@0.1.12

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit

## @nhost/sync-versions@0.0.9

### Patch Changes

-   8d91f71: chore: update deps and enable pnpm audit

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hassan Ben Jobrane <hsanbenjobrane@gmail.com>
2024-01-23 20:04:39 +01:00
Hassan Ben Jobrane
3cdca8d4b3 chore: update sveltekit pnpm-lockl.yaml (#2485) 2024-01-23 19:18:44 +01:00
Hassan Ben Jobrane
c425c9f265 fix(quickstarts): use turbo to build nextjs-server-components and fix sveltekit lockfile (#2483) 2024-01-23 18:53:21 +01:00
Hassan Ben Jobrane
3b8473b168 chore: update pnpm and turbo versions in Dockerfile (#2482) 2024-01-23 16:51:14 +01:00
David Barroso
8d91f7103f chore: update deps and enable pnpm audit (#2466)
Co-authored-by: Hassan Ben Jobrane <hsanbenjobrane@gmail.com>
2024-01-23 13:58:48 +01:00
github-actions[bot]
11ce93d64b chore: update versions (#2478)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/dashboard@1.6.0

### Minor Changes

-   3ff1c2b53: fix: show upgrade option for pro projects

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-22 15:08:49 -01:00
Nuno Pato
3ff1c2b531 fix: dashboard: show upgrade option to pro projects (#2477) 2024-01-22 15:03:33 -01:00
github-actions[bot]
e4341c3706 chore: update versions (#2462)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/dashboard@1.5.0

### Minor Changes

-   c2ef17c0a: feat: add support for new Team plan

## @nhost/docs@2.1.0

### Minor Changes

-   65b6a48d5: feat: added graphite/cli documentation

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-22 11:31:49 -01:00
Nuno Pato
c2ef17c0a0 feat: dashboard: new Team plan (#2473) 2024-01-22 11:13:26 -01:00
David Barroso
1045ea0a46 fix(docs): set correct hostname for connecting to run service internally (#2471) 2024-01-17 12:34:01 +01:00
Nevada Le Master
5faaf36e26 chore: add maskedErrors param to CreateServerProps (#2129)
this PR addresses https://github.com/nhost/nhost/issues/1218, adding
`maskedErrors` param when creating Stripe and Google Translate GraphQL
Yoga servers

Co-authored-by: David Barroso <dbarrosop@dravetech.com>
2024-01-16 16:36:51 +01:00
David Barroso
65b6a48d51 feat(docs): added graphite/cli documentation (#2457)
Co-authored-by: Nuno Pato <nunopato@gmail.com>
2024-01-10 17:19:58 +01:00
github-actions[bot]
23e18fb734 chore: update versions (#2454)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/docs@2.0.0

### Major Changes

-   6d08b3430: New Docs powered by Mintlify

## @nhost/dashboard@1.4.0

### Minor Changes

-   7883bbcbd: feat: don't show deprecated plans
- 44be6dc0a: feat: set redirectTo during sign-in to support preview
environments

### Patch Changes

- 3c3594898: fix: allow access to graphite when configured running in
local dashboard
-   32c246b7a: chore: update docs icon

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-10 14:59:31 +01:00
David Barroso
44be6dc0a5 feat (dashboard): set redirectTo during sign-in with twitter to support preview environments (#2461)
Co-authored-by: Hassan Ben Jobrane <hsanbenjobrane@gmail.com>
2024-01-10 14:48:58 +01:00
Hassan Ben Jobrane
3c35948986 fix: refactor plan check when accessing ai services (#2456)
fixes https://github.com/nhost/nhost/issues/2455
2024-01-10 12:47:34 +01:00
David Barroso
7883bbcbd1 feat (dashboard): don't show deprecated plans (#2458) 2024-01-09 16:36:27 +01:00
Nuno Pato
42fddcf790 Merge pull request #2425 from nhost/docs/new-version
chore(docs): new docs
2024-01-09 14:29:15 -01:00
Nuno Pato
5d1a444451 asd 2024-01-09 14:03:36 -01:00
Nuno Pato
98d17a3066 asd 2024-01-09 12:42:14 -01:00
Nuno Pato
f70f36be08 asd 2024-01-09 11:06:13 -01:00
Nuno Pato
50fe08624f Merge branch 'main' into docs/new-version 2024-01-09 10:16:04 -01:00
Nuno Pato
6cb7dd8203 asd 2024-01-08 23:45:49 -01:00
Hassan Ben Jobrane
f859159ef5 Merge pull request #2453 from nhost/chore/update-docs-icon
chore(dashboard): update docs icon
2024-01-08 15:14:37 +01:00
Hassan Ben Jobrane
32c246b7a9 chore: add changeset 2024-01-08 11:24:35 +01:00
Hassan Ben Jobrane
f004fd067a chore: update docs icons 2024-01-08 11:24:03 +01:00
David Barroso
82340b5d54 remove migration step from ai guide (#2450) 2024-01-06 13:05:41 +01:00
Nuno Pato
8fff3e06bd asd 2024-01-05 14:54:40 -01:00
Nuno Pato
527a661222 asd 2024-01-05 14:47:46 -01:00
Nestor Manrique
93f573ea98 Merge pull request #2443 from nhost/feat/docs-for-run-services-health-checks
feat(docs): for run services health checks
2024-01-03 10:51:09 +01:00
Nestor Manrique
ac78629414 Remove vscode settings json 2024-01-03 10:23:47 +01:00
Nestor Manrique
3403744c22 wip 2024-01-03 10:09:02 +01:00
Nuno Pato
ddadf3399c Merge pull request #2441 from nhost/feat/docs-for-postgres-wal-settings
feat(docs): add postgres wal settings to docs
2024-01-02 18:52:11 -01:00
Nestor Manrique
c768341ce8 Adjust PR comments and run sections on product page 2024-01-02 16:34:49 +01:00
Nestor Manrique
1396cbe4c0 Add more details to healthcheck docs 2024-01-02 16:05:31 +01:00
Nestor Manrique
76761b4970 Add docs for run health checks config 2024-01-02 16:00:40 +01:00
Nestor Manrique
0bc9a41e51 Add postgres wal settings to docs 2024-01-02 14:55:26 +01:00
Nuno Pato
7107089a29 asd 2023-12-24 11:10:50 -01:00
David Barroso
a6c7300e14 asd 2023-12-22 16:34:25 +01:00
Nuno Pato
1a84610b74 asd 2023-12-22 14:34:00 -01:00
Nuno Pato
6c43529eff asd 2023-12-22 13:35:45 -01:00
Nuno Pato
63309cbcd6 asd 2023-12-22 13:24:47 -01:00
David Barroso
998b1d5963 asd 2023-12-22 15:21:08 +01:00
David Barroso
42d2a89de3 asd 2023-12-22 15:17:34 +01:00
David Barroso
731f094cf8 asd 2023-12-22 15:17:34 +01:00
David Barroso
3454605582 asd 2023-12-22 15:17:34 +01:00
David Barroso
e4479afab4 asd 2023-12-22 15:17:34 +01:00
David Barroso
6edae34bf0 asd 2023-12-22 15:17:34 +01:00
David Barroso
80b6464f60 asd 2023-12-22 15:17:34 +01:00
David Barroso
e3880dbe8a asd 2023-12-22 15:17:33 +01:00
David Barroso
ea991228e2 asd 2023-12-22 15:17:33 +01:00
Nuno Pato
7cb568be52 asd 2023-12-22 15:17:33 +01:00
Nuno Pato
dacaa7cad7 ads 2023-12-22 15:17:33 +01:00
Nuno Pato
30a688778e asd 2023-12-22 15:17:33 +01:00
Nuno Pato
d4f79c05b4 asd 2023-12-22 15:17:33 +01:00
Nuno Pato
e10d313e37 asd 2023-12-22 15:17:33 +01:00
Nuno Pato
77e8fb471c asd 2023-12-22 15:17:33 +01:00
Nuno Pato
f40a3f23ac asd 2023-12-22 15:17:33 +01:00
Nuno Pato
17dea7e60b asd 2023-12-22 15:17:33 +01:00
Nuno Pato
23527fc388 asd 2023-12-22 15:17:33 +01:00
Nuno Pato
8ec6b85bac asd 2023-12-22 15:17:33 +01:00
Nuno Pato
b067838984 asd 2023-12-22 15:17:33 +01:00
Nuno Pato
7553506e18 asd 2023-12-22 15:17:33 +01:00
Nuno Pato
e58a9f1aaa asd 2023-12-22 15:17:33 +01:00
Nuno Pato
d4bfea963f asd 2023-12-22 15:17:33 +01:00
Nuno Pato
88779ad950 asd 2023-12-22 15:17:33 +01:00
Nuno Pato
90929e9357 asd 2023-12-22 15:17:33 +01:00
David Barroso
2f4d5814ed asd 2023-12-22 15:17:33 +01:00
Nuno Pato
6d08b34309 new docs 2023-12-22 15:17:32 +01:00
1077 changed files with 40082 additions and 29892 deletions

22
.github/CODEOWNERS vendored
View File

@@ -1,14 +1,14 @@
# Documentation
# https://help.github.com/en/articles/about-code-owners
/packages @szilarddoro
/packages/docgen @szilarddoro
/integrations/stripe-graphql-js @elitan
/.github @szilarddoro
/dashboard/ @szilarddoro
/docs/ @elitan
/config/ @szilarddoro
/examples/ @szilarddoro
/examples/codegen-react-apollo @elitan @szilarddoro
/examples/codegen-react-query @elitan @szilarddoro
/examples/react-apollo-crm @elitan @szilarddoro
/packages @nunopato @onehassan
/packages/docgen @nunopato @onehassan
/integrations/stripe-graphql-js @nunopato @onehassan
/.github @nunopato @onehassan
/dashboard/ @nunopato @onehassan
/docs/ @nunopato @onehassan
/config/ @nunopato @onehassan
/examples/ @nunopato @onehassan
/examples/codegen-react-apollo @nunopato @onehassan
/examples/codegen-react-query @nunopato @onehassan
/examples/react-apollo-crm @nunopato @onehassan

View File

@@ -14,7 +14,7 @@ runs:
steps:
- uses: pnpm/action-setup@v2.2.4
with:
version: 8.6.2
version: 8.10.5
run_install: false
- name: Get pnpm cache directory
id: pnpm-cache-dir

1
.github/labeler.yml vendored
View File

@@ -4,7 +4,6 @@ dashboard:
documentation:
- any:
- docs/**/*
- '!docs/docs/reference/docgen/**/*'
examples:
- examples/**/*

23
.github/renovate.json vendored
View File

@@ -1,23 +0,0 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"docker-compose": {
"enabled": true
},
"ignoreDeps": [
"pnpm",
"node",
"@types/node"
],
"labels": [
"dependencies"
],
"enabledManagers": [
"npm",
"dockerfile",
"docker-compose",
"github-actions"
]
}

View File

@@ -106,6 +106,8 @@ jobs:
# * Run every `lint` script in the workspace . Dependencies build is cached by Turborepo
- name: Lint
run: pnpm run lint:all
- name: Audit for vulnerabilities
run: pnpx audit-ci --config ./audit-ci.jsonc
e2e:
name: 'E2E (Package: ${{ matrix.package.path }})'

2
.gitignore vendored
View File

@@ -23,7 +23,7 @@ node_modules/
tmp/
.pnpm-store
.turbo
.env
.env*
.secrets
out/

3
.npmrc
View File

@@ -1 +1,2 @@
prefer-workspace-packages = true
prefer-workspace-packages = true
auto-install-peers = false

View File

@@ -1,7 +0,0 @@
{
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"eslint.workingDirectories": ["./dashboard"],
"typescript.tsdk": "node_modules/typescript/lib"
}

6
audit-ci.jsonc Normal file
View File

@@ -0,0 +1,6 @@
{
// $schema provides code completion hints to IDEs.
"$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
"moderate": true,
"allowlist": ["trim-newlines"]
}

View File

@@ -1,5 +1,39 @@
# @nhost/dashboard
## 1.6.1
### Patch Changes
- 8d91f71: chore: update deps and enable pnpm audit
- 3b8473b: chore: update turbo to `1.11.3` and pnpm to `8.10.5` in Dockerfile
- Updated dependencies [8d91f71]
- @nhost/react-apollo@7.0.2
- @nhost/nextjs@2.0.2
## 1.6.0
### Minor Changes
- 3ff1c2b53: fix: show upgrade option for pro projects
## 1.5.0
### Minor Changes
- c2ef17c0a: feat: add support for new Team plan
## 1.4.0
### Minor Changes
- 7883bbcbd: feat: don't show deprecated plans
- 44be6dc0a: feat: set redirectTo during sign-in to support preview environments
### Patch Changes
- 3c3594898: fix: allow access to graphite when configured running in local dashboard
- 32c246b7a: chore: update docs icon
## 1.3.2
### Patch Changes

View File

@@ -3,7 +3,7 @@ RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app
RUN yarn global add turbo@1.10.11
RUN yarn global add turbo@1.11.3
COPY . .
RUN turbo prune --scope="@nhost/dashboard" --docker
@@ -29,7 +29,7 @@ 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@8.6.2
RUN yarn global add pnpm@8.10.5
COPY .gitignore .gitignore
COPY --from=pruner /app/out/json/ .
COPY --from=pruner /app/out/pnpm-*.yaml .

View File

@@ -27,7 +27,7 @@ test('should be able to create then delete a personal access token', async () =>
const patName = faker.lorem.slug(3);
await page.getByRole('textbox', { name: /name/i }).fill(patName);
await page.getByRole('button', { name: /expiration/i }).click();
await page.getByLabel('Expiration').click();
await page.getByRole('option', { name: /7 days/i }).click();
await page.getByRole('button', { name: /create/i }).click();

View File

@@ -138,7 +138,8 @@ test('should create a table with an identity column', async () => {
],
});
await page.getByRole('button', { name: /identity/i }).click();
// await page.getByRole('button', { name: /identity/i }).click();
await page.getByLabel('Identity').click();
await page.getByRole('option', { name: /id/i }).click();
// create table
@@ -194,26 +195,18 @@ test('should create table with foreign key constraint', async () => {
await page.getByRole('button', { name: /add foreign key/i }).click();
// select column in current table
await page
.getByRole('button', { name: /column/i })
.first()
.click();
await page.locator('#columnName').click();
await page.getByRole('option', { name: /author_id/i }).click();
// select reference schema
await page.getByRole('button', { name: /schema/i }).click();
await page.getByLabel('Schema').click();
await page.getByRole('option', { name: /public/i }).click();
// select reference table
await page.getByRole('button', { name: /table/i }).click();
await page.getByLabel('Table').click();
await page.getByRole('option', { name: firstTableName, exact: true }).click();
// select reference column
await page
.getByRole('button', { name: /column/i })
.nth(1)
.click();
await page.locator('#referencedColumn').click();
await page.getByRole('option', { name: /id/i }).click();
await page.getByRole('button', { name: /add/i }).click();

View File

@@ -113,27 +113,21 @@ test('should not be able to delete a table if other tables have foreign keys ref
await page.getByRole('button', { name: /add foreign key/i }).click();
// select column in current table
await page
.getByRole('button', { name: /column/i })
.first()
.click();
await page.locator('#columnName').click();
await page.getByRole('option', { name: /author_id/i }).click();
// select reference schema
await page.getByRole('button', { name: /schema/i }).click();
await page.getByLabel('Schema').click();
await page.getByRole('option', { name: /public/i }).click();
// select reference table
await page.getByRole('button', { name: /table/i }).click();
await page.getByLabel('Table').click();
await page.getByRole('option', { name: firstTableName, exact: true }).click();
// select reference column
await page
.getByRole('button', { name: /column/i })
.nth(1)
.click();
await page.locator('#referencedColumn').click();
await page.getByRole('option', { name: /id/i }).click();
await page.getByRole('button', { name: /add/i }).click();
await expect(

View File

@@ -93,7 +93,7 @@ test("should show the project's region and subdomain", async () => {
test('should not have a GitHub repository connected', async () => {
await expect(
page.getByRole('button', { name: /connect to github/i }),
page.getByRole('button', { name: /connect to github/i }).first(),
).toBeVisible();
});

View File

@@ -116,7 +116,8 @@ export async function prepareTable({
);
// select the first column as primary key
await page.getByRole('button', { name: /primary key/i }).click();
// await page.getByRole('button', { name: /primary key/i }).click();
await page.getByLabel('Primary Key').click();
await page.getByRole('option', { name: primaryKey, exact: true }).click();
}

View File

@@ -1,5 +0,0 @@
query InitQuery {
root {
enableServices
}
}

View File

@@ -1,5 +0,0 @@
{
"projectId": 2596,
"token": "U2FsdGVkX19+V8BJnVR0xLEC+42OW5qZl/A0i6beAaRmJoIhFh5Yf6eIKBzLbV9h",
"outputDirectoryPath": "src/hypertune"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/dashboard",
"version": "1.3.2",
"version": "1.6.1",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
@@ -15,62 +15,61 @@
"format": "prettier --write \"src/**/*.{js,ts,tsx,jsx,json,md}\" --plugin-search-dir=.",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook",
"install-browsers": "pnpm dlx playwright@1.31.0 install --with-deps",
"e2e": "pnpm install-browsers && pnpm dlx playwright@1.31.0 test"
"install-browsers": "pnpm playwright install && pnpm playwright install-deps",
"e2e": "pnpm install-browsers && pnpm playwright test"
},
"dependencies": {
"@apollo/client": "^3.7.10",
"@codemirror/lang-sql": "^6.5.4",
"@emotion/cache": "^11.10.5",
"@emotion/react": "^11.10.5",
"@emotion/server": "^11.4.0",
"@emotion/styled": "^11.10.5",
"@fontsource/inter": "^5.0.0",
"@fontsource/roboto-mono": "^5.0.0",
"@graphiql/react": "^0.18.0",
"@graphiql/toolkit": "^0.8.2",
"@headlessui/react": "^1.6.5",
"@apollo/client": "^3.8.9",
"@codemirror/lang-sql": "^6.5.5",
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.3",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@fontsource/inter": "^5.0.16",
"@fontsource/roboto-mono": "^5.0.16",
"@graphiql/react": "^0.20.2",
"@graphiql/toolkit": "^0.9.1",
"@headlessui/react": "^1.7.18",
"@heroicons/react": "^1.0.6",
"@hookform/resolvers": "^3.0.0",
"@mui/base": "^5.0.0-alpha.106",
"@mui/material": "^5.10.14",
"@mui/system": "^5.10.14",
"@mui/x-date-pickers": "^5.0.8",
"@hookform/resolvers": "^3.3.4",
"@mui/base": "5.0.0-beta.31",
"@mui/material": "^5.15.4",
"@mui/system": "^5.15.4",
"@mui/x-date-pickers": "^5.0.20",
"@nhost/nextjs": "workspace:*",
"@nhost/react-apollo": "workspace:*",
"@segment/snippet": "^4.15.3",
"@stripe/react-stripe-js": "^2.0.0",
"@stripe/stripe-js": "^1.35.0",
"@tailwindcss/forms": "^0.5.3",
"@tanstack/react-query": "^4.16.1",
"@tanstack/react-table": "^8.5.30",
"@tanstack/react-virtual": "^3.0.0-beta.23",
"@uiw/codemirror-theme-github": "^4.21.20",
"@uiw/react-codemirror": "^4.21.20",
"@segment/snippet": "^4.16.2",
"@stripe/react-stripe-js": "^2.4.0",
"@stripe/stripe-js": "^1.54.2",
"@tailwindcss/forms": "^0.5.7",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-table": "^8.11.6",
"@tanstack/react-virtual": "^3.0.1",
"@uiw/codemirror-theme-github": "^4.21.21",
"@uiw/react-codemirror": "^4.21.21",
"analytics-node": "^6.2.0",
"bcryptjs": "^2.4.3",
"clsx": "^1.2.1",
"date-fns": "^2.29.3",
"generate-password": "^1.7.0",
"graphiql": "^3.0.0",
"graphql": "^16.6.0",
"graphql-request": "^6.0.0",
"date-fns": "^2.30.0",
"generate-password": "^1.7.1",
"graphiql": "^3.1.0",
"graphql": "16.8.1",
"graphql-request": "^6.1.0",
"graphql-tag": "^2.12.6",
"graphql-ws": "^5.11.2",
"hypertune": "^1.4.4",
"just-kebab-case": "^4.1.1",
"graphql-ws": "^5.14.3",
"just-kebab-case": "^4.2.0",
"lodash.debounce": "^4.0.8",
"next": "^12.3.1",
"next-seo": "^6.0.0",
"next": "^14.0.4",
"next-seo": "^6.4.0",
"node-pg-format": "^1.3.5",
"pluralize": "^8.0.0",
"react": "18.2.0",
"react-children-utilities": "^2.9.0",
"react-children-utilities": "^2.10.0",
"react-dom": "18.2.0",
"react-error-boundary": "^4.0.0",
"react-hook-form": "^7.42.1",
"react-hot-toast": "^2.4.0",
"react-intersection-observer": "^9.5.2",
"react-error-boundary": "^4.0.12",
"react-hook-form": "^7.49.3",
"react-hot-toast": "^2.4.1",
"react-intersection-observer": "^9.5.3",
"react-is": "18.2.0",
"react-loading-skeleton": "^2.2.0",
"react-markdown": "^9.0.1",
@@ -82,87 +81,87 @@
"rehype-highlight": "^7.0.0",
"remark-gfm": "^4.0.0",
"shell-quote": "^1.8.1",
"slugify": "^1.6.5",
"slugify": "^1.6.6",
"stripe": "^10.17.0",
"tailwind-merge": "^1.8.0",
"tailwind-merge": "^1.14.0",
"utility-types": "^3.10.0",
"validator": "^13.7.0",
"yup": "^1.0.2",
"validator": "^13.11.0",
"yup": "^1.3.3",
"yup-password": "^0.2.2"
},
"devDependencies": {
"@babel/core": "^7.20.2",
"@babel/core": "^7.23.7",
"@faker-js/faker": "^7.6.0",
"@graphql-codegen/cli": "^3.0.0",
"@graphql-codegen/typescript": "^3.0.0",
"@graphql-codegen/typescript-operations": "^3.0.0",
"@graphql-codegen/typescript-react-apollo": "^3.3.1",
"@next/bundle-analyzer": "^12.3.1",
"@playwright/test": "1.31.0",
"@storybook/addon-actions": "^6.5.14",
"@storybook/addon-essentials": "^6.5.14",
"@storybook/addon-interactions": "^6.5.14",
"@storybook/addon-links": "^6.5.14",
"@graphql-codegen/cli": "^3.3.1",
"@graphql-codegen/typescript": "^3.0.4",
"@graphql-codegen/typescript-operations": "^3.0.4",
"@graphql-codegen/typescript-react-apollo": "^3.3.7",
"@next/bundle-analyzer": "^12.3.4",
"@playwright/test": "1.41.0",
"@storybook/addon-actions": "^6.5.16",
"@storybook/addon-essentials": "^6.5.16",
"@storybook/addon-interactions": "^6.5.16",
"@storybook/addon-links": "^6.5.16",
"@storybook/addon-postcss": "^2.0.0",
"@storybook/builder-webpack5": "^6.5.14",
"@storybook/manager-webpack5": "^6.5.14",
"@storybook/react": "^6.5.14",
"@storybook/testing-library": "^0.2.0",
"@storybook/builder-webpack5": "^6.5.16",
"@storybook/manager-webpack5": "^6.5.16",
"@storybook/react": "^6.5.16",
"@storybook/testing-library": "^0.2.2",
"@tailwindcss/typography": "^0.5.10",
"@testing-library/dom": "^9.0.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.2",
"@types/ace": "^0.0.48",
"@types/bcryptjs": "^2.4.2",
"@types/jest": "^29.5.3",
"@types/lodash.debounce": "^4.0.7",
"@types/node": "^16.11.7",
"@types/bcryptjs": "^2.4.6",
"@types/jest": "^29.5.11",
"@types/lodash.debounce": "^4.0.9",
"@types/node": "^16.18.70",
"@types/pluralize": "^0.0.30",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@types/react-table": "^7.7.12",
"@types/shell-quote": "^1.7.1",
"@types/testing-library__jest-dom": "^5.14.5",
"@types/validator": "^13.7.10",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"@vitejs/plugin-react": "^4.0.0",
"@vitest/coverage-v8": "^0.32.0",
"autoprefixer": "^10.4.13",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@types/react-table": "^7.7.19",
"@types/shell-quote": "^1.7.5",
"@types/testing-library__jest-dom": "^5.14.9",
"@types/validator": "^13.11.8",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-v8": "^0.32.4",
"autoprefixer": "^10.4.16",
"babel-loader": "^8.3.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"csstype": "^3.0.10",
"dotenv": "^16.0.3",
"csstype": "^3.1.3",
"dotenv": "^16.3.1",
"encoding": "^0.1.13",
"eslint": "^8.28.0",
"eslint": "^8.56.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-next": "^13.0.2",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.11",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-next": "^13.5.6",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"jsdom": "^22.0.0",
"lint-staged": ">=13",
"msw": "^1.0.1",
"msw-storybook-addon": "^1.6.3",
"node-fetch": "^3.3.0",
"postcss": "^8.4.19",
"prettier": "^2.7.1",
"prettier-plugin-organize-imports": "^3.2.0",
"prettier-plugin-tailwindcss": "^0.4.0",
"jsdom": "^22.1.0",
"lint-staged": "^15.2.0",
"msw": "^1.3.2",
"msw-storybook-addon": "^1.10.0",
"node-fetch": "^3.3.2",
"postcss": "^8.4.33",
"prettier": "^2.8.8",
"prettier-plugin-organize-imports": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.4.1",
"react-date-fns-hooks": "^0.9.4",
"require-from-string": "^2.0.2",
"snake-case": "^3.0.4",
"storybook-addon-next-router": "^4.0.1",
"tailwindcss": "^3.1.2",
"ts-node": "^10.9.1",
"tsconfig-paths-webpack-plugin": "^4.0.0",
"vite": "^4.0.2",
"vite-tsconfig-paths": "^4.0.3",
"vitest": "^0.32.0"
"storybook-addon-next-router": "^4.0.2",
"tailwindcss": "^3.4.1",
"ts-node": "^10.9.2",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"vite": "^5.0.12",
"vite-tsconfig-paths": "^4.2.3",
"vitest": "^0.32.4"
},
"browserslist": {
"production": [

View File

@@ -0,0 +1,7 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6 6H10" stroke="#21324B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6 8H10" stroke="#21324B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6 10H8" stroke="#21324B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9.79289 13.5H3C2.86739 13.5 2.74021 13.4473 2.64645 13.3536C2.55268 13.2598 2.5 13.1326 2.5 13V3C2.5 2.86739 2.55268 2.74021 2.64645 2.64645C2.74021 2.55268 2.86739 2.5 3 2.5H13C13.1326 2.5 13.2598 2.55268 13.3536 2.64645C13.4473 2.74021 13.5 2.86739 13.5 3V9.79289C13.5 9.85855 13.4871 9.92357 13.4619 9.98423C13.4368 10.0449 13.4 10.1 13.3536 10.1464L10.1464 13.3536C10.1 13.4 10.0449 13.4368 9.98423 13.4619C9.92357 13.4871 9.85855 13.5 9.79289 13.5V13.5Z" stroke="#21324B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13.4548 9.99948H10V13.4545" stroke="#21324B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,7 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6 6H10" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6 8H10" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6 10H8" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9.79289 13.5H3C2.86739 13.5 2.74021 13.4473 2.64645 13.3536C2.55268 13.2598 2.5 13.1326 2.5 13V3C2.5 2.86739 2.55268 2.74021 2.64645 2.64645C2.74021 2.55268 2.86739 2.5 3 2.5H13C13.1326 2.5 13.2598 2.55268 13.3536 2.64645C13.4473 2.74021 13.5 2.86739 13.5 3V9.79289C13.5 9.85855 13.4871 9.92357 13.4619 9.98423C13.4368 10.0449 13.4 10.1 13.3536 10.1464L10.1464 13.3536C10.1 13.4 10.0449 13.4368 9.98423 13.4619C9.92357 13.4871 9.85855 13.5 9.79289 13.5V13.5Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13.4548 9.99948H10V13.4545" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -4,9 +4,17 @@ import type { DetailedHTMLProps, HTMLProps } from 'react';
import { twMerge } from 'tailwind-merge';
export interface ContactUsProps
extends DetailedHTMLProps<HTMLProps<HTMLDivElement>, HTMLDivElement> {}
extends DetailedHTMLProps<HTMLProps<HTMLDivElement>, HTMLDivElement> {
isTeam?: boolean;
isOwner?: boolean;
}
export default function FeedbackForm({ className, ...props }: ContactUsProps) {
export default function FeedbackForm({
className,
isTeam,
isOwner,
...props
}: ContactUsProps) {
return (
<div
className={twMerge(
@@ -19,6 +27,30 @@ export default function FeedbackForm({ className, ...props }: ContactUsProps) {
Contact us
</Text>
{isTeam && isOwner && (
<Text>
If this is a new Team project, or you need to manage members, reach
out to us on discord or via email at{' '}
<Link
href="mailto:support@nhost.io"
target="_blank"
rel="noopener noreferrer"
underline="hover"
>
support@nhost.io
</Link>{' '}
so we can have your dedicated channel set up.
</Text>
)}
{isTeam && !isOwner && (
<Text>
As part of a team plan you can reach out to us on the private channel
for this workspace. If you haven&apos;t been added to the channel, ask
the workspace owner to add you.
</Text>
)}
<Text>
To report issues with Nhost, please open a GitHub issue in the{' '}
<Link

View File

@@ -17,7 +17,7 @@ function NavLink(
ref: ForwardedRef<HTMLAnchorElement>,
) {
return (
<NextLink href={href} passHref>
<NextLink href={href} passHref legacyBehavior>
<Link className={twMerge('font-display', className)} ref={ref} {...props}>
{children}
</Link>

View File

@@ -26,7 +26,7 @@ export default function ThemeSwitcher({
listbox: { className: 'min-w-0 w-full' },
popper: {
disablePortal: false,
className: 'z-[10000] w-[270px] w-full',
className: 'z-[10000] w-[270px]',
},
}}
>

View File

@@ -26,7 +26,7 @@ export default function UpgradeToProBanner({
return (
<Box
sx={{ backgroundColor: 'primary.light' }}
className="flex flex-col justify-between space-y-4 rounded-md p-4 lg:flex-row lg:items-center lg:space-y-0"
className="flex flex-col justify-between p-4 space-y-4 rounded-md lg:flex-row lg:items-center lg:space-y-0"
>
<div className="flex flex-col justify-between space-y-4">
<div className="space-y-2">
@@ -81,13 +81,13 @@ export default function UpgradeToProBanner({
target="_blank"
rel="noopener noreferrer"
underline="hover"
className="text-center font-medium"
className="font-medium text-center"
sx={{
color: 'text.secondary',
}}
>
See all features
<ArrowSquareOutIcon className="ml-1 h-4 w-4" />
<ArrowSquareOutIcon className="w-4 h-4 ml-1" />
</Link>
</div>
</div>
@@ -97,6 +97,7 @@ export default function UpgradeToProBanner({
width={300}
height={140}
objectFit="contain"
alt='Upgrade to Pro illustration'
/>
</Box>
);

View File

@@ -8,7 +8,7 @@ import type {
DataBrowserGridCellProps,
} from '@/features/database/dataGrid/types/dataBrowser';
import { triggerToast } from '@/utils/toast';
import type { FocusEvent, KeyboardEvent, MouseEvent } from 'react';
import type { FocusEvent, JSXElementConstructor, KeyboardEvent, MouseEvent, ReactElement, ReactNode, ReactPortal } from 'react';
import {
Children,
cloneElement,
@@ -320,7 +320,7 @@ function DataGridCellContent<TData extends object = {}, TValue = unknown>({
sx={{ backgroundColor: 'transparent' }}
{...props}
>
{Children.map(children, (child) => {
{Children.map(children, (child: ReactNode | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>>) => {
if (!isValidElement(child)) {
return null;
}

View File

@@ -13,6 +13,7 @@ import { Dropdown } from '@/components/ui/v2/Dropdown';
import { GraphiteIcon } from '@/components/ui/v2/icons/GraphiteIcon';
import { DevAssistant } from '@/features/ai/DevAssistant';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import { useIsCurrentUserOwner } from '@/features/projects/common/hooks/useIsCurrentUserOwner';
import { useIsPlatform } from '@/features/projects/common/hooks/useIsPlatform';
import { ApplicationStatus } from '@/types/application';
import { getToastStyleProps } from '@/utils/constants/settings';
@@ -37,6 +38,8 @@ export default function Header({ className, ...props }: HeaderProps) {
const { currentProject, refetch: refetchProject } =
useCurrentWorkspaceAndProject();
const isOwner = useIsCurrentUserOwner();
const isProjectUpdating =
currentProject?.appStates[0]?.stateId === ApplicationStatus.Updating;
@@ -114,7 +117,11 @@ export default function Header({ className, ...props }: HeaderProps) {
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
>
<ContactUs className="max-w-md" />
<ContactUs
className="max-w-md"
isTeam={currentProject?.plan?.name === 'Team'}
isOwner={isOwner}
/>
</Dropdown.Content>
</Dropdown.Root>
)}

View File

@@ -8,9 +8,9 @@ import { Input, inputClasses } from '@/components/ui/v2/Input';
import { OptionBase } from '@/components/ui/v2/Option';
import { OptionGroupBase } from '@/components/ui/v2/OptionGroup';
import type { StyledComponent } from '@emotion/styled';
import type { UseAutocompleteProps } from '@mui/base/AutocompleteUnstyled';
import { createFilterOptions } from '@mui/base/AutocompleteUnstyled';
import PopperUnstyled from '@mui/base/PopperUnstyled';
import type { UseAutocompleteProps } from '@mui/base/useAutocomplete';
import { createFilterOptions } from '@mui/base/useAutocomplete';
import { Popper } from '@mui/base'
import { styled } from '@mui/material';
import type { AutocompleteProps as MaterialAutocompleteProps } from '@mui/material/Autocomplete';
import MaterialAutocomplete, {
@@ -142,7 +142,7 @@ const StyledOptionBase = styled(OptionBase)(({ theme }) => ({
gap: theme.spacing(0.5),
}));
export const AutocompletePopper = styled(PopperUnstyled)(({ theme }) => ({
export const AutocompletePopper = styled(Popper)(({ theme }) => ({
zIndex: theme.zIndex.modal + 1,
boxShadow: 'none',
minWidth: 320,

View File

@@ -1,9 +1,7 @@
import { styled } from '@mui/material';
import type {
BoxProps as MaterialBoxProps,
BoxTypeMap,
} from '@mui/material/Box';
import type { BoxProps as MaterialBoxProps } from '@mui/material/Box';
import MaterialBox from '@mui/material/Box';
import { type BoxTypeMap } from '@mui/system';
import type { ForwardedRef, PropsWithoutRef } from 'react';
import { forwardRef } from 'react';

View File

@@ -10,7 +10,7 @@ export interface ChipProps extends MaterialChipProps {
/**
* Custom component for the root node.
*/
component?: string | ElementType;
component?: ElementType;
}
const Chip = styled(MaterialChip)<ChipProps>(({ theme }) => ({

View File

@@ -7,7 +7,7 @@ export interface HelperTextProps extends MaterialFormHelperTextProps {
/**
* Custom component for the root node.
*/
component?: string | ElementType;
component?: ElementType;
}
const HelperText = styled(MaterialFormHelperText)<HelperTextProps>({

View File

@@ -1,41 +1,42 @@
import type { OptionUnstyledProps } from '@mui/base/OptionUnstyled';
import OptionUnstyled, {
optionUnstyledClasses,
} from '@mui/base/OptionUnstyled';
import {
Option as BaseOption,
optionClasses as baseOptionClasses,
type OptionProps as BaseOptionProps,
} from '@mui/base';
import { darken, styled } from '@mui/material';
import type { ForwardedRef } from 'react';
import { forwardRef } from 'react';
import OptionBase from './OptionBase';
export interface OptionProps<TValue extends {}>
extends OptionUnstyledProps<TValue> {}
extends BaseOptionProps<TValue> {}
const StyledOption = styled(OptionUnstyled)(({ theme }) => ({
const StyledOption = styled(BaseOption)(({ theme }) => ({
transition: theme.transitions.create(['background-color']),
color: theme.palette.text.primary,
[`&.${optionUnstyledClasses.selected}`]: {
[`&.${baseOptionClasses.selected}`]: {
backgroundColor:
theme.palette.mode === 'dark'
? `${darken(theme.palette.action.hover, 0.1)} !important`
: `${darken(theme.palette.action.hover, 0.05)} !important`,
},
[`&.${optionUnstyledClasses.selected}:hover, &.${optionUnstyledClasses.selected}.${optionUnstyledClasses.highlighted}`]:
[`&.${baseOptionClasses.selected}:hover, &.${baseOptionClasses.selected}.${baseOptionClasses.highlighted}`]:
{
backgroundColor:
theme.palette.mode === 'dark'
? `${darken(theme.palette.action.hover, 0.25)} !important`
: `${darken(theme.palette.action.hover, 0.075)} !important`,
},
[`&.${optionUnstyledClasses.highlighted}, &:hover`]: {
[`&.${baseOptionClasses.highlighted}, &:hover`]: {
backgroundColor:
theme.palette.mode === 'dark'
? `${darken(theme.palette.action.hover, 0.15)} !important`
: `${theme.palette.action.hover} !important`,
},
[`&.${optionUnstyledClasses.disabled}`]: {
[`&.${baseOptionClasses.disabled}`]: {
color: theme.palette.text.disabled,
},
[`&.${optionUnstyledClasses.disabled}:hover`]: {
[`&.${baseOptionClasses.disabled}:hover`]: {
backgroundColor: 'transparent !important',
},
}));

View File

@@ -1,11 +1,13 @@
import type { OptionGroupUnstyledProps } from '@mui/base/OptionGroupUnstyled';
import OptionGroupUnstyled from '@mui/base/OptionGroupUnstyled';
import {
OptionGroup as BaseOptionGroup,
type OptionGroupProps as BaseOptionGroupProps,
} from '@mui/base';
import { styled } from '@mui/material';
import type { ForwardedRef } from 'react';
import { forwardRef } from 'react';
import OptionGroupBase from './OptionGroupBase';
export interface OptionGroupProps extends OptionGroupUnstyledProps {}
export interface OptionGroupProps extends BaseOptionGroupProps {}
const StyledGroupRoot = styled('li')(({ theme }) => ({
listStyle: 'none',
@@ -25,7 +27,7 @@ function OptionGroup(
...externalSlots,
};
return <OptionGroupUnstyled {...props} ref={ref} slots={slots} />;
return <BaseOptionGroup {...props} ref={ref} slots={slots} />;
}
OptionGroup.displayName = 'NhostOptionGroup';

View File

@@ -1,9 +1,9 @@
import type { FormControlProps } from '@/components/ui/v2/FormControl';
import { FormControl } from '@/components/ui/v2/FormControl';
import PopperUnstyled from '@mui/base/PopperUnstyled';
import type { SelectUnstyledProps } from '@mui/base/SelectUnstyled';
import SelectUnstyled from '@mui/base/SelectUnstyled';
import { styled } from '@mui/material';
import { Popper as BasePopper } from '@mui/base/Popper';
import type { SelectProps as BaseSelectProps } from '@mui/base/Select';
import { Select as BaseSelect } from '@mui/base/Select';
import { styled } from '@mui/system';
import clsx from 'clsx';
import type { ForwardedRef, PropsWithoutRef } from 'react';
import { forwardRef } from 'react';
@@ -11,7 +11,7 @@ import type { ToggleButtonProps } from './ToggleButton';
import ToggleButton from './ToggleButton';
export interface SelectProps<TValue extends {}>
extends SelectUnstyledProps<TValue>,
extends BaseSelectProps<TValue, false>,
Pick<
FormControlProps,
| 'fullWidth'
@@ -25,7 +25,7 @@ export interface SelectProps<TValue extends {}>
/**
* Props for component slots.
*/
slotProps?: SelectUnstyledProps<TValue>['slotProps'] & {
slotProps?: BaseSelectProps<TValue, false>['slotProps'] & {
root?: Partial<PropsWithoutRef<ToggleButtonProps>>;
label?: Partial<FormControlProps['labelProps']>;
formControl?: Partial<FormControlProps>;
@@ -59,8 +59,8 @@ const StyledListbox = styled('ul')(({ theme }) => ({
},
}));
const StyledPopper = styled(PopperUnstyled)`
z-index: 10;
const StyledPopper = styled(BasePopper)`
z-index: 9999;
`;
function Select<TValue>(
@@ -80,7 +80,7 @@ function Select<TValue>(
}: SelectProps<TValue>,
ref: ForwardedRef<HTMLButtonElement>,
) {
const slots: SelectUnstyledProps<TValue>['slots'] = {
const slots: BaseSelectProps<TValue, false>['slots'] = {
root: ToggleButton,
popper: StyledPopper,
listbox: StyledListbox,
@@ -107,7 +107,7 @@ function Select<TValue>(
htmlFor: props.id,
}}
>
<SelectUnstyled
<BaseSelect
aria-label={typeof label === 'string' ? label : undefined}
{...props}
className={clsx(error && 'error')}
@@ -117,7 +117,6 @@ function Select<TValue>(
...slotProps,
root: {
...slotProps?.root,
placeholder,
},
listbox: {
...slotProps?.listbox,
@@ -132,7 +131,7 @@ function Select<TValue>(
placeholder={placeholder}
>
{children}
</SelectUnstyled>
</BaseSelect>
</FormControl>
);
}

View File

@@ -1,8 +1,10 @@
import { ChevronDownIcon } from '@/components/ui/v2/icons/ChevronDownIcon';
import { ChevronUpIcon } from '@/components/ui/v2/icons/ChevronUpIcon';
import type { ButtonUnstyledProps } from '@mui/base/ButtonUnstyled';
import ButtonUnstyled from '@mui/base/ButtonUnstyled';
import { selectUnstyledClasses } from '@mui/base/SelectUnstyled';
import {
Button as ButtonUnstyled,
type ButtonProps as ButtonUnstyledProps,
} from '@mui/base';
import { selectClasses as selectUnstyledClasses } from '@mui/base/Select';
import type { SxProps } from '@mui/material';
import { styled } from '@mui/material';
import type { Theme } from '@mui/system';
@@ -24,6 +26,7 @@ export interface ToggleButtonProps
Omit<DetailedHTMLProps<HTMLProps<HTMLSpanElement>, HTMLSpanElement>, 'as'>
>;
};
placeholder?: string;
}
const StyledButton = styled(ButtonUnstyled)(({ theme }) => ({

View File

@@ -1,14 +1,15 @@
import type { FormControlLabelProps } from '@/components/ui/v2/FormControlLabel';
import { FormControlLabel } from '@/components/ui/v2/FormControlLabel';
import SwitchUnstyled, {
switchUnstyledClasses,
} from '@mui/base/SwitchUnstyled';
import type { SwitchUnstyledProps } from '@mui/base/SwitchUnstyled/SwitchUnstyled.types';
import {
Switch as BaseSwitch,
switchClasses as baseSwitchClasses,
} from '@mui/base';
import type { SwitchProps as BaseSwitchProps } from '@mui/base/Switch';
import { styled } from '@mui/material';
import type { ForwardedRef, PropsWithoutRef } from 'react';
import { forwardRef } from 'react';
export interface SwitchProps extends SwitchUnstyledProps {
export interface SwitchProps extends BaseSwitchProps {
/**
* Label to be displayed next to the checkbox.
*/
@@ -16,11 +17,11 @@ export interface SwitchProps extends SwitchUnstyledProps {
/**
* Props to be passed to the internal components.
*/
slotProps?: SwitchUnstyledProps['slotProps'] & {
slotProps?: BaseSwitchProps['slotProps'] & {
/**
* Props to be passed to the `Switch` component.
*/
root?: Partial<SwitchUnstyledProps>;
root?: Partial<BaseSwitchProps>;
/**
* Props to be passed to the `FormControlLabel` component.
*/
@@ -35,23 +36,23 @@ const StyledFormControlLabel = styled(FormControlLabel)(({ theme }) => ({
justifyContent: 'start',
}));
const StyledSwitch = styled(SwitchUnstyled)(({ theme }) => ({
const StyledSwitch = styled(BaseSwitch)(({ theme }) => ({
position: 'relative',
display: 'inline-block',
width: '40px',
height: '24px',
cursor: 'pointer',
[`&.${switchUnstyledClasses.disabled}`]: {
[`&.${baseSwitchClasses.disabled}`]: {
cursor: 'not-allowed',
[`& .${switchUnstyledClasses.track}`]: {
[`& .${baseSwitchClasses.track}`]: {
backgroundColor: theme.palette.grey[200],
color: theme.palette.grey[200],
},
},
[`& .${switchUnstyledClasses.track}`]: {
[`& .${baseSwitchClasses.track}`]: {
backgroundColor:
theme.palette.mode === 'dark'
? theme.palette.grey[500]
@@ -63,7 +64,7 @@ const StyledSwitch = styled(SwitchUnstyled)(({ theme }) => ({
position: 'absolute',
},
[` & .${switchUnstyledClasses.thumb}`]: {
[` & .${baseSwitchClasses.thumb}`]: {
display: 'block',
width: '18px',
height: '18px',
@@ -77,24 +78,24 @@ const StyledSwitch = styled(SwitchUnstyled)(({ theme }) => ({
transitionDuration: '120ms',
},
[`&.${switchUnstyledClasses.focusVisible} .${switchUnstyledClasses.thumb}`]: {
[`&.${baseSwitchClasses.focusVisible} .${baseSwitchClasses.thumb}`]: {
backgroundColor: theme.palette.action.focus,
boxShadow: '0 0 1px 8px rgba(0, 0, 0, 0.25)',
},
[`&.${switchUnstyledClasses.checked}`]: {
[`.${switchUnstyledClasses.thumb}`]: {
[`&.${baseSwitchClasses.checked}`]: {
[`.${baseSwitchClasses.thumb}`]: {
left: '19px',
top: '3px',
backgroundColor: theme.palette.common.white,
},
[`.${switchUnstyledClasses.track}`]: {
[`.${baseSwitchClasses.track}`]: {
backgroundColor: theme.palette.primary.main,
},
[`&.${switchUnstyledClasses.disabled}`]: {
[`.${switchUnstyledClasses.track}`]: {
[`&.${baseSwitchClasses.disabled}`]: {
[`.${baseSwitchClasses.track}`]: {
opacity: 0.5,
backgroundColor:
theme.palette.mode === 'dark'
@@ -104,7 +105,7 @@ const StyledSwitch = styled(SwitchUnstyled)(({ theme }) => ({
},
},
[`& .${switchUnstyledClasses.input}`]: {
[`& .${baseSwitchClasses.input}`]: {
cursor: 'inherit',
position: 'absolute',
width: '100%',

View File

@@ -15,6 +15,8 @@ import {
} from '@/features/ai/DevAssistant/state';
import { useAdminApolloClient } from '@/features/projects/common/hooks/useAdminApolloClient';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import { useIsGraphiteEnabled } from '@/features/projects/common/hooks/useIsGraphiteEnabled';
import { useIsPlatform } from '@/features/projects/common/hooks/useIsPlatform';
import { getToastStyleProps } from '@/utils/constants/settings';
import {
useSendDevMessageMutation,
@@ -33,6 +35,7 @@ export type Message = Omit<
>;
export default function DevAssistant() {
const isPlatform = useIsPlatform();
const { currentProject, currentWorkspace } = useCurrentWorkspaceAndProject();
const [loading, setLoading] = useState(false);
@@ -45,6 +48,8 @@ export default function DevAssistant() {
const [startDevSession] = useStartDevSessionMutation({ client: adminClient });
const [sendDevMessage] = useSendDevMessageMutation({ client: adminClient });
const { isGraphiteEnabled } = useIsGraphiteEnabled();
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
@@ -141,7 +146,7 @@ export default function DevAssistant() {
}
};
if (currentProject.plan.isFree) {
if (isPlatform && currentProject?.plan?.isFree) {
return (
<Box className="p-4">
<UpgradeToProBanner
@@ -157,7 +162,12 @@ export default function DevAssistant() {
);
}
if (!currentProject.plan.isFree && !currentProject.config?.ai) {
if (
(isPlatform &&
!currentProject?.plan?.isFree &&
!currentProject.config?.ai) ||
!isGraphiteEnabled
) {
return (
<Box className="p-4">
<Alert className="grid w-full grid-flow-col place-content-between items-center gap-2">

View File

@@ -1,7 +1,6 @@
import {
messagesState,
import messagesState, {
type ProjectMessage,
} from '@/features/ai/DevAssistant/state';
} from '@/features/ai/DevAssistant/state/messages';
import { selectorFamily } from 'recoil';
const projectMessagesState = selectorFamily<ProjectMessage[], string>({

View File

@@ -196,14 +196,14 @@ export default function EditUserForm({
className="flex flex-col overflow-hidden border-t-1 lg:flex-auto lg:content-between"
onSubmit={onSubmit}
>
<Box className="flex-auto divide-y overflow-y-auto">
<Box className="flex-auto overflow-y-auto divide-y">
<Box
component="section"
className="grid grid-flow-col p-6 lg:grid-cols-7"
>
<div className="col-span-6 grid grid-flow-col place-content-start items-center gap-4">
<Avatar className="h-12 w-12" src={user.avatarUrl} />
<div className="grid grid-flow-row items-center">
<div className="grid items-center grid-flow-col col-span-6 gap-4 place-content-start">
<Avatar className="w-12 h-12" src={user.avatarUrl} />
<div className="grid items-center grid-flow-row">
<Text className="text-lg font-medium">{user.displayName}</Text>
<Text className="text-sm+ font-normal" color="secondary">
{user.email}
@@ -225,7 +225,7 @@ export default function EditUserForm({
Actions
</Button>
</Dropdown.Trigger>
<Dropdown.Content menu className="h-full w-full">
<Dropdown.Content menu className="w-full h-full">
<Dropdown.Item
className="font-medium"
sx={{ color: 'error.main' }}
@@ -253,11 +253,11 @@ export default function EditUserForm({
component="section"
className="grid grid-flow-row grid-cols-4 gap-8 p-6"
>
<InputLabel as="h3" className="col-span-1 self-center">
<InputLabel as="h3" className="self-center col-span-1">
User ID
</InputLabel>
<div className="col-span-3 grid grid-flow-col items-center justify-start gap-2">
<Text className="truncate font-medium">{user.id}</Text>
<div className="grid items-center justify-start grid-flow-col col-span-3 gap-2">
<Text className="font-medium truncate">{user.id}</Text>
<IconButton
variant="borderless"
color="secondary"
@@ -267,18 +267,18 @@ export default function EditUserForm({
copy(user.id, 'User ID');
}}
>
<CopyIcon className="h-4 w-4" />
<CopyIcon className="w-4 h-4" />
</IconButton>
</div>
<InputLabel as="h3" className="col-span-1 self-center ">
<InputLabel as="h3" className="self-center col-span-1 ">
Created At
</InputLabel>
<Text className="col-span-3 font-medium">
{format(new Date(user.createdAt), 'yyyy-MM-dd HH:mm:ss')}
</Text>
<InputLabel as="h3" className="col-span-1 self-center ">
<InputLabel as="h3" className="self-center col-span-1 ">
Last Seen
</InputLabel>
<Text className="col-span-3 font-medium">
@@ -336,14 +336,14 @@ export default function EditUserForm({
autoComplete="off"
/>
<div className="col-span-1 my-1 grid grid-flow-col grid-cols-8 items-center">
<div className="grid items-center grid-flow-col grid-cols-8 col-span-1 my-1">
<div className="col-span-2 ">
<InputLabel as="h3">Password</InputLabel>
</div>
<Button
color="primary"
variant="borderless"
className="col-span-6 place-self-start px-2"
className="col-span-6 px-2 place-self-start"
onClick={handleChangeUserPassword}
>
Change
@@ -392,12 +392,12 @@ export default function EditUserForm({
</Box>
<Box
component="section"
className="grid place-content-start gap-4 p-6 lg:grid-cols-4"
className="grid gap-4 p-6 place-content-start lg:grid-cols-4"
>
<div className="col-span-1 items-center self-center align-middle">
<div className="items-center self-center col-span-1 align-middle">
<InputLabel as="h3">OAuth Providers</InputLabel>
</div>
<div className="col-span-3 grid w-full grid-flow-row gap-y-6">
<div className="grid w-full grid-flow-row col-span-3 gap-y-6">
{user.userProviders.length === 0 && (
<div className="grid grid-flow-col place-content-between gap-x-1">
<Text className="font-normal" color="disabled">
@@ -408,10 +408,10 @@ export default function EditUserForm({
{user.userProviders.map((provider) => (
<div
className="grid grid-flow-col place-content-between gap-3"
className="grid grid-flow-col gap-3 place-content-between"
key={provider.id}
>
<div className="span-cols-1 grid grid-flow-col gap-2">
<div className="grid grid-flow-col gap-2 span-cols-1">
<Image
src={
theme.palette.mode === 'dark'
@@ -424,6 +424,7 @@ export default function EditUserForm({
}
width={25}
height={25}
alt='Oauth provider logo'
/>
<Text className="font-medium capitalize">
{getReadableProviderName(provider.providerId)}
@@ -436,7 +437,7 @@ export default function EditUserForm({
{!isAnonymous && (
<Box
component="section"
className="grid grid-flow-row gap-y-10 p-6"
className="grid grid-flow-row p-6 gap-y-10"
>
<ControlledSelect
{...register('defaultRole')}
@@ -456,11 +457,11 @@ export default function EditUserForm({
</Option>
))}
</ControlledSelect>
<div className="grid grid-flow-row place-content-start gap-6 lg:grid-flow-col lg:grid-cols-8">
<div className="grid grid-flow-row gap-6 place-content-start lg:grid-flow-col lg:grid-cols-8">
<InputLabel as="h3" className="col-span-2">
Allowed Roles
</InputLabel>
<div className="col-span-3 grid grid-flow-row gap-6">
<div className="grid grid-flow-row col-span-3 gap-6">
{roles.map((role, i) => (
<ControlledCheckbox
id={`roles.${i}`}
@@ -476,7 +477,7 @@ export default function EditUserForm({
)}
</Box>
<Box className="grid w-full flex-shrink-0 snap-end grid-flow-col justify-between gap-3 place-self-end border-t-1 p-2">
<Box className="grid justify-between flex-shrink-0 w-full grid-flow-col gap-3 p-2 snap-end place-self-end border-t-1">
<Button
variant="outlined"
color="secondary"

View File

@@ -226,12 +226,12 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
if (!users) {
return (
<div className="h-screen w-screen overflow-hidden">
<div className="absolute top-0 left-0 z-50 block h-full w-full">
<span className="top50percent relative top-1/2 mx-auto my-0 block">
<div className="w-screen h-screen overflow-hidden">
<div className="absolute top-0 left-0 z-50 block w-full h-full">
<span className="relative block mx-auto my-0 top50percent top-1/2">
<ActivityIndicator
label="Loading users..."
className="my-auto flex items-center justify-center"
className="flex items-center justify-center my-auto"
/>
</span>
</div>
@@ -269,7 +269,7 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
}}
className="grid grid-flow-col items-center gap-2 p-2 text-sm+ font-medium"
>
<UserIcon className="h-4 w-4" />
<UserIcon className="w-4 h-4" />
<Text className="font-medium">View User</Text>
</Dropdown.Item>
@@ -280,7 +280,7 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
sx={{ color: 'error.main' }}
onClick={() => handleDeleteUser(user)}
>
<TrashIcon className="h-4 w-4" />
<TrashIcon className="w-4 h-4" />
<Text className="font-medium" color="error">
Delete User
</Text>
@@ -294,14 +294,14 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
onClick={() => handleViewUser(user)}
aria-label={`View ${user.displayName}`}
>
<div className="col-span-2 grid grid-flow-col place-content-start gap-4">
<div className="grid grid-flow-col col-span-2 gap-4 place-content-start">
<Avatar
src={user.avatarUrl}
alt={`Avatar of ${user.displayName}`}
/>
<div className="grid grid-flow-row items-center">
<div className="grid grid-flow-col items-center gap-2">
<Text className="truncate font-medium leading-5">
<div className="grid items-center grid-flow-row">
<div className="grid items-center grid-flow-col gap-2">
<Text className="font-medium leading-5 truncate">
{user.displayName}
</Text>
{user.disabled && (
@@ -314,7 +314,7 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
)}
</div>
<Text className="truncate font-normal" color="secondary">
<Text className="font-normal truncate" color="secondary">
{user.email}
</Text>
</div>
@@ -334,7 +334,7 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
: '-'}
</Text>
<div className="col-span-2 hidden grid-flow-col place-content-start gap-3 px-4 lg:grid">
<div className="hidden grid-flow-col col-span-2 gap-3 px-4 place-content-start lg:grid">
{user.userProviders.length === 0 && (
<Text className="col-span-3 font-medium">-</Text>
)}
@@ -362,6 +362,7 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
}
width={16}
height={16}
alt='Oauth provider logo'
/>
}
/>

View File

@@ -102,10 +102,10 @@ export default function BaseColumnForm({
return (
<Form
onSubmit={handleExternalSubmit}
className="flex flex-auto flex-col content-between overflow-hidden border-t-1"
className="flex flex-col content-between flex-auto overflow-hidden border-t-1"
>
<div className="flex-auto overflow-y-auto">
<section className="grid grid-cols-8 py-3 px-6">
<section className="grid grid-cols-8 px-6 py-3">
<Input
{...register('name', {
onChange: (event) => {
@@ -184,7 +184,7 @@ export default function BaseColumnForm({
</Text>
</span>
}
className="col-span-8 m-0 w-full py-3 sm:col-span-6 sm:col-start-3 sm:ml-1"
className="w-full col-span-8 py-3 m-0 sm:col-span-6 sm:col-start-3 sm:ml-1"
onChange={(_event, checked) => {
if (checked) {
setDefaultValueInputText('');
@@ -197,7 +197,7 @@ export default function BaseColumnForm({
<Box
component="section"
className="grid grid-cols-8 border-t-1 py-3 px-6"
className="grid grid-cols-8 px-6 py-3 border-t-1"
>
<ControlledAutocomplete
id="defaultValue"
@@ -249,7 +249,7 @@ export default function BaseColumnForm({
/>
<ControlledCheckbox
className="col-span-8 m-0 w-full py-3 sm:col-span-6 sm:col-start-3 sm:ml-1"
className="w-full col-span-8 py-3 m-0 sm:col-span-6 sm:col-start-3 sm:ml-1"
name="isNullable"
label={
<span className="inline-grid grid-flow-row">
@@ -269,7 +269,7 @@ export default function BaseColumnForm({
/>
<ControlledCheckbox
className="col-span-8 m-0 w-full py-3 sm:col-span-6 sm:col-start-3 sm:ml-1"
className="w-full col-span-8 py-3 m-0 sm:col-span-6 sm:col-start-3 sm:ml-1"
name="isUnique"
label={
<span className="inline-grid grid-flow-row">
@@ -306,7 +306,7 @@ export default function BaseColumnForm({
</Box>
</div>
<Box className="grid flex-shrink-0 grid-flow-col justify-between gap-3 border-t-1 p-2">
<Box className="grid justify-between flex-shrink-0 grid-flow-col gap-3 p-2 border-t-1">
<Button
variant="borderless"
color="secondary"

View File

@@ -107,9 +107,9 @@ export default function BaseForeignKeyForm({
selectedColumn?.isPrimary || selectedColumn?.isUnique || false,
});
}}
className="flex flex-auto flex-col content-between overflow-hidden pb-4"
className="flex flex-col content-between flex-auto pb-4 overflow-hidden"
>
<Box className="grid flex-auto grid-flow-row gap-4 overflow-y-auto border-t-1 py-4">
<Box className="grid flex-auto grid-flow-row gap-4 py-4 overflow-y-auto border-t-1">
<Box component="section" className="grid grid-flow-row gap-4 px-6">
<Text variant="h3">From</Text>
@@ -185,7 +185,7 @@ export default function BaseForeignKeyForm({
</Box>
</Box>
<Box className="grid flex-shrink-0 grid-flow-row gap-2 border-t-1 px-6 pt-4">
<Box className="grid flex-shrink-0 grid-flow-row gap-2 px-6 pt-4 border-t-1">
<Button loading={isSubmitting} disabled={isSubmitting} type="submit">
{submitButtonText}
</Button>

View File

@@ -14,8 +14,8 @@ import { Text } from '@/components/ui/v2/Text';
import { useMetadataQuery } from '@/features/database/dataGrid/hooks/useMetadataQuery';
import { useTableQuery } from '@/features/database/dataGrid/hooks/useTableQuery';
import { getTruncatedText } from '@/utils/getTruncatedText';
import type { AutocompleteGroupedOption } from '@mui/base/AutocompleteUnstyled';
import { useAutocomplete } from '@mui/base/AutocompleteUnstyled';
import type { AutocompleteGroupedOption } from '@mui/base/useAutocomplete';
import { useAutocomplete } from '@mui/base/useAutocomplete';
import type { AutocompleteRenderGroupParams } from '@mui/material/Autocomplete';
import { autocompleteClasses } from '@mui/material/Autocomplete';
import type {
@@ -366,11 +366,11 @@ function ColumnAutocomplete(
);
}}
>
<ArrowLeftIcon className="h-4 w-4" />
<ArrowLeftIcon className="w-4 h-4" />
</IconButton>
)}
<Text className="direction-rtl truncate text-left">
<Text className="text-left truncate direction-rtl">
<Text component="span" color="disabled">
{defaultTable}
</Text>

View File

@@ -14,6 +14,7 @@ import { triggerToast } from '@/utils/toast';
import { yupResolver } from '@hookform/resolvers/yup';
import { useRouter } from 'next/router';
import { FormProvider, useForm } from 'react-hook-form';
import type * as Yup from 'yup';
export interface CreateColumnFormProps
extends Pick<BaseColumnFormProps, 'onCancel' | 'location'> {
@@ -50,7 +51,9 @@ export default function CreateColumnForm({
resetForeignKeyError();
}
const form = useForm<BaseColumnFormValues>({
const form = useForm<
BaseColumnFormValues | Yup.InferType<typeof baseColumnValidationSchema>
>({
defaultValues: {
name: '',
type: null,

View File

@@ -11,6 +11,7 @@ import {
import { yupResolver } from '@hookform/resolvers/yup';
import { useState } from 'react';
import { FormProvider, useForm } from 'react-hook-form';
import type * as Yup from 'yup';
export interface CreateForeignKeyFormProps
extends Pick<
@@ -34,7 +35,10 @@ export default function CreateForeignKeyForm({
}: CreateForeignKeyFormProps) {
const [error, setError] = useState<Error>(null);
const form = useForm<BaseForeignKeyFormValues>({
const form = useForm<
| BaseForeignKeyFormValues
| Yup.InferType<typeof baseForeignKeyValidationSchema>
>({
defaultValues: {
id: null,
name: '',

View File

@@ -16,6 +16,7 @@ import { triggerToast } from '@/utils/toast';
import { yupResolver } from '@hookform/resolvers/yup';
import { useRouter } from 'next/router';
import { FormProvider, useForm } from 'react-hook-form';
import type * as Yup from 'yup';
export interface CreateTableFormProps
extends Pick<BaseTableFormProps, 'onCancel' | 'location'> {
@@ -53,7 +54,9 @@ export default function CreateTableForm({
const error = createTableError || trackTableError || foreignKeyError;
const form = useForm<BaseTableFormValues>({
const form = useForm<
BaseTableFormValues | Yup.InferType<typeof baseTableValidationSchema>
>({
defaultValues: {
columns: [
{

View File

@@ -241,7 +241,7 @@ function DataBrowserSidebarContent({
) {
openDrawer({
title: (
<span className="inline-grid grid-flow-col items-center gap-2">
<span className="inline-grid items-center grid-flow-col gap-2">
Permissions
<InlineCode className="!text-sm+ font-normal">{table}</InlineCode>
<Chip label="Preview" size="small" color="info" component="span" />
@@ -263,12 +263,12 @@ function DataBrowserSidebarContent({
}
return (
<Box className="flex h-full flex-col justify-between">
<Box className="flex flex-col justify-between h-full">
<Box className="flex flex-col px-2">
{schemas && schemas.length > 0 && (
<Select
renderValue={(option) => (
<span className="grid grid-flow-col items-center gap-1">
<span className="grid items-center grid-flow-col gap-1">
{option?.label}
</span>
)}
@@ -281,7 +281,7 @@ function DataBrowserSidebarContent({
>
{schemas.map((schema) => (
<Option
className="grid grid-flow-col items-center gap-1"
className="grid items-center grid-flow-col gap-1"
value={schema.schema_name}
key={schema.schema_name}
>
@@ -295,7 +295,7 @@ function DataBrowserSidebarContent({
</Text>
{(isSchemaLocked(schema.schema_name) || isGitHubConnected) && (
<LockIcon
className="h-3 w-3"
className="w-3 h-3"
sx={{ color: 'text.secondary' }}
/>
)}
@@ -317,7 +317,7 @@ function DataBrowserSidebarContent({
target="_blank"
rel="noopener noreferrer"
underline="hover"
className="grid grid-flow-col items-center justify-start gap-1"
className="grid items-center justify-start grid-flow-col gap-1"
>
Learn More <ArrowRightIcon />
</Link>
@@ -327,7 +327,7 @@ function DataBrowserSidebarContent({
<Button
variant="borderless"
endIcon={<PlusIcon />}
className="mt-1 w-full justify-between px-2"
className="justify-between w-full px-2 mt-1"
onClick={() => {
openDrawer({
title: 'Create a New Table',
@@ -396,7 +396,7 @@ function DataBrowserSidebarContent({
}
>
<UsersIcon
className="h-4 w-4"
className="w-4 h-4"
sx={{ color: 'text.secondary' }}
/>
<span>View Permissions</span>
@@ -426,7 +426,7 @@ function DataBrowserSidebarContent({
}
>
<PencilIcon
className="h-4 w-4"
className="w-4 h-4"
sx={{ color: 'text.secondary' }}
/>
<span>Edit Table</span>
@@ -449,7 +449,7 @@ function DataBrowserSidebarContent({
}
>
<UsersIcon
className="h-4 w-4"
className="w-4 h-4"
sx={{ color: 'text.secondary' }}
/>
<span>Edit Permissions</span>
@@ -473,7 +473,7 @@ function DataBrowserSidebarContent({
}
>
<TrashIcon
className="h-4 w-4"
className="w-4 h-4"
sx={{ color: 'error.main' }}
/>
<span>Delete Table</span>
@@ -521,7 +521,7 @@ function DataBrowserSidebarContent({
component={NavLink}
href={sqlEditorHref}
>
<div className="flex w-full flex-row items-center justify-center space-x-4">
<div className="flex flex-row items-center justify-center w-full space-x-4">
<TerminalIcon />
<span className="flex">SQL Editor</span>
</div>

View File

@@ -17,6 +17,7 @@ import { triggerToast } from '@/utils/toast';
import { yupResolver } from '@hookform/resolvers/yup';
import { useRouter } from 'next/router';
import { FormProvider, useForm } from 'react-hook-form';
import type * as Yup from 'yup';
export interface EditColumnFormProps
extends Pick<BaseColumnFormProps, 'onCancel' | 'location'> {
@@ -78,7 +79,9 @@ export default function EditColumnForm({
comment: originalColumn.comment || null,
};
const form = useForm<BaseColumnFormValues>({
const form = useForm<
BaseColumnFormValues | Yup.InferType<typeof baseColumnValidationSchema>
>({
defaultValues: columnValues,
reValidateMode: 'onSubmit',
resolver: yupResolver(baseColumnValidationSchema),

View File

@@ -12,6 +12,7 @@ import type { ForeignKeyRelation } from '@/features/database/dataGrid/types/data
import { yupResolver } from '@hookform/resolvers/yup';
import { useState } from 'react';
import { FormProvider, useForm } from 'react-hook-form';
import type * as Yup from 'yup';
export interface EditForeignKeyFormProps
extends Pick<
@@ -40,7 +41,10 @@ export default function EditForeignKeyForm({
}: EditForeignKeyFormProps) {
const [error, setError] = useState<Error>(null);
const form = useForm<BaseForeignKeyFormValues>({
const form = useForm<
| BaseForeignKeyFormValues
| Yup.InferType<typeof baseForeignKeyValidationSchema>
>({
defaultValues: {
id: foreignKeyRelation.id,
name: foreignKeyRelation.name,

View File

@@ -22,6 +22,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';
import { FormProvider, useForm } from 'react-hook-form';
import type * as Yup from 'yup';
export interface EditTableFormProps
extends Pick<BaseTableFormProps, 'onCancel' | 'location'> {
@@ -85,7 +86,9 @@ export default function EditTableForm({
resetUpdateError();
}
const form = useForm<BaseTableFormValues>({
const form = useForm<
BaseTableFormValues | Yup.InferType<typeof baseTableValidationSchema>
>({
defaultValues: {
name: originalTable.table_name,
columns: [],

View File

@@ -45,7 +45,7 @@ export default function AuthDomain() {
const [updateConfig] = useUpdateConfigMutation();
const form = useForm<{ capacity: number }>({
const form = useForm<Yup.InferType<typeof validationSchema>>({
reValidateMode: 'onSubmit',
defaultValues: { capacity },
resolver: yupResolver(validationSchema),

View File

@@ -4,7 +4,6 @@ import { Box } from '@/components/ui/v2/Box';
import { Button } from '@/components/ui/v2/Button';
import { Checkbox } from '@/components/ui/v2/Checkbox';
import { BaseDialog } from '@/components/ui/v2/Dialog';
import { Link } from '@/components/ui/v2/Link';
import { Text } from '@/components/ui/v2/Text';
import { useAppState } from '@/features/projects/common/hooks/useAppState';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
@@ -85,6 +84,7 @@ export function ChangePlanModalWithData({ app, plans, close }: any) {
const currentPlan = plans.find((plan) => plan.id === app.plan.id);
const selectedPlan = plans.find((plan) => plan.id === selectedPlanId);
const higherPlans = plans.filter((plan) => plan.price > currentPlan.price);
useEffect(() => {
if (!pollingCurrentProject || state === ApplicationStatus.Paused) {
@@ -201,53 +201,6 @@ export function ChangePlanModalWithData({ app, plans, close }: any) {
);
}
if (app.plan.id !== plans.find((plan) => plan.isFree)?.id) {
return (
<Box className="mx-auto w-full max-w-xl rounded-lg p-6 text-left">
<div className="flex flex-col">
<div className="mx-auto">
<Image
src="/assets/upgrade.svg"
alt="Nhost Logo"
width={72}
height={72}
/>
</div>
<Text variant="h3" component="h2" className="mt-2 text-center">
Downgrade is not available
</Text>
<Text className="mt-1 text-center">
You can&apos;t downgrade from a paid plan to a free plan here.
</Text>
<Text className="text-center">
Please contact us at{' '}
<Link href="mailto:info@nhost.io">info@nhost.io</Link> if you want
to downgrade.
</Text>
<div className="mt-6 grid grid-flow-row gap-2">
<Button
variant="outlined"
color="secondary"
className="mx-auto w-full max-w-sm"
onClick={() => {
if (close) {
close();
}
closeAlertDialog();
}}
>
Cancel
</Button>
</div>
</div>
</Box>
);
}
return (
<Box className="w-full max-w-xl rounded-lg p-6 text-left">
<BaseDialog
@@ -277,7 +230,7 @@ export function ChangePlanModalWithData({ app, plans, close }: any) {
</Text>
<div className="mt-2">
{plans
{higherPlans
.filter((plan) => plan.id !== app.plan.id)
.map((plan) => (
<div className="mt-4" key={plan.id}>

View File

@@ -102,7 +102,7 @@ export default function WorkspaceAndProjectList({
placeholder="Find Project"
startAdornment={
<SearchIcon
className="ml-2 -mr-1 h-4 w-4 shrink-0"
className="w-4 h-4 ml-2 -mr-1 shrink-0"
sx={{ color: 'text.disabled' }}
/>
}
@@ -123,7 +123,7 @@ export default function WorkspaceAndProjectList({
</NavLink>
</Box>
<Box className="my-8 grid grid-flow-row gap-8">
<Box className="grid grid-flow-row gap-8 my-8">
{filteredWorkspaces.map((workspace) => (
<div key={workspace.slug}>
<NavLink href={`/${workspace.slug}`} passHref>
@@ -147,7 +147,7 @@ export default function WorkspaceAndProjectList({
secondaryAction={
<div className="grid grid-flow-col gap-px">
{latestDeployment && (
<div className="mr-2 flex self-center align-middle">
<div className="flex self-center mr-2 align-middle">
<StatusCircle
status={
latestDeployment.deploymentStatus as DeploymentStatus
@@ -171,10 +171,11 @@ export default function WorkspaceAndProjectList({
<NavLink
href={`${workspace?.slug}/${project.slug}`}
passHref
className='w-full'
>
<ListItem.Button className="rounded-none">
<ListItem.Avatar>
<div className="h-10 w-10 overflow-hidden rounded-lg">
<div className="w-10 h-10 overflow-hidden rounded-lg">
<Image
src="/logos/new.svg"
alt="Nhost Logo"

View File

@@ -48,14 +48,14 @@ export default function WorkspaceSidebar({
<List className="grid grid-flow-row gap-2">
{workspaces.map(({ id, name, slug }) => (
<ListItem.Root key={id}>
<NavLink href={`/${slug}`} passHref>
<NavLink href={`/${slug}`} passHref className='w-full'>
<ListItem.Button
dense
aria-label={`View ${name}`}
className="!p-1"
>
<ListItem.Avatar className="h-8 w-8">
<div className="inline-block h-8 w-8 overflow-hidden rounded-lg">
<ListItem.Avatar className="w-8 h-8">
<div className="inline-block w-8 h-8 overflow-hidden rounded-lg">
<Image
src="/logos/new.svg"
alt="Nhost Logo"
@@ -107,7 +107,7 @@ export default function WorkspaceSidebar({
<div className="grid grid-flow-row gap-2">
<Resource
text="Documentation"
logo="Question"
logo="Note"
link="https://docs.nhost.io"
/>
<Resource
@@ -131,7 +131,7 @@ export default function WorkspaceSidebar({
rel="noreferrer noopener"
>
<Button
className="grid grid-flow-col gap-1"
className="grid w-full grid-flow-col gap-1"
variant="outlined"
color="secondary"
startIcon={<GitHubIcon />}
@@ -147,7 +147,7 @@ export default function WorkspaceSidebar({
rel="noreferrer noopener"
>
<Button
className="grid grid-flow-col gap-1"
className="grid w-full grid-flow-col gap-1"
variant="outlined"
color="secondary"
aria-labelledby="discord-button-label"

View File

@@ -2,6 +2,7 @@ import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/
import { generateAppServiceUrl } from '@/features/projects/common/utils/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client';
import { useMemo } from 'react';
export default function useAdminApolloClient() {
const { currentProject } = useCurrentWorkspaceAndProject();
@@ -12,18 +13,24 @@ export default function useAdminApolloClient() {
'graphql',
);
const adminClient = new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({
uri: serviceUrl,
headers: {
'x-hasura-admin-secret':
process.env.NEXT_PUBLIC_ENV === 'dev'
? getHasuraAdminSecret()
: currentProject?.config?.hasura.adminSecret,
},
}),
});
const projectAdminSecret = currentProject.config?.hasura?.adminSecret;
const adminClient = useMemo(
() =>
new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({
uri: serviceUrl,
headers: {
'x-hasura-admin-secret':
process.env.NEXT_PUBLIC_ENV === 'dev'
? getHasuraAdminSecret()
: projectAdminSecret,
},
}),
}),
[serviceUrl, projectAdminSecret],
);
return {
adminClient,

View File

@@ -10,7 +10,7 @@ export default function useIsCurrentUserOwner() {
const { currentWorkspace, loading } = useCurrentWorkspaceAndProject();
const currentUser = useUserData();
if (loading || !currentWorkspace.workspaceMembers || !currentUser) {
if (loading || !currentWorkspace?.workspaceMembers || !currentUser) {
return false;
}

View File

@@ -0,0 +1 @@
export { default as useIsGraphiteEnabled } from './useIsGraphiteEnabled';

View File

@@ -0,0 +1,14 @@
import { useAdminApolloClient } from '@/features/projects/common/hooks/useAdminApolloClient';
import { useGetGraphiteSessionsQuery } from '@/utils/__generated__/graphite.graphql';
export default function useIsGraphiteEnabled() {
const { adminClient } = useAdminApolloClient();
const { error } = useGetGraphiteSessionsQuery({
client: adminClient,
});
return {
isGraphiteEnabled: !error,
};
}

View File

@@ -1,6 +1,7 @@
const planDescriptions = {
Starter: '1 GB database, 5 GB of file storage, 10 GB of network traffic.',
Pro: '10 GB database, 25 GB of file storage, 50 GB of network traffic, and backups.',
Team: 'Reach out to us at support@nhost.io to have your private channel set up.',
};
export default planDescriptions;

View File

@@ -32,7 +32,7 @@ export default function AuthDomain() {
const [updateConfig] = useUpdateConfigMutation();
const form = useForm<{ auth_fqdn: string }>({
const form = useForm<Yup.InferType<typeof validationSchema>>({
reValidateMode: 'onSubmit',
defaultValues: { auth_fqdn: null },
resolver: yupResolver(validationSchema),

View File

@@ -32,7 +32,7 @@ export default function HasuraDomain() {
const [updateConfig] = useUpdateConfigMutation();
const form = useForm<{ hasura_fqdn: string }>({
const form = useForm<Yup.InferType<typeof validationSchema>>({
reValidateMode: 'onSubmit',
defaultValues: { hasura_fqdn: null },
resolver: yupResolver(validationSchema),

View File

@@ -40,7 +40,7 @@ export default function RunServicePortDomain({
const runServicePort = service.config.ports.find((p) => p.port === port);
const initialValue = runServicePort?.ingresses?.[0]?.fqdn?.[0];
const form = useForm<{ runServicePortFQDN: string }>({
const form = useForm<RunServicePortFormValues>({
reValidateMode: 'onSubmit',
defaultValues: {
runServicePortFQDN: initialValue,

View File

@@ -34,7 +34,7 @@ export default function ServerlessFunctionsDomain() {
const [updateConfig] = useUpdateConfigMutation();
const form = useForm<{ functions_fqdn: string }>({
const form = useForm<ServerlessFunctionsDomainFormValues>({
reValidateMode: 'onSubmit',
defaultValues: { functions_fqdn: null },
resolver: yupResolver(validationSchema),

View File

@@ -16,7 +16,8 @@ export default function OverviewTopBar() {
const isPlatform = useIsPlatform();
const { currentWorkspace, currentProject } = useCurrentWorkspaceAndProject();
const isOwner = useIsCurrentUserOwner();
const isPro = !currentProject?.plan?.isFree;
const isStarter = currentProject?.plan?.name === 'Starter';
const isPro = currentProject?.plan?.name === 'Pro';
const { openDialog } = useDialog();
const { maintenanceActive } = useUI();
@@ -65,7 +66,6 @@ export default function OverviewTopBar() {
>
{currentProject.name}
</Text>
{currentProject.creator && (
<Text
color="secondary"
@@ -81,15 +81,14 @@ export default function OverviewTopBar() {
ago
</Text>
)}
<div className="mt-1 inline-grid grid-flow-col items-center justify-start gap-2 md:mt-0">
<Chip
size="small"
label={isPro ? 'Pro' : 'Starter'}
color={isPro ? 'primary' : 'default'}
label={currentProject.plan.name}
color={!isStarter ? 'primary' : 'default'}
/>
{!isPro && isOwner && (
{(isStarter || isPro) && isOwner && (
<Button
variant="borderless"
className="mr-2"

View File

@@ -27,7 +27,7 @@ function AllWorkspaceApps() {
if (currentWorkspace?.projects?.length === 0) {
return (
<Box className="flex flex-row border-y py-4">
<Box className="flex flex-row py-4 border-y">
<Text className="text-xs" color="secondary">
No projects on this workspace.
</Text>
@@ -45,11 +45,12 @@ function AllWorkspaceApps() {
<NavLink
href={`${currentWorkspace?.slug}/${project.slug}`}
passHref
className='w-full'
>
<ListItem.Button className="grid grid-flow-col items-center justify-between gap-2">
<div className="grid grid-flow-col items-center justify-start gap-2">
<ListItem.Button className="grid items-center justify-between grid-flow-col gap-2">
<div className="grid items-center justify-start grid-flow-col gap-2">
<ListItem.Avatar>
<div className="h-8 w-8 overflow-hidden rounded-lg">
<div className="w-8 h-8 overflow-hidden rounded-lg">
<Image
src="/logos/new.svg"
alt="Nhost Logo"
@@ -80,7 +81,7 @@ function AllWorkspaceApps() {
<Chip
size="small"
label={project.plan.isFree ? 'Starter' : 'Pro'}
label={project.plan.name}
color={project.plan.isFree ? 'default' : 'primary'}
/>
</ListItem.Button>
@@ -99,8 +100,8 @@ export default function WorkspaceApps() {
return (
<div className="mt-9">
<div className="mx-auto max-w-3xl font-display">
<div className="mb-4 grid grid-flow-col items-center justify-between gap-2">
<div className="max-w-3xl mx-auto font-display">
<div className="grid items-center justify-between grid-flow-col gap-2 mb-4">
<Text className="text-lg font-medium">Projects</Text>
{!loading && (

View File

@@ -13,20 +13,18 @@ import { Tooltip } from '@/components/ui/v2/Tooltip';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import { useHostName } from '@/features/projects/common/hooks/useHostName';
import { InfoCard } from '@/features/projects/overview/components/InfoCard';
import {
COST_PER_VCPU,
MAX_SERVICES_CPU,
MAX_SERVICES_MEM,
MAX_SERVICE_REPLICAS,
MIN_SERVICES_CPU,
MIN_SERVICES_MEM,
} from '@/features/projects/resources/settings/utils/resourceSettingsValidationSchema';
import { COST_PER_VCPU } from '@/features/projects/resources/settings/utils/resourceSettingsValidationSchema';
import { ComputeFormSection } from '@/features/services/components/ServiceForm/components/ComputeFormSection';
import { EnvironmentFormSection } from '@/features/services/components/ServiceForm/components/EnvironmentFormSection';
import { PortsFormSection } from '@/features/services/components/ServiceForm/components/PortsFormSection';
import { ReplicasFormSection } from '@/features/services/components/ServiceForm/components/ReplicasFormSection';
import { StorageFormSection } from '@/features/services/components/ServiceForm/components/StorageFormSection';
import type { DialogFormProps } from '@/types/common';
import {
validationSchema,
type ServiceFormProps,
type ServiceFormValues,
} from '@/features/services/components/ServiceForm/ServiceFormTypes';
import { RESOURCE_VCPU_MULTIPLIER } from '@/utils/constants/common';
import { getToastStyleProps } from '@/utils/constants/settings';
import { copy } from '@/utils/copy';
@@ -42,72 +40,9 @@ import { useEffect, useState } from 'react';
import { FormProvider, useForm } from 'react-hook-form';
import { toast } from 'react-hot-toast';
import { parse } from 'shell-quote';
import * as Yup from 'yup';
import { ServiceConfirmationDialog } from './components/ServiceConfirmationDialog';
import { ServiceDetailsDialog } from './components/ServiceDetailsDialog';
export enum PortTypes {
HTTP = 'http',
TCP = 'tcp',
UDP = 'udp',
}
export const validationSchema = Yup.object({
name: Yup.string().required('The name is required.'),
image: Yup.string().label('Image to run'),
command: Yup.string(),
environment: Yup.array().of(
Yup.object().shape({
name: Yup.string().required(),
value: Yup.string().required(),
}),
),
compute: Yup.object({
cpu: Yup.number().min(MIN_SERVICES_CPU).max(MAX_SERVICES_CPU).required(),
memory: Yup.number().min(MIN_SERVICES_MEM).max(MAX_SERVICES_MEM).required(),
}),
replicas: Yup.number().min(0).max(MAX_SERVICE_REPLICAS).required(),
ports: Yup.array().of(
Yup.object().shape({
port: Yup.number().required(),
type: Yup.mixed<PortTypes>().oneOf(Object.values(PortTypes)).required(),
publish: Yup.boolean().default(false),
}),
),
storage: Yup.array().of(
Yup.object()
.shape({
name: Yup.string().required(),
path: Yup.string().required(),
capacity: Yup.number().nonNullable().required(),
})
.required(),
),
});
export type ServiceFormValues = Yup.InferType<typeof validationSchema>;
export interface ServiceFormProps extends DialogFormProps {
/**
* To use in conjunction with initialData to allow for updating the service
*/
serviceID?: string;
/**
* if there is initialData then it's an update operation
*/
initialData?: ServiceFormValues & { subdomain?: string }; // subdomain is only set on the backend
/**
* Function to be called when the operation is cancelled.
*/
onCancel?: VoidFunction;
/**
* Function to be called when the submit is successful.
*/
onSubmit?: VoidFunction | ((args?: any) => Promise<any>);
}
export default function ServiceForm({
serviceID,
initialData,

View File

@@ -0,0 +1,67 @@
import { PortTypes } from '@/features/services/components/ServiceForm/components/PortsFormSection/PortsFormSectionTypes';
import type { DialogFormProps } from '@/types/common';
import * as Yup from 'yup';
import {
MAX_SERVICES_CPU,
MAX_SERVICES_MEM,
MAX_SERVICE_REPLICAS,
MIN_SERVICES_CPU,
MIN_SERVICES_MEM,
} from '@/features/projects/resources/settings/utils/resourceSettingsValidationSchema';
export const validationSchema = Yup.object({
name: Yup.string().required('The name is required.'),
image: Yup.string().label('Image to run'),
command: Yup.string(),
environment: Yup.array().of(
Yup.object().shape({
name: Yup.string().required(),
value: Yup.string().required(),
}),
),
compute: Yup.object({
cpu: Yup.number().min(MIN_SERVICES_CPU).max(MAX_SERVICES_CPU).required(),
memory: Yup.number().min(MIN_SERVICES_MEM).max(MAX_SERVICES_MEM).required(),
}),
replicas: Yup.number().min(0).max(MAX_SERVICE_REPLICAS).required(),
ports: Yup.array().of(
Yup.object().shape({
port: Yup.number().required(),
type: Yup.mixed<PortTypes>().oneOf(Object.values(PortTypes)).required(),
publish: Yup.boolean().default(false),
}),
),
storage: Yup.array().of(
Yup.object()
.shape({
name: Yup.string().required(),
path: Yup.string().required(),
capacity: Yup.number().nonNullable().required(),
})
.required(),
),
});
export type ServiceFormValues = Yup.InferType<typeof validationSchema>;
export interface ServiceFormProps extends DialogFormProps {
/**
* To use in conjunction with initialData to allow for updating the service
*/
serviceID?: string;
/**
* if there is initialData then it's an update operation
*/
initialData?: ServiceFormValues & { subdomain?: string }; // subdomain is only set on the backend
/**
* Function to be called when the operation is cancelled.
*/
onCancel?: VoidFunction;
/**
* Function to be called when the submit is successful.
*/
onSubmit?: VoidFunction | ((args?: any) => Promise<any>);
}

View File

@@ -11,7 +11,7 @@ import {
MEM_CPU_RATIO,
MIN_SERVICES_MEM,
} from '@/features/projects/resources/settings/utils/resourceSettingsValidationSchema';
import type { ServiceFormValues } from '@/features/services/components/ServiceForm';
import type { ServiceFormValues } from '@/features/services/components/ServiceForm/ServiceFormTypes';
import { useFormContext, useWatch } from 'react-hook-form';
interface ComputeFormSectionProps {

View File

@@ -6,7 +6,7 @@ import { TrashIcon } from '@/components/ui/v2/icons/TrashIcon';
import { Input } from '@/components/ui/v2/Input';
import { Text } from '@/components/ui/v2/Text';
import { Tooltip } from '@/components/ui/v2/Tooltip';
import type { ServiceFormValues } from '@/features/services/components/ServiceForm';
import type { ServiceFormValues } from '@/features/services/components/ServiceForm/ServiceFormTypes';
import { useState } from 'react';
import { useFieldArray, useFormContext } from 'react-hook-form';

View File

@@ -11,10 +11,8 @@ import { Text } from '@/components/ui/v2/Text';
import { Tooltip } from '@/components/ui/v2/Tooltip';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import { InfoCard } from '@/features/projects/overview/components/InfoCard';
import {
PortTypes,
type ServiceFormValues,
} from '@/features/services/components/ServiceForm';
import { PortTypes } from '@/features/services/components/ServiceForm/components/PortsFormSection/PortsFormSectionTypes';
import { type ServiceFormValues } from '@/features/services/components/ServiceForm/ServiceFormTypes';
import { useFieldArray, useFormContext, useWatch } from 'react-hook-form';
export default function PortsFormSection() {

View File

@@ -0,0 +1,5 @@
export enum PortTypes {
HTTP = 'http',
TCP = 'tcp',
UDP = 'udp',
}

View File

@@ -1,2 +1 @@
/* eslint-disable import/no-cycle */
export { default as PortsFormSection } from './PortsFormSection';

View File

@@ -4,7 +4,7 @@ import { Slider } from '@/components/ui/v2/Slider';
import { Text } from '@/components/ui/v2/Text';
import { Tooltip } from '@/components/ui/v2/Tooltip';
import { MAX_SERVICE_REPLICAS } from '@/features/projects/resources/settings/utils/resourceSettingsValidationSchema';
import type { ServiceFormValues } from '@/features/services/components/ServiceForm';
import type { ServiceFormValues } from '@/features/services/components/ServiceForm/ServiceFormTypes';
import { useFormContext, useWatch } from 'react-hook-form';
export default function ReplicasFormSection() {

View File

@@ -5,7 +5,7 @@ import { InfoIcon } from '@/components/ui/v2/icons/InfoIcon';
import { Text } from '@/components/ui/v2/Text';
import { Tooltip } from '@/components/ui/v2/Tooltip';
import { COST_PER_VCPU } from '@/features/projects/resources/settings/utils/resourceSettingsValidationSchema';
import type { ServiceFormValues } from '@/features/services/components/ServiceForm';
import type { ServiceFormValues } from '@/features/services/components/ServiceForm/ServiceFormTypes';
import { RESOURCE_VCPU_MULTIPLIER } from '@/utils/constants/common';
export interface ServiceConfirmationDialogProps {

View File

@@ -10,7 +10,7 @@ import {
MAX_STORAGE_CAPACITY,
MIN_STORAGE_CAPACITY,
} from '@/features/projects/resources/settings/utils/resourceSettingsValidationSchema';
import type { ServiceFormValues } from '@/features/services/components/ServiceForm';
import type { ServiceFormValues } from '@/features/services/components/ServiceForm/ServiceFormTypes';
import { useFieldArray, useFormContext } from 'react-hook-form';
export default function StorageFormSection() {
@@ -53,7 +53,8 @@ export default function StorageFormSection() {
<span>
By default, services do not have persistent storage. You can add
SSD disks to the service here. It is important to note that
capacity can not be decreased after creation, only expanded. Refer to{' '}
capacity can not be decreased after creation, only expanded.
Refer to{' '}
<a
target="_blank"
rel="noopener noreferrer"
@@ -82,7 +83,7 @@ export default function StorageFormSection() {
{fields.map((field, index) => (
<Box
key={field.id}
className="flex w-full flex-col space-y-2 xs+:flex-row xs+:space-y-0 xs+:space-x-2"
className="flex w-full flex-col space-y-2 xs+:flex-row xs+:space-x-2 xs+:space-y-0"
>
<Input
{...register(`storage.${index}.name`)}

View File

@@ -1,2 +1 @@
export * from './ServiceForm';
export { default as ServiceForm } from './ServiceForm';

View File

@@ -11,10 +11,8 @@ import { UserIcon } from '@/components/ui/v2/icons/UserIcon';
import { Text } from '@/components/ui/v2/Text';
import { Tooltip } from '@/components/ui/v2/Tooltip';
import { DeleteServiceModal } from '@/features/projects/common/components/DeleteServiceModal';
import {
ServiceForm,
type PortTypes,
} from '@/features/services/components/ServiceForm';
import { ServiceForm } from '@/features/services/components/ServiceForm';
import { type PortTypes } from '@/features/services/components/ServiceForm/components/PortsFormSection/PortsFormSectionTypes';
import { copy } from '@/utils/copy';
import { formatDistanceToNow } from 'date-fns';
import type { RunService } from 'pages/[workspaceSlug]/[appSlug]/services';

View File

@@ -32,7 +32,7 @@ query PrefetchNewApp {
regions(order_by: { city: asc }) {
...PrefetchNewAppRegions
}
plans(order_by: { sort: asc }) {
plans(order_by: {sort: asc}, where: {deprecated: {_eq: false}}) {
...PrefetchNewAppPlans
}
workspaces {

View File

@@ -0,0 +1,7 @@
query getGraphiteSessions {
graphite {
sessions {
sessionID
}
}
}

View File

@@ -1 +0,0 @@
export { default as useHypertune } from './useHypertune';

View File

@@ -1,14 +0,0 @@
import hypertune from '@/hypertune/hypertune';
import { useEffect, useState } from 'react';
export default function useHypertune() {
const [, setIsInitialized] = useState<boolean>(hypertune.isInitialized());
useEffect(() => {
hypertune.waitForInitialization().then(() => {
setIsInitialized(true);
});
}, []);
return hypertune;
}

View File

@@ -1,5 +0,0 @@
import { initializeHypertune } from './project_2596';
const hypertune = initializeHypertune({});
export default hypertune;

View File

@@ -1,107 +0,0 @@
/* eslint-disable */
import * as sdk from "hypertune";
const projectId = 2596;
const businessToken = `U2FsdGVkX19+V8BJnVR0xLEC+42OW5qZl/A0i6beAaRmJoIhFh5Yf6eIKBzLbV9h`;
const queryCode = `query InitQuery {
root {
enableServices
}
}
`;
const query = {"Query":{"objectTypeName":"Query","selection":{"root":{"fieldArguments":{"__isPartialObject__":true},"fieldQuery":{"Root":{"objectTypeName":"Root","selection":{"enableServices":{"fieldArguments":{},"fieldQuery":null}}}}}}}};
const fallbackInitData: sdk.FallbackInitData & { [key: string]: unknown } = {"commitId":3297,"reducedExpression":{"id":"caxyeQqTKX3UGOXClvbnW","logs":{"events":{},"exposures":{},"evaluations":{}},"type":"ObjectExpression","fields":{"root":{"id":"PoMWxsy7KbW9fCq5XXvx4","body":{"id":"IUICRjZ7iSnh9k0cWBmnd","logs":{"events":{},"exposures":{},"evaluations":{}},"type":"ObjectExpression","fields":{"enableServices":{"id":"7WZWy2AIy_q9Vbz4cn9KB","logs":{"evaluations":{"XNOtHkUBpglrY1nkYa_bf":1},"events":{},"exposures":{}},"type":"BooleanExpression","value":true,"valueType":{"type":"BooleanValueType"}}},"valueType":{"type":"ObjectValueType","objectTypeName":"Root"},"objectTypeName":"Root"},"logs":{"events":{},"exposures":{},"evaluations":{}},"type":"FunctionExpression","valueType":{"type":"FunctionValueType","returnValueType":{"type":"ObjectValueType","objectTypeName":"Root"},"parameterValueTypes":[{"type":"ObjectValueType","objectTypeName":"Query_root_args"}]},"parameters":[{"id":"Ygjhl2LqjiwcousTABFQz","name":"rootArgs"}]}},"metadata":{"permissions":{"user":{},"group":{"team":{"write":"allow"}}}},"valueType":{"type":"ObjectValueType","objectTypeName":"Query"},"objectTypeName":"Query"},"splits":{},"eventTypes":{},"commitConfig":{"splitConfig":{}},"initLogId":0,"commitHash":"4178461588049503","sdkConfig":{"hashPollInterval":1000,"flushLogsInterval":1000,"maxLogsPerFlush":1},"query":{"Query":{"objectTypeName":"Query","selection":{"root":{"fieldArguments":{"__isPartialObject__":true},"fieldQuery":{"Root":{"objectTypeName":"Root","selection":{"enableServices":{"fieldArguments":{},"fieldQuery":null}}}}}}}}};
export function initializeHypertune(
variableValues: Rec,
options: sdk.InitializeOptions = {}
): QueryNode {
const defaultOptions = { businessToken, query, fallbackInitData };
return sdk.initialize(
QueryNode,
projectId,
queryCode,
variableValues,
{ ...defaultOptions, ...options }
);
}
// Enum types
// Input object types
export type Rec = {
//
};
export type Rec2 = {
context: Rec3;
//
};
export type Rec3 = {
workSpace: Rec4;
//
};
export type Rec4 = {
id: string;
//
};
// Enum node classes
// Fragment node classes
export class QueryNode extends sdk.Node {
typeName = "Query" as const;
root(args: Rec2): RootNode {
const props0 = this.getField("root", args);
const expression0 = props0.expression;
if (
expression0 &&
expression0.type === "ObjectExpression"
&& expression0.objectTypeName === "Root"
) {
return new RootNode(props0);
}
const node = new RootNode(props0);
node._logUnexpectedTypeError();
return node;
}
}
export class RootNode extends sdk.Node {
typeName = "Root" as const;
enableServices(args: Rec): sdk.BooleanNode {
const props0 = this.getField("enableServices", args);
const expression0 = props0.expression;
if (
expression0 &&
expression0.type === "BooleanExpression"
) {
return new sdk.BooleanNode(props0);
}
const node = new sdk.BooleanNode(props0);
node._logUnexpectedTypeError();
return node;
}
}

View File

@@ -9,14 +9,14 @@ import { Link } from '@/components/ui/v2/Link';
import { Text } from '@/components/ui/v2/Text';
import { AssistantForm } from '@/features/ai/AssistantForm';
import { AssistantsList } from '@/features/ai/AssistantsList';
import { useAdminApolloClient } from '@/features/projects/common/hooks/useAdminApolloClient';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import { generateAppServiceUrl } from '@/features/projects/common/utils/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import { useIsGraphiteEnabled } from '@/features/projects/common/hooks/useIsGraphiteEnabled';
import { useIsPlatform } from '@/features/projects/common/hooks/useIsPlatform';
import {
useGetAssistantsQuery,
type GetAssistantsQuery,
} from '@/utils/__generated__/graphite.graphql';
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client';
import { useMemo, type ReactElement } from 'react';
export type Assistant = Omit<
@@ -26,34 +26,15 @@ export type Assistant = Omit<
export default function AssistantsPage() {
const { openDrawer } = useDialog();
const isPlatform = useIsPlatform();
const { currentWorkspace, currentProject } = useCurrentWorkspaceAndProject();
const adminSecret = currentProject?.config?.hasura?.adminSecret;
const { adminClient } = useAdminApolloClient();
const { isGraphiteEnabled } = useIsGraphiteEnabled();
const serviceUrl = generateAppServiceUrl(
currentProject?.subdomain,
currentProject?.region,
'graphql',
);
const client = useMemo(
() =>
new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({
uri: serviceUrl,
headers: {
'x-hasura-admin-secret':
process.env.NEXT_PUBLIC_ENV === 'dev'
? getHasuraAdminSecret()
: adminSecret,
},
}),
}),
[serviceUrl, adminSecret],
);
const { data, loading, refetch } = useGetAssistantsQuery({ client });
const { data, loading, refetch } = useGetAssistantsQuery({
client: adminClient,
});
const assistants = useMemo(() => data?.graphite?.assistants || [], [data]);
@@ -64,7 +45,7 @@ export default function AssistantsPage() {
});
};
if (currentProject.plan.isFree) {
if (isPlatform && currentProject?.plan?.isFree) {
return (
<Box className="p-4" sx={{ backgroundColor: 'background.default' }}>
<UpgradeToProBanner
@@ -80,7 +61,12 @@ export default function AssistantsPage() {
);
}
if (!currentProject.plan.isFree && !currentProject.config?.ai) {
if (
(isPlatform &&
!currentProject?.plan?.isFree &&
!currentProject.config?.ai) ||
!isGraphiteEnabled
) {
return (
<Box className="p-4" sx={{ backgroundColor: 'background.default' }}>
<Alert className="grid w-full grid-flow-col place-content-between items-center gap-2">

View File

@@ -11,14 +11,14 @@ import { Link } from '@/components/ui/v2/Link';
import { Text } from '@/components/ui/v2/Text';
import { AutoEmbeddingsForm } from '@/features/ai/AutoEmbeddingsForm';
import { AutoEmbeddingsList } from '@/features/ai/AutoEmbeddingsList';
import { useAdminApolloClient } from '@/features/projects/common/hooks/useAdminApolloClient';
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
import { generateAppServiceUrl } from '@/features/projects/common/utils/generateAppServiceUrl';
import { getHasuraAdminSecret } from '@/utils/env';
import { useIsGraphiteEnabled } from '@/features/projects/common/hooks/useIsGraphiteEnabled';
import { useIsPlatform } from '@/features/projects/common/hooks/useIsPlatform';
import {
useGetGraphiteAutoEmbeddingsConfigurationsQuery,
type GetGraphiteAutoEmbeddingsConfigurationsQuery,
} from '@/utils/__generated__/graphite.graphql';
import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client';
import { useRouter } from 'next/router';
import { useEffect, useMemo, useRef, useState, type ReactElement } from 'react';
@@ -32,43 +32,22 @@ export default function AutoEmbeddingsPage() {
const router = useRouter();
const { openDrawer } = useDialog();
const isPlatform = useIsPlatform();
const { currentWorkspace, currentProject } = useCurrentWorkspaceAndProject();
const adminSecret = currentProject?.config?.hasura?.adminSecret;
const serviceUrl = generateAppServiceUrl(
currentProject?.subdomain,
currentProject?.region,
'graphql',
);
const client = useMemo(
() =>
new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({
uri: serviceUrl,
headers: {
'x-hasura-admin-secret':
process.env.NEXT_PUBLIC_ENV === 'dev'
? getHasuraAdminSecret()
: adminSecret,
},
}),
}),
[serviceUrl, adminSecret],
);
const { adminClient } = useAdminApolloClient();
const { isGraphiteEnabled } = useIsGraphiteEnabled();
const [currentPage, setCurrentPage] = useState(
parseInt(router.query.page as string, 10) || 1,
);
const [nrOfPages, setNrOfPages] = useState(0);
const offset = useMemo(() => currentPage - 1, [currentPage]);
const { data, loading, refetch } =
useGetGraphiteAutoEmbeddingsConfigurationsQuery({
client,
client: adminClient,
variables: {
limit: limit.current,
offset,
@@ -102,7 +81,7 @@ export default function AutoEmbeddingsPage() {
});
};
if (currentProject.plan.isFree) {
if (isPlatform && currentProject?.plan?.isFree) {
return (
<Box className="p-4" sx={{ backgroundColor: 'background.default' }}>
<UpgradeToProBanner
@@ -118,7 +97,12 @@ export default function AutoEmbeddingsPage() {
);
}
if (!currentProject.plan.isFree && !currentProject.config?.ai) {
if (
(isPlatform &&
!currentProject?.plan?.isFree &&
!currentProject.config?.ai) ||
!isGraphiteEnabled
) {
return (
<Box className="p-4" sx={{ backgroundColor: 'background.default' }}>
<Alert className="grid w-full grid-flow-col place-content-between items-center gap-2">

View File

@@ -117,7 +117,7 @@ function GraphiQLHeader({ onUserChange, onRoleChange }: GraphiQLHeaderProps) {
}
return (
<header className="grid grid-flow-row items-end gap-2 p-2 md:grid-flow-col md:justify-between">
<header className="grid items-end grid-flow-row gap-2 p-2 md:grid-flow-col md:justify-between">
<div className="grid grid-flow-row gap-2 md:grid-flow-col md:items-end">
<div className="grid grid-cols-2 gap-2 md:grid-flow-col md:grid-cols-[initial]">
<UserSelect

View File

@@ -13,10 +13,8 @@ import type { GetRunServicesQuery } from '@/utils/__generated__/graphql';
import { useGetRunServicesQuery } from '@/utils/__generated__/graphql';
import { UpgradeNotification } from '@/features/projects/common/components/UpgradeNotification';
import {
ServiceForm,
type PortTypes,
} from '@/features/services/components/ServiceForm';
import { ServiceForm } from '@/features/services/components/ServiceForm';
import { type PortTypes } from '@/features/services/components/ServiceForm/components/PortsFormSection/PortsFormSectionTypes';
import ServicesList from '@/features/services/components/ServicesList/ServicesList';
import { useRouter } from 'next/router';
import {

View File

@@ -11,7 +11,6 @@ import { Option } from '@/components/ui/v2/Option';
import { Radio } from '@/components/ui/v2/Radio';
import { RadioGroup } from '@/components/ui/v2/RadioGroup';
import { Select } from '@/components/ui/v2/Select';
import type { TextProps } from '@/components/ui/v2/Text';
import { Text } from '@/components/ui/v2/Text';
import { Tooltip } from '@/components/ui/v2/Tooltip';
import { planDescriptions } from '@/features/projects/common/utils/planDescriptions';
@@ -34,9 +33,10 @@ import {
import type { ApolloError } from '@apollo/client';
import { useUserData } from '@nhost/nextjs';
import Image from 'next/image';
import Link from 'next/link';
import { useRouter } from 'next/router';
import type { FormEvent, ReactElement } from 'react';
import { cloneElement, isValidElement, useState } from 'react';
import { useState } from 'react';
import { toast } from 'react-hot-toast';
import slugify from 'slugify';
import { twMerge } from 'tailwind-merge';
@@ -320,22 +320,22 @@ export function NewProjectPageContent({
});
}}
value={selectedRegion.id}
renderValue={(option) => {
const [flag, , country] = (option?.label as any[]) || [];
return (
<span className="inline-grid grid-flow-col grid-rows-none items-center gap-x-2">
{flag}
{isValidElement<TextProps>(country)
? cloneElement(country, {
...country.props,
variant: 'body1',
})
: null}
renderValue={() => (
<div className="relative grid grid-flow-col items-center justify-start gap-x-3">
<span className="row-span-2 flex">
<Image
src={`/assets/flags/${selectedRegion.code}.svg`}
alt={`${selectedRegion.name} country flag`}
width={16}
height={12}
/>
</span>
);
}}
<Text variant="body1" className="row-span-1">
{selectedRegion.name}
</Text>
</div>
)}
>
{regionOptions.map((option) => (
<Option
@@ -365,7 +365,7 @@ export function NewProjectPageContent({
{option.disabled && (
<Text
variant="subtitle2"
className="absolute top-1/2 right-4 -translate-y-1/2"
className="absolute right-4 top-1/2 -translate-y-1/2"
>
Disabled
</Text>
@@ -444,6 +444,19 @@ export function NewProjectPageContent({
</Tooltip>
);
})}
<Text variant="subtitle2">
Select a plan that suits your infrastructure needs.{' '}
<Link href="https://nhost.io/pricing">
<a
href="https://nhost.io/pricing"
className="underline"
target="_blank"
rel="noopener noreferrer"
>
Learn more
</a>
</Link>
</Text>
</RadioGroup>
</div>
</div>

View File

@@ -5,6 +5,7 @@ import { Button } from '@/components/ui/v2/Button';
import { Divider } from '@/components/ui/v2/Divider';
import { GitHubIcon } from '@/components/ui/v2/icons/GitHubIcon';
import { Text } from '@/components/ui/v2/Text';
import { useHostName } from '@/features/projects/common/hooks/useHostName';
import { getToastStyleProps } from '@/utils/constants/settings';
import { nhost } from '@/utils/nhost';
import type { ReactElement } from 'react';
@@ -14,6 +15,8 @@ import { toast } from 'react-hot-toast';
export default function SignUpPage() {
const [loading, setLoading] = useState(false);
const redirectTo = useHostName();
return (
<>
<Text
@@ -24,7 +27,7 @@ export default function SignUpPage() {
It&apos;s time to build
</Text>
<Box className="grid grid-flow-row gap-4 rounded-md border bg-transparent p-6 lg:p-12">
<Box className="grid grid-flow-row gap-4 p-6 bg-transparent border rounded-md lg:p-12">
<Button
className="!bg-white !text-black hover:ring-2 hover:ring-white hover:ring-opacity-50 disabled:!text-black disabled:!text-opacity-60"
startIcon={<GitHubIcon />}
@@ -35,7 +38,10 @@ export default function SignUpPage() {
setLoading(true);
try {
await nhost.auth.signIn({ provider: 'github' });
await nhost.auth.signIn({
provider: 'github',
options: { redirectTo },
});
} catch {
toast.error(
`An error occurred while trying to sign in using GitHub. Please try again later.`,
@@ -61,7 +67,7 @@ export default function SignUpPage() {
<Divider className="!my-2" />
<Text color="secondary" className="text-center text-sm">
<Text color="secondary" className="text-sm text-center">
By clicking continue, you agree to our{' '}
<NavLink
href="https://nhost.io/legal/terms-of-service"

View File

@@ -40,6 +40,7 @@ export const mockRouter: NextRouter = {
emit: vi.fn(),
},
isFallback: false,
forward: vi.fn(),
};
export const mockApplication: Project = {

View File

@@ -21,7 +21,7 @@ import {
render as rtlRender,
waitForElementToBeRemoved as rtlWaitForElementToBeRemoved,
} from '@testing-library/react';
import { RouterContext } from 'next/dist/shared/lib/router-context';
import { RouterContext } from 'next/dist/shared/lib/router-context.shared-runtime';
import type { PropsWithChildren, ReactElement } from 'react';
import { Toaster } from 'react-hot-toast';

View File

@@ -7283,6 +7283,11 @@ export type GetAssistantsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetAssistantsQuery = { __typename?: 'query_root', graphite?: { __typename?: 'graphiteQuery', assistants: Array<{ __typename?: 'graphiteAssistant', assistantID: string, name: string, description: string, model: string, instructions: string, graphql?: Array<{ __typename?: 'graphiteAssistantToolGraphQL', name: string, query: string, description: string, arguments: Array<{ __typename?: 'graphiteAssistantToolArgument', name: string, type: string, description: string, required: boolean }> }> | null, webhooks?: Array<{ __typename?: 'graphiteAssistantToolWebhook', name: string, URL: string, description: string, arguments: Array<{ __typename?: 'graphiteAssistantToolArgument', name: string, type: string, description: string, required: boolean }> }> | null }> } | null };
export type GetGraphiteSessionsQueryVariables = Exact<{ [key: string]: never; }>;
export type GetGraphiteSessionsQuery = { __typename?: 'query_root', graphite?: { __typename?: 'graphiteQuery', sessions: Array<{ __typename?: 'graphiteSession', sessionID: string }> } | null };
export type InsertAssistantMutationVariables = Exact<{
data: GraphiteAssistantInput;
}>;
@@ -7451,6 +7456,45 @@ export type GetAssistantsQueryResult = Apollo.QueryResult<GetAssistantsQuery, Ge
export function refetchGetAssistantsQuery(variables?: GetAssistantsQueryVariables) {
return { query: GetAssistantsDocument, variables: variables }
}
export const GetGraphiteSessionsDocument = gql`
query getGraphiteSessions {
graphite {
sessions {
sessionID
}
}
}
`;
/**
* __useGetGraphiteSessionsQuery__
*
* To run a query within a React component, call `useGetGraphiteSessionsQuery` and pass it any options that fit your needs.
* When your component renders, `useGetGraphiteSessionsQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useGetGraphiteSessionsQuery({
* variables: {
* },
* });
*/
export function useGetGraphiteSessionsQuery(baseOptions?: Apollo.QueryHookOptions<GetGraphiteSessionsQuery, GetGraphiteSessionsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<GetGraphiteSessionsQuery, GetGraphiteSessionsQueryVariables>(GetGraphiteSessionsDocument, options);
}
export function useGetGraphiteSessionsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetGraphiteSessionsQuery, GetGraphiteSessionsQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<GetGraphiteSessionsQuery, GetGraphiteSessionsQueryVariables>(GetGraphiteSessionsDocument, options);
}
export type GetGraphiteSessionsQueryHookResult = ReturnType<typeof useGetGraphiteSessionsQuery>;
export type GetGraphiteSessionsLazyQueryHookResult = ReturnType<typeof useGetGraphiteSessionsLazyQuery>;
export type GetGraphiteSessionsQueryResult = Apollo.QueryResult<GetGraphiteSessionsQuery, GetGraphiteSessionsQueryVariables>;
export function refetchGetGraphiteSessionsQuery(variables?: GetGraphiteSessionsQueryVariables) {
return { query: GetGraphiteSessionsDocument, variables: variables }
}
export const InsertAssistantDocument = gql`
mutation insertAssistant($data: graphiteAssistantInput!) {
graphite {

View File

@@ -14948,6 +14948,7 @@ export type Plans = {
/** An aggregate relationship */
apps_aggregate: Apps_Aggregate;
createdAt: Scalars['timestamptz'];
deprecated: Scalars['Boolean'];
featureBackupEnabled: Scalars['Boolean'];
featureCustomDomainsEnabled: Scalars['Boolean'];
featureCustomEmailTemplatesEnabled: Scalars['Boolean'];
@@ -14961,6 +14962,7 @@ export type Plans = {
/** Max number of functions to deploy per git deployment */
featureMaxNumberOfFunctionsPerDeployment: Scalars['Int'];
id: Scalars['uuid'];
individual: Scalars['Boolean'];
isDefault: Scalars['Boolean'];
isFree: Scalars['Boolean'];
isPublic: Scalars['Boolean'];
@@ -15048,6 +15050,7 @@ export type Plans_Bool_Exp = {
apps?: InputMaybe<Apps_Bool_Exp>;
apps_aggregate?: InputMaybe<Apps_Aggregate_Bool_Exp>;
createdAt?: InputMaybe<Timestamptz_Comparison_Exp>;
deprecated?: InputMaybe<Boolean_Comparison_Exp>;
featureBackupEnabled?: InputMaybe<Boolean_Comparison_Exp>;
featureCustomDomainsEnabled?: InputMaybe<Boolean_Comparison_Exp>;
featureCustomEmailTemplatesEnabled?: InputMaybe<Boolean_Comparison_Exp>;
@@ -15058,6 +15061,7 @@ export type Plans_Bool_Exp = {
featureMaxFilesSize?: InputMaybe<Int_Comparison_Exp>;
featureMaxNumberOfFunctionsPerDeployment?: InputMaybe<Int_Comparison_Exp>;
id?: InputMaybe<Uuid_Comparison_Exp>;
individual?: InputMaybe<Boolean_Comparison_Exp>;
isDefault?: InputMaybe<Boolean_Comparison_Exp>;
isFree?: InputMaybe<Boolean_Comparison_Exp>;
isPublic?: InputMaybe<Boolean_Comparison_Exp>;
@@ -15096,6 +15100,7 @@ export type Plans_Inc_Input = {
export type Plans_Insert_Input = {
apps?: InputMaybe<Apps_Arr_Rel_Insert_Input>;
createdAt?: InputMaybe<Scalars['timestamptz']>;
deprecated?: InputMaybe<Scalars['Boolean']>;
featureBackupEnabled?: InputMaybe<Scalars['Boolean']>;
featureCustomDomainsEnabled?: InputMaybe<Scalars['Boolean']>;
featureCustomEmailTemplatesEnabled?: InputMaybe<Scalars['Boolean']>;
@@ -15109,6 +15114,7 @@ export type Plans_Insert_Input = {
/** Max number of functions to deploy per git deployment */
featureMaxNumberOfFunctionsPerDeployment?: InputMaybe<Scalars['Int']>;
id?: InputMaybe<Scalars['uuid']>;
individual?: InputMaybe<Scalars['Boolean']>;
isDefault?: InputMaybe<Scalars['Boolean']>;
isFree?: InputMaybe<Scalars['Boolean']>;
isPublic?: InputMaybe<Scalars['Boolean']>;
@@ -15200,6 +15206,7 @@ export type Plans_On_Conflict = {
export type Plans_Order_By = {
apps_aggregate?: InputMaybe<Apps_Aggregate_Order_By>;
createdAt?: InputMaybe<Order_By>;
deprecated?: InputMaybe<Order_By>;
featureBackupEnabled?: InputMaybe<Order_By>;
featureCustomDomainsEnabled?: InputMaybe<Order_By>;
featureCustomEmailTemplatesEnabled?: InputMaybe<Order_By>;
@@ -15210,6 +15217,7 @@ export type Plans_Order_By = {
featureMaxFilesSize?: InputMaybe<Order_By>;
featureMaxNumberOfFunctionsPerDeployment?: InputMaybe<Order_By>;
id?: InputMaybe<Order_By>;
individual?: InputMaybe<Order_By>;
isDefault?: InputMaybe<Order_By>;
isFree?: InputMaybe<Order_By>;
isPublic?: InputMaybe<Order_By>;
@@ -15236,6 +15244,8 @@ export enum Plans_Select_Column {
/** column name */
CreatedAt = 'createdAt',
/** column name */
Deprecated = 'deprecated',
/** column name */
FeatureBackupEnabled = 'featureBackupEnabled',
/** column name */
FeatureCustomDomainsEnabled = 'featureCustomDomainsEnabled',
@@ -15256,6 +15266,8 @@ export enum Plans_Select_Column {
/** column name */
Id = 'id',
/** column name */
Individual = 'individual',
/** column name */
IsDefault = 'isDefault',
/** column name */
IsFree = 'isFree',
@@ -15288,6 +15300,7 @@ export enum Plans_Select_Column {
/** input type for updating data in table "plans" */
export type Plans_Set_Input = {
createdAt?: InputMaybe<Scalars['timestamptz']>;
deprecated?: InputMaybe<Scalars['Boolean']>;
featureBackupEnabled?: InputMaybe<Scalars['Boolean']>;
featureCustomDomainsEnabled?: InputMaybe<Scalars['Boolean']>;
featureCustomEmailTemplatesEnabled?: InputMaybe<Scalars['Boolean']>;
@@ -15301,6 +15314,7 @@ export type Plans_Set_Input = {
/** Max number of functions to deploy per git deployment */
featureMaxNumberOfFunctionsPerDeployment?: InputMaybe<Scalars['Int']>;
id?: InputMaybe<Scalars['uuid']>;
individual?: InputMaybe<Scalars['Boolean']>;
isDefault?: InputMaybe<Scalars['Boolean']>;
isFree?: InputMaybe<Scalars['Boolean']>;
isPublic?: InputMaybe<Scalars['Boolean']>;
@@ -15367,6 +15381,7 @@ export type Plans_Stream_Cursor_Input = {
/** Initial value of the column from where the streaming should start */
export type Plans_Stream_Cursor_Value_Input = {
createdAt?: InputMaybe<Scalars['timestamptz']>;
deprecated?: InputMaybe<Scalars['Boolean']>;
featureBackupEnabled?: InputMaybe<Scalars['Boolean']>;
featureCustomDomainsEnabled?: InputMaybe<Scalars['Boolean']>;
featureCustomEmailTemplatesEnabled?: InputMaybe<Scalars['Boolean']>;
@@ -15380,6 +15395,7 @@ export type Plans_Stream_Cursor_Value_Input = {
/** Max number of functions to deploy per git deployment */
featureMaxNumberOfFunctionsPerDeployment?: InputMaybe<Scalars['Int']>;
id?: InputMaybe<Scalars['uuid']>;
individual?: InputMaybe<Scalars['Boolean']>;
isDefault?: InputMaybe<Scalars['Boolean']>;
isFree?: InputMaybe<Scalars['Boolean']>;
isPublic?: InputMaybe<Scalars['Boolean']>;
@@ -15414,6 +15430,8 @@ export enum Plans_Update_Column {
/** column name */
CreatedAt = 'createdAt',
/** column name */
Deprecated = 'deprecated',
/** column name */
FeatureBackupEnabled = 'featureBackupEnabled',
/** column name */
FeatureCustomDomainsEnabled = 'featureCustomDomainsEnabled',
@@ -15434,6 +15452,8 @@ export enum Plans_Update_Column {
/** column name */
Id = 'id',
/** column name */
Individual = 'individual',
/** column name */
IsDefault = 'isDefault',
/** column name */
IsFree = 'isFree',
@@ -15700,6 +15720,12 @@ export type Query_Root = {
getLogsVolume: Metrics;
getPostgresVolumeCapacity: Metrics;
getPostgresVolumeUsage: Metrics;
/**
* Returns list of label values for a given label within a range of time.
*
* If `from` and `to` are not provided, they default to 6 hour ago and now, respectively.
*/
getServiceLabelValues: Array<Scalars['String']>;
getTotalRequests: Metrics;
getUsageAll: Array<UsageSummary>;
/** fetch data from the table: "github_app_installations" using primary key columns */
@@ -16544,6 +16570,11 @@ export type Query_RootGetPostgresVolumeUsageArgs = {
};
export type Query_RootGetServiceLabelValuesArgs = {
appID: Scalars['String'];
};
export type Query_RootGetTotalRequestsArgs = {
appID: Scalars['String'];
from?: InputMaybe<Scalars['Timestamp']>;
@@ -24465,7 +24496,7 @@ export const PrefetchNewAppDocument = gql`
regions(order_by: {city: asc}) {
...PrefetchNewAppRegions
}
plans(order_by: {sort: asc}) {
plans(order_by: {sort: asc}, where: {deprecated: {_eq: false}}) {
...PrefetchNewAppPlans
}
workspaces {

3
docs/.gitignore vendored
View File

@@ -5,7 +5,6 @@
/build
# Generated files
.docusaurus
.cache-loader
# Misc
@@ -18,5 +17,3 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vercel
docs/reference/docgen

View File

@@ -1,5 +1,17 @@
# @nhost/docs
## 2.1.0
### Minor Changes
- 65b6a48d5: feat: added graphite/cli documentation
## 2.0.0
### Major Changes
- 6d08b3430: New Docs powered by Mintlify
## 0.7.5
### Patch Changes

View File

@@ -1,37 +1,32 @@
# Nhost Docs
# Mintlify Starter Kit
This documentation describes how to build, start and test the documentation locally.
Click on `Use this template` to copy the Mintlify starter kit. The starter kit contains examples including
### Installation
- Guide pages
- Navigation
- Customizations
- API Reference pages
- Use of popular components
```bash
$ pnpm i
### Development
Install the [Mintlify CLI](https://www.npmjs.com/package/mintlify) to preview the documentation changes locally. To install, use the following command
```
npm i -g mintlify
```
### Local Development
Run the following command at the root of your documentation (where mint.json is)
```bash
$ pnpm start
```
mintlify dev
```
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
### Publishing Changes
### Build
Install our Github App to autopropagate changes from youre repo to your deployment. Changes will be deployed to production automatically after pushing to the default branch. Find the link to install on your dashboard.
```bash
$ pnpm build
```
#### Troubleshooting
This command generates static content into the `build` directory and can be served using any static contents hosting service.
### Serve
```bash
$ pnpm serve
```
This command serves the static content from the `build` directory.
### Contributing
All pull requests are greatly appreciated! See our [contributing guide](https://github.com/nhost/nhost/blob/main/CONTRIBUTING.md) to get started.
- Mintlify dev isn't running - Run `mintlify install` it'll re-install dependencies.
- Page loads as a 404 - Make sure you are running in a folder with `mint.json`

View File

@@ -0,0 +1,3 @@
## My Snippet
<Info>This is an example of a reusable snippet</Info>

View File

@@ -1,3 +0,0 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};

View File

@@ -0,0 +1,162 @@
---
title: Commands
description: Available commands to run and manage local Nhost projects
icon: rectangle-code
---
## `nhost init`
Initializes current directory with a new project containing configuration and objects necessary to run Nhost locally.
<Accordion title="Output">
Initializing Nhost project
Successfully initialized Nhost project, run `nhost up` to start development
</Accordion>
### Flags
`--remote` optional `false` <br />
Pulls state from a remote Nhost instance.
## `nhost up`
Starts Nhost for development and testing purposes. Requires scaffolding from `nhost init`.
<Accordion title="Output">
```
Nhost development environment started.
URLs:
- Postgres: postgres://postgres:postgres@localhost:5432/local
- Hasura: https://local.hasura.nhost.run
- GraphQL: https://local.graphql.nhost.run
- Auth: https://local.auth.nhost.run
- Storage: https://local.storage.nhost.run
- Functions: https://local.functions.nhost.run
- Dashboard: https://local.dashboard.nhost.run
- Mailhog: https://local.mailhog.nhost.run
SDK Configuration:
Subdomain: local
Region: (empty)
Run `nhost up` to reload the development environment
Run `nhost down` to stop the development environment
Run `nhost logs` to watch the logs
```
</Accordion>
## `nhost down`
Stops all services and deletes all containers.
### Flags
`--volumes` optional `false` <br />
Remove volumes.
## `nhost login`
Login to an Nhost account to perform authenticated operations.
<Accordion title="Output">
- email: user@domain.com
- password:
Authenticating <br />
Successfully logged in, creating PAT <br />
Successfully created PAT <br />
Storing PAT for future user
</Accordion>
### Flags
`--email` optional <br />
Email adress.
`--password` optional <br />
Password.
`--pat` optional <br />
Use this Personal Access Token instead of generating a new one with email/password.
## `nhost logs`
Render all logs.
<Accordion title="Output">
```
app-auth-1 | {"level":"info","message":"Applying SQL migrations..."}
app-auth-1 | {"level":"info","message":"SQL migrations applied"}
app-auth-1 | {"level":"info","message":"Applying metadata..."}
app-auth-1 | {"level":"info","message":"Metadata applied"}
app-auth-1 | {"level":"info","message":"Running on port 4000"}
```
</Accordion>
### Flags
`--follow` optional <br />
Follow (or tail) log output.
`--no-color` optional <br />
Produce monochrome output.
`--no-log-prefix` optional <br />
Don't print prefix in logs.
`--since` optional <br />
Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)
`--tail` optional `all`<br />
Number of lines to show from the end of the logs for each service
`--timestamps` optional <br />
Show timestamps
`--until` optional <br />
Show logs before a timestamp
## `nhost list`
List all remote Nhost projects this user has access to.
<Accordion title="Output">
```
# │ Subdomain │ Project │ Workspace │ Region │
1 │ dahvgwlspuridghplrso │ nbp │ Nuno's Workspace │ eu-central-1 │
2 │ mhmvhergiiycqfvhisan │ Bun Generator │ Nhost Examples │ eu-central-1 │
4 │ qaxzubvwbuhzgxswghug │ Next.js Stripe Starter Template │ Nhost Examples │ eu-central-1 │
5 │ cuzwcdqwgmhbxqetfbci │ Nhost Netlify Starter Template │ Nhost Examples │ us-east-1 │
6 │ jsjiiuwiuqdvvwgwhxnx │ quickstarts │ Nhost Examples │ eu-central-1 │
7 │ vvhjnsgebtspueuuxnvp │ React Apollo │ Nhost Examples │ eu-central-1 │
9 │ vue-quickstart │ vue-quickstart │ Nhost Examples │ eu-central-1 │
11 │ odqlmnqxospbvqvphuyl │ monitoring-app-frankfurt │ monitoring │ eu-central-1 │
12 │ xmhqdbhkvskuubnelgkc │ monitoring-app-london │ monitoring │ eu-west-2 │
13 │ jjetetkbmovfgyewremk │ monitoring-app-mumbai │ monitoring │ ap-south-1 │
```
</Accordion>
## `nhost secrets`
Manage secrets in the Nhost cloud.
### `nhost secrets create`
#### Flags
<Accordion title="Output">
</Accordion>

View File

@@ -0,0 +1,87 @@
---
title: Nhost CLI
description: Tools to develop and test Nhost projects locally
icon: square-terminal
---
## Instaling the Nhost CLI
To install the Nhost CLI copy the following command and paste it into your terminal:
```bash
> sudo curl -L https://raw.githubusercontent.com/nhost/cli/main/get.sh | bash
```
The `get.sh` script checks for both the architecture and operating system and installs the right binary.
### Supported Platforms:
- MacOS
- Linux
- Windows WSL2
### Dependencies:
- [Docker](https://docs.docker.com/get-docker/)
- [curl](https://curl.se/)
- [Git](https://git-scm.com/downloads)
## Updating the Nhost CLI
Update an existing installation to the latest version.
```bash Terminal
> nhost sw upgrade
```
## Running Nhost
Inside of the folder where you want to create your project, run:
```bash Terminal
> nhost init
Initializing Nhost project
Successfully initialized Nhost project, run `nhost up` to start development
```
`init` will scaffold a bunch of files that Nhost uses to manage configuration, database schema and migrations, APIs, functions, etc.
With the project scaffolding in place, start the local Nhost instance with `nhost up`:
```bash Terminal
> nhost up
Nhost development environment started.
URLs:
- Postgres: postgres://postgres:postgres@localhost:5432/local
- Hasura: https://local.hasura.nhost.run
- GraphQL: https://local.graphql.nhost.run
- Auth: https://local.auth.nhost.run
- Storage: https://local.storage.nhost.run
- Functions: https://local.functions.nhost.run
- Dashboard: https://local.dashboard.nhost.run
- Mailhog: https://local.mailhog.nhost.run
SDK Configuration:
Subdomain: local
Region: (empty)
Run `nhost up` to reload the development environment
Run `nhost down` to stop the development environment
Run `nhost logs` to watch the logs
```
The following services are started:
- Postgres
- Hasura Console
- GraphQL API
- Authentication
- Storage
- Functions
- Dashboard
- Mailhog (SMTP server for testing emails locally)
<Info>Support for Nhost Run services is coming soon</Info>

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