Compare commits
74 Commits
@nhost/rea
...
@nhost/das
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cca8de5805 | ||
|
|
8c065c42d6 | ||
|
|
210af3a3e8 | ||
|
|
fbb12a8079 | ||
|
|
77692ac40e | ||
|
|
2c2a42a8e8 | ||
|
|
a8466798a3 | ||
|
|
a45c0970bb | ||
|
|
9bf30a1ccc | ||
|
|
99d3d82c72 | ||
|
|
43acb3fb50 | ||
|
|
ba9ef13ba3 | ||
|
|
cea507a271 | ||
|
|
9130ab1230 | ||
|
|
27acdd6f56 | ||
|
|
dcdacd73ec | ||
|
|
9c9966a30f | ||
|
|
5a23e7a0a8 | ||
|
|
47500fac39 | ||
|
|
cbbf53c05b | ||
|
|
11bd011860 | ||
|
|
e3c0c47777 | ||
|
|
d825404b54 | ||
|
|
d46d77ee71 | ||
|
|
a292482705 | ||
|
|
8a4ca41172 | ||
|
|
fd3ce98600 | ||
|
|
04f36a0491 | ||
|
|
5e2ecb4d1e | ||
|
|
eca9e551e8 | ||
|
|
52ebbef762 | ||
|
|
82faa4ca0a | ||
|
|
d06a21764a | ||
|
|
8b54d290a5 | ||
|
|
4cfa6bbe1e | ||
|
|
614f213e26 | ||
|
|
4eebf51821 | ||
|
|
9a52298aa7 | ||
|
|
099eebe602 | ||
|
|
7cce8652e7 | ||
|
|
f2e2323801 | ||
|
|
4e16de6db2 | ||
|
|
798e591b1d | ||
|
|
b48bc034ca | ||
|
|
f57819230b | ||
|
|
3d8067ff7b | ||
|
|
0fa4b428a9 | ||
|
|
8c5864340e | ||
|
|
c131100af9 | ||
|
|
e363fef8cf | ||
|
|
d8072101c8 | ||
|
|
afbba531a1 | ||
|
|
a9e9fc4305 | ||
|
|
c547b490e5 | ||
|
|
4f4449b855 | ||
|
|
ae19105302 | ||
|
|
730a482598 | ||
|
|
253dd235ca | ||
|
|
991e8f2d15 | ||
|
|
e500e87022 | ||
|
|
c684d0307b | ||
|
|
2d657b9c29 | ||
|
|
f46d96bafc | ||
|
|
8261743bd3 | ||
|
|
34cf1d79a0 | ||
|
|
9d4542b3db | ||
|
|
bb5dbdf5a3 | ||
|
|
2801b03bf4 | ||
|
|
8298d458d5 | ||
|
|
6e9b941b89 | ||
|
|
5dd25941e5 | ||
|
|
cfcb97b8ee | ||
|
|
a1ffad77eb | ||
|
|
de4d59da99 |
87
.github/workflows/ci.yaml
vendored
87
.github/workflows/ci.yaml
vendored
@@ -19,6 +19,11 @@ env:
|
||||
NEXT_PUBLIC_ENV: dev
|
||||
NEXT_TELEMETRY_DISABLED: 1
|
||||
NEXT_PUBLIC_NHOST_BACKEND_URL: http://localhost:1337
|
||||
NHOST_TEST_DASHBOARD_URL: ${{ vars.NHOST_TEST_DASHBOARD_URL }}
|
||||
NHOST_TEST_WORKSPACE_NAME: ${{ vars.NHOST_TEST_WORKSPACE_NAME }}
|
||||
NHOST_TEST_PROJECT_NAME: ${{ vars.NHOST_TEST_PROJECT_NAME }}
|
||||
NHOST_TEST_USER_EMAIL: ${{ secrets.NHOST_TEST_USER_EMAIL }}
|
||||
NHOST_TEST_USER_PASSWORD: ${{ secrets.NHOST_TEST_USER_PASSWORD }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -60,47 +65,6 @@ jobs:
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
|
||||
e2e:
|
||||
name: 'e2e (${{ matrix.package.path }})'
|
||||
needs: build
|
||||
if: ${{ needs.build.outputs.matrix != '[]' && needs.build.outputs.matrix != '' }}
|
||||
strategy:
|
||||
# * Don't cancel other matrices when one fails
|
||||
fail-fast: false
|
||||
matrix:
|
||||
package: ${{ fromJson(needs.build.outputs.matrix) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# * Install Node and dependencies. Package dependencies won't be downloaded again as they have been cached by the `build` job.
|
||||
- name: Install Node and dependencies
|
||||
uses: ./.github/actions/install-dependencies
|
||||
with:
|
||||
TURBO_TOKEN: ${{ env.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ env.TURBO_TEAM }}
|
||||
# * Install Nhost CLI if a `nhost/config.yaml` file is found
|
||||
- name: Install Nhost CLI
|
||||
if: hashFiles(format('{0}/nhost/config.yaml', matrix.package.path)) != ''
|
||||
uses: ./.github/actions/nhost-cli
|
||||
# * Run the `ci` script of the current package of the matrix. Dependencies build is cached by Turborepo
|
||||
- name: Run e2e test
|
||||
run: pnpm --filter="${{ matrix.package.name }}" run e2e
|
||||
- id: file-name
|
||||
if: ${{ failure() }}
|
||||
name: Tranform package name into a valid file name
|
||||
run: |
|
||||
PACKAGE_FILE_NAME=$(echo "${{ matrix.package.name }}" | sed 's/@//g; s/\//-/g')
|
||||
echo "fileName=$PACKAGE_FILE_NAME" >> $GITHUB_OUTPUT
|
||||
# * Run this step only if the previous step failed, and some Cypress screenshots/videos exist
|
||||
- name: Upload Cypress videos and screenshots
|
||||
if: ${{ failure() && hashFiles(format('{0}/cypress/screenshots/**', matrix.package.path), format('{0}/cypress/videos/**', matrix.package.path)) != ''}}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cypress-${{ steps.file-name.outputs.fileName }}
|
||||
path: |
|
||||
${{format('{0}/cypress/screenshots/**', matrix.package.path)}}
|
||||
${{format('{0}/cypress/videos/**', matrix.package.path)}}
|
||||
|
||||
unit:
|
||||
name: Unit tests
|
||||
needs: build
|
||||
@@ -141,3 +105,44 @@ jobs:
|
||||
# * Run every `lint` script in the workspace . Dependencies build is cached by Turborepo
|
||||
- name: Lint
|
||||
run: pnpm run lint:all
|
||||
|
||||
e2e:
|
||||
name: 'E2E (Package: ${{ matrix.package.path }})'
|
||||
needs: build
|
||||
if: ${{ needs.build.outputs.matrix != '[]' && needs.build.outputs.matrix != '' }}
|
||||
strategy:
|
||||
# * Don't cancel other matrices when one fails
|
||||
fail-fast: false
|
||||
matrix:
|
||||
package: ${{ fromJson(needs.build.outputs.matrix) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# * Install Node and dependencies. Package dependencies won't be downloaded again as they have been cached by the `build` job.
|
||||
- name: Install Node and dependencies
|
||||
uses: ./.github/actions/install-dependencies
|
||||
with:
|
||||
TURBO_TOKEN: ${{ env.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ env.TURBO_TEAM }}
|
||||
# * Install Nhost CLI if a `nhost/config.yaml` file is found
|
||||
- name: Install Nhost CLI
|
||||
if: hashFiles(format('{0}/nhost/config.yaml', matrix.package.path)) != ''
|
||||
uses: ./.github/actions/nhost-cli
|
||||
# * Run the `ci` script of the current package of the matrix. Dependencies build is cached by Turborepo
|
||||
- name: Run e2e test
|
||||
run: pnpm --filter="${{ matrix.package.name }}" run e2e
|
||||
- id: file-name
|
||||
if: ${{ failure() }}
|
||||
name: Tranform package name into a valid file name
|
||||
run: |
|
||||
PACKAGE_FILE_NAME=$(echo "${{ matrix.package.name }}" | sed 's/@//g; s/\//-/g')
|
||||
echo "fileName=$PACKAGE_FILE_NAME" >> $GITHUB_OUTPUT
|
||||
# * Run this step only if the previous step failed, and some Cypress screenshots/videos exist
|
||||
- name: Upload Cypress videos and screenshots
|
||||
if: ${{ failure() && hashFiles(format('{0}/cypress/screenshots/**', matrix.package.path), format('{0}/cypress/videos/**', matrix.package.path)) != ''}}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: cypress-${{ steps.file-name.outputs.fileName }}
|
||||
path: |
|
||||
${{format('{0}/cypress/screenshots/**', matrix.package.path)}}
|
||||
${{format('{0}/cypress/videos/**', matrix.package.path)}}
|
||||
|
||||
1
.github/workflows/dashboard.yaml
vendored
1
.github/workflows/dashboard.yaml
vendored
@@ -9,6 +9,7 @@ env:
|
||||
NEXT_PUBLIC_ENV: dev
|
||||
NEXT_TELEMETRY_DISABLED: 1
|
||||
NEXT_PUBLIC_NHOST_BACKEND_URL: http://localhost:1337
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
|
||||
6
dashboard/.gitignore
vendored
6
dashboard/.gitignore
vendored
@@ -49,4 +49,8 @@ tailwind.json
|
||||
.idea
|
||||
|
||||
# Do not ignore Logs page
|
||||
!src/**/logs*
|
||||
!src/**/logs*
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
/playwright/.cache/
|
||||
storageState.json
|
||||
@@ -1,5 +1,31 @@
|
||||
# @nhost/dashboard
|
||||
|
||||
## 0.13.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9130ab12: chore(dashboard): bump `yup` to v1 and `@hookform/resolvers` to v3
|
||||
|
||||
## 0.13.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 253dd235: using new mutation to create projects + refactor Create Project page.
|
||||
|
||||
## 0.13.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react-apollo@5.0.12
|
||||
- @nhost/nextjs@1.13.17
|
||||
|
||||
## 0.13.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- b48bc034: fix(dashboard): disable new users
|
||||
- 798e591b: fix(dashboard): show correct date in data grid
|
||||
|
||||
## 0.13.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -111,3 +111,21 @@ pnpm storybook
|
||||
| `@typescript-eslint/consistent-type-imports` | Enforces `import type { Type } from 'module'` syntax. It prevents false positive circular dependency errors. |
|
||||
| `@typescript-eslint/naming-convention` | Enforces a consistent naming convention. |
|
||||
| `no-restricted-imports` | Enforces absolute imports and consistent import paths for components from `src/components/ui` folder. |
|
||||
|
||||
### End-to-End Tests
|
||||
|
||||
End-to-end tests are written using [Playwright](https://playwright.dev/). To run the tests, run the following command:
|
||||
|
||||
```bash
|
||||
pnpm e2e
|
||||
```
|
||||
|
||||
Most of the tests require access to the Nhost test user. To run these tests, you need to set the following environment variables in `.env.test`:
|
||||
|
||||
```
|
||||
NHOST_TEST_DASHBOARD_URL=<test_dashboard_url>
|
||||
NHOST_TEST_USER_EMAIL=<test_user_email>
|
||||
NHOST_TEST_USER_PASSWORD=<test_user_password>
|
||||
NHOST_TEST_WORKSPACE_NAME=<test_workspace_name>
|
||||
NHOST_TEST_PROJECT_NAME=<test_project_name>
|
||||
```
|
||||
|
||||
92
dashboard/e2e/auth.test.ts
Normal file
92
dashboard/e2e/auth.test.ts
Normal file
@@ -0,0 +1,92 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
import {
|
||||
TEST_DASHBOARD_URL,
|
||||
TEST_PROJECT_NAME,
|
||||
TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from './env';
|
||||
|
||||
let page: Page;
|
||||
|
||||
test.describe.configure({ mode: 'serial' });
|
||||
|
||||
test.beforeAll(async ({ browser }) => {
|
||||
page = await browser.newPage();
|
||||
|
||||
await page.goto(TEST_DASHBOARD_URL);
|
||||
await page.getByRole('link', { name: TEST_PROJECT_NAME }).click();
|
||||
await page.waitForURL(
|
||||
`${TEST_DASHBOARD_URL}/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}`,
|
||||
);
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /auth/i })
|
||||
.click();
|
||||
|
||||
await page.waitForURL(
|
||||
`${TEST_DASHBOARD_URL}/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}/users`,
|
||||
);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await page.close();
|
||||
});
|
||||
|
||||
test('should create a user', async () => {
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /there are no users yet/i }),
|
||||
).toBeVisible();
|
||||
|
||||
await page
|
||||
.getByRole('button', { name: /create user/i })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
await expect(page.getByRole('dialog')).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /create user/i }),
|
||||
).toBeVisible();
|
||||
|
||||
await page
|
||||
.getByRole('textbox', { name: /email/i })
|
||||
.fill('testuser@example.com');
|
||||
await page.getByRole('textbox', { name: /password/i }).fill('test.password');
|
||||
await page.getByRole('button', { name: /create/i, exact: true }).click();
|
||||
|
||||
await expect(page.getByRole('dialog')).not.toBeVisible();
|
||||
|
||||
await expect(
|
||||
page.getByRole('button', { name: /view testuser@example.com/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should delete a user', async () => {
|
||||
await expect(
|
||||
page.getByRole('button', { name: /view testuser@example.com/i }),
|
||||
).toBeVisible();
|
||||
|
||||
await page
|
||||
.getByRole('button', { name: /more options for testuser@example.com/i })
|
||||
.click();
|
||||
await page.getByRole('menuitem', { name: /delete user/i }).click();
|
||||
|
||||
await expect(page.getByRole('dialog')).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /delete user/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(
|
||||
/are you sure you want to delete the "testuser@example.com" user?/i,
|
||||
),
|
||||
).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: /delete/i, exact: true }).click();
|
||||
|
||||
await expect(page.getByRole('dialog')).not.toBeVisible();
|
||||
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /there are no users yet/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
42
dashboard/e2e/env.ts
Normal file
42
dashboard/e2e/env.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import slugify from 'slugify';
|
||||
|
||||
/**
|
||||
* URL of the dashboard to test against.
|
||||
*/
|
||||
export const TEST_DASHBOARD_URL = process.env.NHOST_TEST_DASHBOARD_URL;
|
||||
|
||||
/**
|
||||
* Name of the workspace to test against.
|
||||
*/
|
||||
export const TEST_WORKSPACE_NAME = process.env.NHOST_TEST_WORKSPACE_NAME;
|
||||
|
||||
/**
|
||||
* Slugified name of the workspace to test against.
|
||||
*/
|
||||
export const TEST_WORKSPACE_SLUG = slugify(TEST_WORKSPACE_NAME, {
|
||||
lower: true,
|
||||
strict: true,
|
||||
});
|
||||
|
||||
/**
|
||||
* Name of the project to test against.
|
||||
*/
|
||||
export const TEST_PROJECT_NAME = process.env.NHOST_TEST_PROJECT_NAME;
|
||||
|
||||
/**
|
||||
* Slugified name of the project to test against.
|
||||
*/
|
||||
export const TEST_PROJECT_SLUG = slugify(TEST_PROJECT_NAME, {
|
||||
lower: true,
|
||||
strict: true,
|
||||
});
|
||||
|
||||
/**
|
||||
* Email of the test account to use.
|
||||
*/
|
||||
export const TEST_USER_EMAIL = process.env.NHOST_TEST_USER_EMAIL;
|
||||
|
||||
/**
|
||||
* Password of the test account to use.
|
||||
*/
|
||||
export const TEST_USER_PASSWORD = process.env.NHOST_TEST_USER_PASSWORD;
|
||||
107
dashboard/e2e/overview.test.ts
Normal file
107
dashboard/e2e/overview.test.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
import {
|
||||
TEST_DASHBOARD_URL,
|
||||
TEST_PROJECT_NAME,
|
||||
TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_NAME,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from './env';
|
||||
|
||||
let page: Page;
|
||||
|
||||
test.beforeAll(async ({ browser }) => {
|
||||
page = await browser.newPage();
|
||||
|
||||
await page.goto(TEST_DASHBOARD_URL);
|
||||
await page.getByRole('link', { name: TEST_PROJECT_NAME }).click();
|
||||
await page.waitForURL(
|
||||
`${TEST_DASHBOARD_URL}/${TEST_WORKSPACE_SLUG}/${TEST_PROJECT_SLUG}`,
|
||||
);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await page.close();
|
||||
});
|
||||
|
||||
test('should show a sidebar with menu items', async () => {
|
||||
const navLocator = page.getByRole('navigation', { name: /main navigation/i });
|
||||
await expect(navLocator).toBeVisible();
|
||||
await expect(navLocator.getByRole('list').getByRole('listitem')).toHaveCount(
|
||||
10,
|
||||
);
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /overview/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /database/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /graphql/i }),
|
||||
).toBeVisible();
|
||||
await expect(navLocator.getByRole('link', { name: /hasura/i })).toBeVisible();
|
||||
await expect(navLocator.getByRole('link', { name: /auth/i })).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /storage/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /deployments/i }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /backups/i }),
|
||||
).toBeVisible();
|
||||
await expect(navLocator.getByRole('link', { name: /logs/i })).toBeVisible();
|
||||
await expect(
|
||||
navLocator.getByRole('link', { name: /settings/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should show a header with a logo, the workspace name, and the project name', async () => {
|
||||
await expect(
|
||||
page.getByRole('banner').getByRole('link', { name: TEST_WORKSPACE_NAME }),
|
||||
).toBeVisible();
|
||||
|
||||
await expect(
|
||||
page.getByRole('banner').getByRole('link', { name: TEST_PROJECT_NAME }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("should show the project's name, the Upgrade button and the Settings button", async () => {
|
||||
await expect(
|
||||
page.getByRole('heading', { name: TEST_PROJECT_NAME }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText(/free plan/i)).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: /upgrade/i })).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole('main').getByRole('link', { name: /settings/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("should show the project's region and subdomain", async () => {
|
||||
await expect(page.locator('p:has-text("Region") + div p').nth(0)).toHaveText(
|
||||
/frankfurt \(eu-central-1\)/i,
|
||||
);
|
||||
await expect(
|
||||
page.locator('p:has-text("Subdomain") + div p').nth(0),
|
||||
).toHaveText(/[a-z]{20}/i);
|
||||
});
|
||||
|
||||
test('should not have a GitHub repository connected', async () => {
|
||||
await expect(
|
||||
page.getByRole('button', { name: /connect to github/i }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should show proper limits for the free project', async () => {
|
||||
// Limit for Database
|
||||
await expect(page.getByText(/of 500 MB/i)).toBeVisible();
|
||||
|
||||
// Limit for Storage
|
||||
await expect(page.getByText(/of 1 GB/i)).toBeVisible();
|
||||
|
||||
// Limit for Users
|
||||
await expect(page.getByText(/of 10000/i)).toBeVisible();
|
||||
|
||||
// Limit for Functions
|
||||
await expect(page.getByText(/of 10$/i, { exact: true })).toBeVisible();
|
||||
});
|
||||
27
dashboard/global-setup.ts
Normal file
27
dashboard/global-setup.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { chromium } from '@playwright/test';
|
||||
import {
|
||||
TEST_DASHBOARD_URL,
|
||||
TEST_USER_EMAIL,
|
||||
TEST_USER_PASSWORD,
|
||||
} from './e2e/env';
|
||||
|
||||
async function globalSetup() {
|
||||
const browser = await chromium.launch();
|
||||
const page = await browser.newPage();
|
||||
|
||||
await page.goto(TEST_DASHBOARD_URL);
|
||||
await page.waitForURL(`${TEST_DASHBOARD_URL}/signin`);
|
||||
await page.getByRole('link', { name: /continue with email/i }).click();
|
||||
|
||||
await page.waitForURL(`${TEST_DASHBOARD_URL}/signin/email`);
|
||||
await page.getByLabel('Email').fill(TEST_USER_EMAIL);
|
||||
await page.getByLabel('Password').fill(TEST_USER_PASSWORD);
|
||||
await page.getByRole('button', { name: /sign in/i }).click();
|
||||
|
||||
await page.waitForURL(TEST_DASHBOARD_URL);
|
||||
await page.context().storageState({ path: 'storageState.json' });
|
||||
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
export default globalSetup;
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/dashboard",
|
||||
"version": "0.13.3",
|
||||
"version": "0.13.7",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
@@ -14,7 +14,8 @@
|
||||
"nhost:dev": "nhost dev -d",
|
||||
"format": "prettier --write \"src/**/*.{js,ts,tsx,jsx,json,md}\" --plugin-search-dir=.",
|
||||
"storybook": "start-storybook -p 6006 -s public",
|
||||
"build-storybook": "build-storybook"
|
||||
"build-storybook": "build-storybook",
|
||||
"e2e": "npx playwright@1.31.2 install --with-deps && playwright test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.7.3",
|
||||
@@ -29,7 +30,7 @@
|
||||
"@graphiql/toolkit": "^0.8.2",
|
||||
"@headlessui/react": "^1.6.5",
|
||||
"@heroicons/react": "^1.0.6",
|
||||
"@hookform/resolvers": "^2.9.10",
|
||||
"@hookform/resolvers": "^3.0.0",
|
||||
"@mui/base": "^5.0.0-alpha.106",
|
||||
"@mui/material": "^5.10.14",
|
||||
"@mui/system": "^5.10.14",
|
||||
@@ -76,7 +77,7 @@
|
||||
"tailwind-merge": "^1.8.0",
|
||||
"utility-types": "^3.10.0",
|
||||
"validator": "^13.7.0",
|
||||
"yup": "^0.32.11",
|
||||
"yup": "^1.0.2",
|
||||
"yup-password": "^0.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -87,6 +88,7 @@
|
||||
"@graphql-codegen/typescript-operations": "^3.0.0",
|
||||
"@graphql-codegen/typescript-react-apollo": "^3.3.1",
|
||||
"@next/bundle-analyzer": "^12.3.1",
|
||||
"@playwright/test": "^1.31.2",
|
||||
"@storybook/addon-actions": "^6.5.14",
|
||||
"@storybook/addon-essentials": "^6.5.14",
|
||||
"@storybook/addon-interactions": "^6.5.14",
|
||||
@@ -116,6 +118,7 @@
|
||||
"babel-loader": "^8.3.0",
|
||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
||||
"csstype": "^3.0.10",
|
||||
"dotenv": "^16.0.3",
|
||||
"encoding": "^0.1.13",
|
||||
"eslint": "^8.28.0",
|
||||
"eslint-config-airbnb": "19.0.4",
|
||||
@@ -161,4 +164,4 @@
|
||||
"msw": {
|
||||
"workerDirectory": "public"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
64
dashboard/playwright.config.ts
Normal file
64
dashboard/playwright.config.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
import dotenv from 'dotenv';
|
||||
import path from 'path';
|
||||
|
||||
dotenv.config({ path: path.resolve(__dirname, '.env.test') });
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './e2e',
|
||||
timeout: 30 * 1000,
|
||||
expect: {
|
||||
timeout: 5000,
|
||||
},
|
||||
fullyParallel: true,
|
||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||
forbidOnly: !!process.env.CI,
|
||||
/* Retry on CI only */
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
/* Opt out of parallel tests on CI. */
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
reporter: 'html',
|
||||
globalSetup: require.resolve('./global-setup'),
|
||||
use: {
|
||||
actionTimeout: 0,
|
||||
trace: 'on-first-retry',
|
||||
storageState: 'storageState.json',
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
|
||||
// {
|
||||
// name: 'firefox',
|
||||
// use: { ...devices['Desktop Firefox'] },
|
||||
// },
|
||||
|
||||
// {
|
||||
// name: 'webkit',
|
||||
// use: { ...devices['Desktop Safari'] },
|
||||
// },
|
||||
|
||||
/* Test against mobile viewports. */
|
||||
// {
|
||||
// name: 'Mobile Chrome',
|
||||
// use: { ...devices['Pixel 5'] },
|
||||
// },
|
||||
// {
|
||||
// name: 'Mobile Safari',
|
||||
// use: { ...devices['iPhone 12'] },
|
||||
// },
|
||||
|
||||
/* Test against branded browsers. */
|
||||
// {
|
||||
// name: 'Microsoft Edge',
|
||||
// use: { channel: 'msedge' },
|
||||
// },
|
||||
// {
|
||||
// name: 'Google Chrome',
|
||||
// use: { channel: 'chrome' },
|
||||
// },
|
||||
],
|
||||
});
|
||||
@@ -9,28 +9,39 @@ import Link from '@/ui/v2/Link';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import { copy } from '@/utils/copy';
|
||||
import { getApplicationStatusString } from '@/utils/helpers';
|
||||
import { triggerToast } from '@/utils/toast';
|
||||
import getServerError from '@/utils/settings/getServerError';
|
||||
import { formatDistance } from 'date-fns';
|
||||
import { useRouter } from 'next/router';
|
||||
import { toast } from 'react-hot-toast';
|
||||
|
||||
export default function ApplicationInfo() {
|
||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||
const [deleteApplication, { client }] = useDeleteApplicationMutation({
|
||||
const [deleteApplication] = useDeleteApplicationMutation({
|
||||
refetchQueries: [GetOneUserDocument],
|
||||
});
|
||||
const router = useRouter();
|
||||
|
||||
async function handleClickRemove() {
|
||||
await deleteApplication({
|
||||
variables: {
|
||||
appId: currentApplication.id,
|
||||
},
|
||||
});
|
||||
await router.push('/');
|
||||
await client.refetchQueries({
|
||||
include: ['getOneUser'],
|
||||
});
|
||||
triggerToast(`${currentApplication.name} deleted`);
|
||||
try {
|
||||
await toast.promise(
|
||||
deleteApplication({
|
||||
variables: {
|
||||
appId: currentApplication.id,
|
||||
},
|
||||
}),
|
||||
{
|
||||
loading: 'Deleting project...',
|
||||
success: 'The project has been deleted successfully.',
|
||||
error: getServerError(
|
||||
'An error occurred while deleting the project. Please try again.',
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
await router.push('/');
|
||||
} catch {
|
||||
// Note: The toast will handle the error.
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,54 +3,81 @@ import { ChangePlanModal } from '@/components/applications/ChangePlanModal';
|
||||
import { StagingMetadata } from '@/components/applications/StagingMetadata';
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import Container from '@/components/layout/Container';
|
||||
import { useUpdateApplicationMutation } from '@/generated/graphql';
|
||||
import {
|
||||
GetOneUserDocument,
|
||||
useGetFreeAndActiveProjectsQuery,
|
||||
useUnpauseApplicationMutation,
|
||||
} from '@/generated/graphql';
|
||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||
import { ApplicationStatus } from '@/types/application';
|
||||
import { Modal } from '@/ui';
|
||||
import { Alert } from '@/ui/Alert';
|
||||
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
|
||||
import Box from '@/ui/v2/Box';
|
||||
import Button from '@/ui/v2/Button';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import { discordAnnounce } from '@/utils/discordAnnounce';
|
||||
import { triggerToast } from '@/utils/toast';
|
||||
import { updateOwnCache } from '@/utils/updateOwnCache';
|
||||
import { MAX_FREE_PROJECTS } from '@/utils/CONSTANTS';
|
||||
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
|
||||
import type { ApolloError } from '@apollo/client';
|
||||
import { useUserData } from '@nhost/nextjs';
|
||||
import Image from 'next/image';
|
||||
import { useState } from 'react';
|
||||
import { toast } from 'react-hot-toast';
|
||||
import { RemoveApplicationModal } from './RemoveApplicationModal';
|
||||
|
||||
export default function ApplicationPaused() {
|
||||
const { openAlertDialog } = useDialog();
|
||||
const { currentWorkspace, currentApplication } =
|
||||
useCurrentWorkspaceAndApplication();
|
||||
const [changingApplicationStateLoading, setChangingApplicationStateLoading] =
|
||||
useState(false);
|
||||
const [updateApplication, { client }] = useUpdateApplicationMutation();
|
||||
const { id, email } = useUserData();
|
||||
const { id } = useUserData();
|
||||
const isOwner = currentWorkspace.members.some(
|
||||
({ userId, type }) => userId === id && type === 'owner',
|
||||
);
|
||||
const isPro = currentApplication.plan.name === 'Pro';
|
||||
const [showDeletingModal, setShowDeletingModal] = useState(false);
|
||||
const [unpauseApplication, { loading: changingApplicationStateLoading }] =
|
||||
useUnpauseApplicationMutation({
|
||||
refetchQueries: [GetOneUserDocument],
|
||||
});
|
||||
|
||||
const { data, loading } = useGetFreeAndActiveProjectsQuery({
|
||||
variables: { userId: id },
|
||||
fetchPolicy: 'cache-and-network',
|
||||
});
|
||||
|
||||
const numberOfFreeAndLiveProjects = data?.freeAndActiveProjects.length || 0;
|
||||
const wakeUpDisabled = numberOfFreeAndLiveProjects >= MAX_FREE_PROJECTS;
|
||||
|
||||
async function handleTriggerUnpausing() {
|
||||
setChangingApplicationStateLoading(true);
|
||||
try {
|
||||
await updateApplication({
|
||||
variables: {
|
||||
appId: currentApplication.id,
|
||||
app: {
|
||||
desiredState: ApplicationStatus.Live,
|
||||
await toast.promise(
|
||||
unpauseApplication({ variables: { appId: currentApplication.id } }),
|
||||
{
|
||||
loading: 'Starting the project...',
|
||||
success: `The project has been started successfully.`,
|
||||
error: (arg: ApolloError) => {
|
||||
// we need to get the internal error message from the GraphQL error
|
||||
const { internal } = arg.graphQLErrors[0]?.extensions || {};
|
||||
const { message } = (internal as Record<string, any>)?.error || {};
|
||||
|
||||
// we use the default Apollo error message if we can't find the
|
||||
// internal error message
|
||||
return (
|
||||
message ||
|
||||
arg.message ||
|
||||
'An error occurred while waking up the project. Please try again.'
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
await updateOwnCache(client);
|
||||
discordAnnounce(
|
||||
`App ${currentApplication.name} (${email}) set to awake.`,
|
||||
getToastStyleProps(),
|
||||
);
|
||||
triggerToast(`${currentApplication.name} set to awake.`);
|
||||
} catch (e) {
|
||||
triggerToast(`Error trying to awake ${currentApplication.name}`);
|
||||
} catch {
|
||||
// Note: The toast will handle the error.
|
||||
}
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <ActivityIndicator label="Loading user data..." delay={1000} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
@@ -65,7 +92,7 @@ export default function ApplicationPaused() {
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
<Container className="mx-auto mt-20 grid max-w-sm grid-flow-row gap-2 text-center">
|
||||
<Container className="mx-auto mt-20 grid max-w-lg grid-flow-row gap-4 text-center">
|
||||
<div className="mx-auto flex w-centImage flex-col text-center">
|
||||
<Image
|
||||
src="/assets/PausedApp.svg"
|
||||
@@ -75,16 +102,18 @@ export default function ApplicationPaused() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Text variant="h3" component="h1" className="mt-4">
|
||||
{currentApplication.name} is sleeping
|
||||
</Text>
|
||||
<Box className="grid grid-flow-row gap-1">
|
||||
<Text variant="h3" component="h1">
|
||||
{currentApplication.name} is sleeping
|
||||
</Text>
|
||||
|
||||
<Text className="mt-1">
|
||||
Projects on the free plan stop responding to API calls after 7 days of
|
||||
no traffic.
|
||||
</Text>
|
||||
<Text>
|
||||
Starter projects stop responding to API calls after 7 days of
|
||||
inactivity. Upgrade to Pro to avoid autosleep.
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
{!isPro && (
|
||||
<Box className="grid grid-flow-row gap-2">
|
||||
<Button
|
||||
className="mx-auto w-full max-w-[280px]"
|
||||
onClick={() => {
|
||||
@@ -101,32 +130,41 @@ export default function ApplicationPaused() {
|
||||
});
|
||||
}}
|
||||
>
|
||||
Upgrade to Pro to avoid autosleep
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<div className="grid grid-flow-row gap-2">
|
||||
<Button
|
||||
variant="borderless"
|
||||
className="mx-auto w-full max-w-[280px]"
|
||||
loading={changingApplicationStateLoading}
|
||||
disabled={changingApplicationStateLoading}
|
||||
onClick={handleTriggerUnpausing}
|
||||
>
|
||||
Wake Up
|
||||
Upgrade to Pro
|
||||
</Button>
|
||||
|
||||
{isOwner && (
|
||||
<div className="grid grid-flow-row gap-2">
|
||||
<Button
|
||||
color="error"
|
||||
variant="borderless"
|
||||
className="mx-auto w-full max-w-[280px]"
|
||||
onClick={() => setShowDeletingModal(true)}
|
||||
loading={changingApplicationStateLoading}
|
||||
disabled={changingApplicationStateLoading || wakeUpDisabled}
|
||||
onClick={handleTriggerUnpausing}
|
||||
>
|
||||
Delete Project
|
||||
Wake Up
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{wakeUpDisabled && (
|
||||
<Alert severity="warning" className="mx-auto max-w-xs text-left">
|
||||
Note: Only one free project can be active at any given time.
|
||||
Please pause your active free project before unpausing{' '}
|
||||
{currentApplication.name}.
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{isOwner && (
|
||||
<Button
|
||||
color="error"
|
||||
variant="borderless"
|
||||
className="mx-auto w-full max-w-[280px]"
|
||||
onClick={() => setShowDeletingModal(true)}
|
||||
>
|
||||
Delete Project
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</Box>
|
||||
|
||||
<StagingMetadata>
|
||||
<ApplicationInfo />
|
||||
</StagingMetadata>
|
||||
|
||||
@@ -6,7 +6,10 @@ import Divider from '@/ui/v2/Divider';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import { discordAnnounce } from '@/utils/discordAnnounce';
|
||||
import { triggerToast } from '@/utils/toast';
|
||||
import { useDeleteApplicationMutation } from '@/utils/__generated__/graphql';
|
||||
import {
|
||||
GetOneUserDocument,
|
||||
useDeleteApplicationMutation,
|
||||
} from '@/utils/__generated__/graphql';
|
||||
import router from 'next/router';
|
||||
import { useState } from 'react';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
@@ -42,7 +45,9 @@ export function RemoveApplicationModal({
|
||||
description,
|
||||
className,
|
||||
}: RemoveApplicationModalProps) {
|
||||
const [deleteApplication, { client }] = useDeleteApplicationMutation();
|
||||
const [deleteApplication] = useDeleteApplicationMutation({
|
||||
refetchQueries: [GetOneUserDocument],
|
||||
});
|
||||
const [loadingRemove, setLoadingRemove] = useState(false);
|
||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||
|
||||
@@ -73,9 +78,6 @@ export function RemoveApplicationModal({
|
||||
}
|
||||
close();
|
||||
await router.push('/');
|
||||
await client.refetchQueries({
|
||||
include: ['getOneUser'],
|
||||
});
|
||||
triggerToast(`${currentApplication.name} deleted`);
|
||||
}
|
||||
|
||||
|
||||
@@ -111,9 +111,8 @@ export function RenderWorkspacesWithApps({
|
||||
)}
|
||||
|
||||
<StateBadge
|
||||
status={checkStatusOfTheApplication(
|
||||
app.appStates,
|
||||
)}
|
||||
state={checkStatusOfTheApplication(app.appStates)}
|
||||
desiredState={app.desiredState}
|
||||
title={getApplicationStatusString(
|
||||
checkStatusOfTheApplication(app.appStates),
|
||||
)}
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { PropsWithChildren } from 'react';
|
||||
export function StagingMetadata({ children }: PropsWithChildren<unknown>) {
|
||||
return (
|
||||
isDevOrStaging() && (
|
||||
<div className="mt-10">
|
||||
<div className="mx-auto mt-10 max-w-sm">
|
||||
<Box className="mx-auto flex flex-col rounded-md border p-5 text-center">
|
||||
<Status status={StatusEnum.Deploying}>Internal info</Status>
|
||||
{children}
|
||||
|
||||
@@ -76,7 +76,8 @@ function AddPaymentMethodForm({
|
||||
|
||||
if (createPaymentMethodError) {
|
||||
throw new Error(
|
||||
createPaymentMethodError.message || 'Unknown error occurred.',
|
||||
createPaymentMethodError.message ||
|
||||
'An unknown error occurred. Please try again.',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,7 +91,10 @@ function AddPaymentMethodForm({
|
||||
);
|
||||
|
||||
if (attachPaymentMethodError) {
|
||||
throw Error((attachPaymentMethodError as any).response.data);
|
||||
throw new Error(
|
||||
(attachPaymentMethodError as any)?.response?.data ||
|
||||
'An unknown error occurred. Please try again.',
|
||||
);
|
||||
}
|
||||
|
||||
// update workspace with new country code in database
|
||||
@@ -151,7 +155,7 @@ function AddPaymentMethodForm({
|
||||
};
|
||||
|
||||
return (
|
||||
<Box className="w-modal2 px-6 pt-6 pb-6 text-left rounded-lg">
|
||||
<Box className="w-modal2 rounded-lg px-6 pt-6 pb-6 text-left">
|
||||
<div className="flex flex-col">
|
||||
<form onSubmit={handleSubmit}>
|
||||
<Text className="text-center text-lg font-medium">
|
||||
@@ -203,7 +207,7 @@ function AddPaymentMethodForm({
|
||||
|
||||
type BillingPaymentMethodFormProps = {
|
||||
close: () => void;
|
||||
onPaymentMethodAdded?: () => Promise<void>;
|
||||
onPaymentMethodAdded?: (e?: any) => Promise<void>;
|
||||
workspaceId: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ export default function DataGridDateCell<TData extends object>({
|
||||
: undefined;
|
||||
|
||||
const { year, month, day, hour, minute, second } = getDateComponents(date, {
|
||||
adjustTimezone: specificType === 'timetz' || specificType === 'timestamptz',
|
||||
adjustTimezone: ['date', 'timetz', 'timestamptz'].includes(specificType),
|
||||
});
|
||||
|
||||
const { inputRef, focusCell, isEditing, cancelEditCell } =
|
||||
|
||||
@@ -39,17 +39,17 @@ const ruleGroupSchema = Yup.object().shape({
|
||||
|
||||
const baseValidationSchema = Yup.object().shape({
|
||||
filter: ruleGroupSchema.nullable().required('Please select a filter type.'),
|
||||
columns: Yup.array().of(Yup.string()).nullable(true),
|
||||
columns: Yup.array().of(Yup.string()).nullable(),
|
||||
});
|
||||
|
||||
const selectValidationSchema = baseValidationSchema.shape({
|
||||
limit: Yup.number()
|
||||
.label('Limit')
|
||||
.min(0, 'Limit must not be negative.')
|
||||
.nullable(true),
|
||||
allowAggregations: Yup.boolean().nullable(true),
|
||||
queryRootFields: Yup.array().of(Yup.string()).nullable(true),
|
||||
subscriptionRootFields: Yup.array().of(Yup.string()).nullable(true),
|
||||
.nullable(),
|
||||
allowAggregations: Yup.boolean().nullable(),
|
||||
queryRootFields: Yup.array().of(Yup.string()).nullable(),
|
||||
subscriptionRootFields: Yup.array().of(Yup.string()).nullable(),
|
||||
});
|
||||
|
||||
const columnPresetSchema = Yup.object().shape({
|
||||
@@ -88,17 +88,17 @@ const columnPresetSchema = Yup.object().shape({
|
||||
});
|
||||
|
||||
const insertValidationSchema = baseValidationSchema.shape({
|
||||
backendOnly: Yup.boolean().nullable(true),
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(true),
|
||||
backendOnly: Yup.boolean().nullable(),
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(),
|
||||
});
|
||||
|
||||
const updateValidationSchema = baseValidationSchema.shape({
|
||||
backendOnly: Yup.boolean().nullable(true),
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(true),
|
||||
backendOnly: Yup.boolean().nullable(),
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(),
|
||||
});
|
||||
|
||||
const deleteValidationSchema = baseValidationSchema.shape({
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(true),
|
||||
columnPresets: Yup.array().of(columnPresetSchema).nullable(),
|
||||
});
|
||||
|
||||
const validationSchemas: Record<DatabaseAction, Yup.ObjectSchema<any>> = {
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function DisableNewUsersSettings() {
|
||||
const form = useForm<DisableNewUsersFormValues>({
|
||||
reValidateMode: 'onSubmit',
|
||||
defaultValues: {
|
||||
disabled: !!data?.config?.auth?.signUp?.enabled,
|
||||
disabled: !data?.config?.auth?.signUp?.enabled,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -24,22 +24,30 @@ import { twMerge } from 'tailwind-merge';
|
||||
import * as Yup from 'yup';
|
||||
|
||||
const validationSchema = Yup.object({
|
||||
teamId: Yup.string().label('Team ID').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
keyId: Yup.string().label('Key ID').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
clientId: Yup.string().label('Client ID').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
privateKey: Yup.string().label('Private Key').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
teamId: Yup.string()
|
||||
.label('Team ID')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
keyId: Yup.string()
|
||||
.label('Key ID')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
clientId: Yup.string()
|
||||
.label('Client ID')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
privateKey: Yup.string()
|
||||
.label('Private Key')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
enabled: Yup.boolean(),
|
||||
});
|
||||
|
||||
|
||||
@@ -3,14 +3,18 @@ import { useFormContext } from 'react-hook-form';
|
||||
import * as Yup from 'yup';
|
||||
|
||||
export const baseProviderValidationSchema = Yup.object({
|
||||
clientId: Yup.string().label('Client ID').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
clientSecret: Yup.string().label('Client Secret').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
clientId: Yup.string()
|
||||
.label('Client ID')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
clientSecret: Yup.string()
|
||||
.label('Client Secret')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
enabled: Yup.bool(),
|
||||
});
|
||||
|
||||
|
||||
@@ -22,19 +22,23 @@ import { twMerge } from 'tailwind-merge';
|
||||
import * as Yup from 'yup';
|
||||
|
||||
const validationSchema = Yup.object({
|
||||
accountSid: Yup.string().label('Account SID').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
authToken: Yup.string().label('Auth Token').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
accountSid: Yup.string()
|
||||
.label('Account SID')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
authToken: Yup.string()
|
||||
.label('Auth Token')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
messagingServiceId: Yup.string()
|
||||
.label('Messaging Service ID')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
enabled: Yup.boolean().label('Enabled'),
|
||||
});
|
||||
|
||||
@@ -23,14 +23,18 @@ import { twMerge } from 'tailwind-merge';
|
||||
import * as Yup from 'yup';
|
||||
|
||||
const validationSchema = Yup.object({
|
||||
consumerSecret: Yup.string().label('Consumer Secret').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
consumerKey: Yup.string().label('Consumer Key').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
consumerSecret: Yup.string()
|
||||
.label('Consumer Secret')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
consumerKey: Yup.string()
|
||||
.label('Consumer Key')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
enabled: Yup.boolean(),
|
||||
});
|
||||
|
||||
|
||||
@@ -24,22 +24,30 @@ import { twMerge } from 'tailwind-merge';
|
||||
import * as Yup from 'yup';
|
||||
|
||||
const validationSchema = Yup.object({
|
||||
clientId: Yup.string().label('Client ID').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
clientSecret: Yup.string().label('Client Secret').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
organization: Yup.string().label('Organization').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
connection: Yup.string().label('Connection').when('enabled', {
|
||||
is: true,
|
||||
then: Yup.string().required(),
|
||||
}),
|
||||
clientId: Yup.string()
|
||||
.label('Client ID')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
clientSecret: Yup.string()
|
||||
.label('Client Secret')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
organization: Yup.string()
|
||||
.label('Organization')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
connection: Yup.string()
|
||||
.label('Connection')
|
||||
.when('enabled', {
|
||||
is: true,
|
||||
then: (schema) => schema.required(),
|
||||
}),
|
||||
enabled: Yup.boolean(),
|
||||
});
|
||||
|
||||
|
||||
@@ -5,7 +5,11 @@ export interface StateBadgeProps {
|
||||
/**
|
||||
* This is the current state of the application.
|
||||
*/
|
||||
status: ApplicationStatus;
|
||||
state: ApplicationStatus;
|
||||
/**
|
||||
* This is the desired state of the application.
|
||||
*/
|
||||
desiredState: ApplicationStatus;
|
||||
/**
|
||||
* The title to show on the application state badge.
|
||||
*/
|
||||
@@ -24,20 +28,28 @@ function getNormalizedTitle(title: string) {
|
||||
return title;
|
||||
}
|
||||
|
||||
export default function StateBadge({ title, status }: StateBadgeProps) {
|
||||
export default function StateBadge({
|
||||
title,
|
||||
state,
|
||||
desiredState,
|
||||
}: StateBadgeProps) {
|
||||
if (
|
||||
desiredState === ApplicationStatus.Paused &&
|
||||
state === ApplicationStatus.Live
|
||||
) {
|
||||
return <Chip size="small" color="default" label="Pausing" />;
|
||||
}
|
||||
|
||||
const normalizedTitle = getNormalizedTitle(title);
|
||||
|
||||
if (
|
||||
status === ApplicationStatus.Empty ||
|
||||
status === ApplicationStatus.Unpausing
|
||||
state === ApplicationStatus.Empty ||
|
||||
state === ApplicationStatus.Unpausing
|
||||
) {
|
||||
return <Chip size="small" label={normalizedTitle} color="warning" />;
|
||||
}
|
||||
|
||||
if (
|
||||
status === ApplicationStatus.Errored ||
|
||||
status === ApplicationStatus.Live
|
||||
) {
|
||||
if (state === ApplicationStatus.Errored || state === ApplicationStatus.Live) {
|
||||
return <Chip size="small" label={normalizedTitle} color="success" />;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import SvgIcon from '@/ui/v2/icons/SvgIcon';
|
||||
import { styled } from '@mui/material';
|
||||
import type { RadioProps as MaterialRadioProps } from '@mui/material/Radio';
|
||||
import MaterialRadio from '@mui/material/Radio';
|
||||
import type { ForwardedRef, PropsWithoutRef } from 'react';
|
||||
import type { ForwardedRef, PropsWithoutRef, ReactNode } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
export interface RadioProps extends MaterialRadioProps {
|
||||
@@ -17,7 +17,7 @@ export interface RadioProps extends MaterialRadioProps {
|
||||
/**
|
||||
* Label to be displayed next to the radio button.
|
||||
*/
|
||||
label?: string;
|
||||
label?: ReactNode;
|
||||
/**
|
||||
* Props to be passed to individual component slots.
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { styled } from '@mui/material';
|
||||
import Box from '@mui/material/Box';
|
||||
import type { TooltipProps as MaterialTooltipProps } from '@mui/material/Tooltip';
|
||||
import MaterialTooltip, { tooltipClasses } from '@mui/material/Tooltip';
|
||||
import MaterialTooltip, {
|
||||
tooltipClasses as materialTooltipClasses,
|
||||
} from '@mui/material/Tooltip';
|
||||
import type { ForwardedRef } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
@@ -21,7 +23,7 @@ export interface TooltipProps extends MaterialTooltipProps {
|
||||
}
|
||||
|
||||
const StyledTooltip = styled(Box)(({ theme }) => ({
|
||||
[`&.${tooltipClasses.tooltip}`]: {
|
||||
[`&.${materialTooltipClasses.tooltip}`]: {
|
||||
fontSize: '0.9375rem',
|
||||
lineHeight: '1.375rem',
|
||||
backgroundColor:
|
||||
@@ -36,9 +38,23 @@ const StyledTooltip = styled(Box)(({ theme }) => ({
|
||||
'0px 1px 4px rgba(14, 24, 39, 0.1), 0px 8px 24px rgba(14, 24, 39, 0.1)',
|
||||
maxWidth: '17.5rem',
|
||||
},
|
||||
[`&.${tooltipClasses.tooltipPlacementBottom}`]: {
|
||||
[`& .${materialTooltipClasses.arrow}`]: {
|
||||
color:
|
||||
theme.palette.mode === 'dark'
|
||||
? theme.palette.grey[300]
|
||||
: theme.palette.grey[700],
|
||||
},
|
||||
[`&.${materialTooltipClasses.tooltipPlacementBottom}`]: {
|
||||
marginTop: `${theme.spacing(0.75)} !important`,
|
||||
},
|
||||
[`&.${materialTooltipClasses.tooltipPlacementBottom} .${materialTooltipClasses.arrow}`]:
|
||||
{
|
||||
marginTop: `${theme.spacing(-0.5)} !important`,
|
||||
color:
|
||||
theme.palette.mode === 'dark'
|
||||
? theme.palette.grey[300]
|
||||
: theme.palette.grey[700],
|
||||
},
|
||||
}));
|
||||
|
||||
function Tooltip(
|
||||
@@ -69,6 +85,8 @@ function Tooltip(
|
||||
);
|
||||
}
|
||||
|
||||
export { materialTooltipClasses as tooltipClasses };
|
||||
|
||||
Tooltip.displayName = 'NhostTooltip';
|
||||
|
||||
export default forwardRef(Tooltip);
|
||||
|
||||
@@ -165,7 +165,7 @@ export default function CreateUserForm({
|
||||
</Alert>
|
||||
)}
|
||||
<div className="grid grid-flow-row gap-2">
|
||||
<Button type="submit" loading={isSubmitting} disabled={isSubmitting}>
|
||||
<Button type="submit" disabled={isSubmitting}>
|
||||
Create
|
||||
</Button>
|
||||
|
||||
|
||||
@@ -242,7 +242,11 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
|
||||
secondaryAction={
|
||||
<Dropdown.Root>
|
||||
<Dropdown.Trigger asChild hideChevron>
|
||||
<IconButton variant="borderless" color="secondary">
|
||||
<IconButton
|
||||
variant="borderless"
|
||||
color="secondary"
|
||||
aria-label={`More options for ${user.displayName}`}
|
||||
>
|
||||
<DotsHorizontalIcon />
|
||||
</IconButton>
|
||||
</Dropdown.Trigger>
|
||||
@@ -282,6 +286,7 @@ export default function UsersBody({ users, onSubmit }: UsersBodyProps) {
|
||||
<ListItem.Button
|
||||
className="grid h-full w-full grid-cols-1 py-2.5 lg:grid-cols-6"
|
||||
onClick={() => handleViewUser(user)}
|
||||
aria-label={`View ${user.displayName}`}
|
||||
>
|
||||
<div className="col-span-2 grid grid-flow-col place-content-start gap-4">
|
||||
<Avatar
|
||||
|
||||
5
dashboard/src/gql/app/pauseApplication.graphql
Normal file
5
dashboard/src/gql/app/pauseApplication.graphql
Normal file
@@ -0,0 +1,5 @@
|
||||
mutation PauseApplication($appId: uuid!) {
|
||||
updateApp(pk_columns: { id: $appId }, _set: { desiredState: 6 }) {
|
||||
id
|
||||
}
|
||||
}
|
||||
5
dashboard/src/gql/app/unpauseApplication.graphql
Normal file
5
dashboard/src/gql/app/unpauseApplication.graphql
Normal file
@@ -0,0 +1,5 @@
|
||||
mutation UnpauseApplication($appId: uuid!) {
|
||||
updateApp(pk_columns: { id: $appId }, _set: { desiredState: 5 }) {
|
||||
id
|
||||
}
|
||||
}
|
||||
11
dashboard/src/gql/user/getFreeAndActiveProjects.graphql
Normal file
11
dashboard/src/gql/user/getFreeAndActiveProjects.graphql
Normal file
@@ -0,0 +1,11 @@
|
||||
query GetFreeAndActiveProjects($userId: uuid!) {
|
||||
freeAndActiveProjects: apps(
|
||||
where: {
|
||||
creatorUserId: { _eq: $userId }
|
||||
plan: { isFree: { _eq: true } }
|
||||
desiredState: { _eq: 5 }
|
||||
}
|
||||
) {
|
||||
id
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ export default function useNotFoundRedirect() {
|
||||
const router = useRouter();
|
||||
const {
|
||||
query: { workspaceSlug, appSlug, updating },
|
||||
} = useRouter();
|
||||
} = router;
|
||||
|
||||
const notIn404Already = router.pathname !== '/404';
|
||||
const noResolvedWorkspace = workspaceSlug && currentWorkspace === undefined;
|
||||
|
||||
@@ -8,7 +8,8 @@ import { useUI } from '@/context/UIContext';
|
||||
import {
|
||||
GetOneUserDocument,
|
||||
useDeleteApplicationMutation,
|
||||
useUpdateAppMutation,
|
||||
usePauseApplicationMutation,
|
||||
useUpdateApplicationMutation,
|
||||
} from '@/generated/graphql';
|
||||
import { useCurrentWorkspaceAndApplication } from '@/hooks/useCurrentWorkspaceAndApplication';
|
||||
import Input from '@/ui/v2/Input';
|
||||
@@ -37,9 +38,13 @@ export type ProjectNameValidationSchema = Yup.InferType<
|
||||
|
||||
export default function SettingsGeneralPage() {
|
||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||
const { openDialog, closeDialog } = useDialog();
|
||||
const [updateApp] = useUpdateAppMutation();
|
||||
const { openDialog, openAlertDialog, closeDialog } = useDialog();
|
||||
const [updateApp] = useUpdateApplicationMutation();
|
||||
const client = useApolloClient();
|
||||
const [pauseApplication] = usePauseApplicationMutation({
|
||||
variables: { appId: currentApplication?.id },
|
||||
refetchQueries: [GetOneUserDocument],
|
||||
});
|
||||
const [deleteApplication] = useDeleteApplicationMutation({
|
||||
variables: { appId: currentApplication?.id },
|
||||
refetchQueries: [GetOneUserDocument],
|
||||
@@ -61,7 +66,7 @@ export default function SettingsGeneralPage() {
|
||||
|
||||
const { register, formState } = form;
|
||||
|
||||
const handleProjectNameChange = async (data: ProjectNameValidationSchema) => {
|
||||
async function handleProjectNameChange(data: ProjectNameValidationSchema) {
|
||||
// In this bit of code we spread the props of the current path (e.g. /workspace/...) and add one key-value pair: `updating: true`.
|
||||
// We want to indicate that the currently we're in the process of running a mutation state that will affect the routing behaviour of the website
|
||||
// i.e. redirecting to 404 if there's no workspace/project with that slug.
|
||||
@@ -83,7 +88,7 @@ export default function SettingsGeneralPage() {
|
||||
|
||||
const updateAppMutation = updateApp({
|
||||
variables: {
|
||||
id: currentApplication.id,
|
||||
appId: currentApplication.id,
|
||||
app: {
|
||||
name: data.name,
|
||||
slug: newProjectSlug,
|
||||
@@ -108,34 +113,50 @@ export default function SettingsGeneralPage() {
|
||||
}
|
||||
|
||||
try {
|
||||
await client.refetchQueries({
|
||||
include: ['getOneUser'],
|
||||
});
|
||||
form.reset(undefined, { keepValues: true, keepDirty: false });
|
||||
await router.push(
|
||||
`/${currentWorkspace.slug}/${newProjectSlug}/settings/general`,
|
||||
);
|
||||
await client.refetchQueries({ include: [GetOneUserDocument] });
|
||||
} catch (error) {
|
||||
await discordAnnounce(
|
||||
error.message || 'Error while trying to update application cache',
|
||||
error.message ||
|
||||
'An error occurred while trying to update application cache.',
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const handleDeleteApplication = async () => {
|
||||
async function handleDeleteApplication() {
|
||||
await toast.promise(
|
||||
deleteApplication(),
|
||||
{
|
||||
loading: `Deleting ${currentApplication.name}...`,
|
||||
success: `${currentApplication.name} deleted`,
|
||||
success: `${currentApplication.name} has been deleted successfully.`,
|
||||
error: getServerError(
|
||||
`Error while trying to ${currentApplication.name} project name`,
|
||||
`An error occurred while trying to delete the project "${currentApplication.name}". Please try again.`,
|
||||
),
|
||||
},
|
||||
getToastStyleProps(),
|
||||
);
|
||||
|
||||
await router.push('/');
|
||||
};
|
||||
}
|
||||
|
||||
async function handlePauseApplication() {
|
||||
await toast.promise(
|
||||
pauseApplication(),
|
||||
{
|
||||
loading: `Pausing ${currentApplication.name}...`,
|
||||
success: `${currentApplication.name} will be paused, but please note that it may take some time to complete the process.`,
|
||||
error: getServerError(
|
||||
`An error occurred while trying to pause the project "${currentApplication.name}". Please try again.`,
|
||||
),
|
||||
},
|
||||
getToastStyleProps(),
|
||||
);
|
||||
|
||||
await router.push('/');
|
||||
}
|
||||
|
||||
return (
|
||||
<Container
|
||||
@@ -171,6 +192,32 @@ export default function SettingsGeneralPage() {
|
||||
</Form>
|
||||
</FormProvider>
|
||||
|
||||
{currentApplication.plan.isFree && (
|
||||
<SettingsContainer
|
||||
title="Pause Project"
|
||||
description="While your project is paused, it will not be accessible. You can wake it up anytime after."
|
||||
submitButtonText="Pause"
|
||||
slotProps={{
|
||||
submitButton: {
|
||||
type: 'button',
|
||||
color: 'primary',
|
||||
variant: 'contained',
|
||||
disabled: maintenanceActive,
|
||||
onClick: () => {
|
||||
openAlertDialog({
|
||||
title: 'Pause Project?',
|
||||
payload:
|
||||
'Are you sure you want to pause this project? It will not be accessible until you unpause it.',
|
||||
props: {
|
||||
onPrimaryAction: handlePauseApplication,
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<SettingsContainer
|
||||
title="Delete Project"
|
||||
description="The project will be permanently deleted, including its database, metadata, files, etc. This action is irreversible and can not be undone."
|
||||
|
||||
@@ -11,23 +11,25 @@ import { Modal } from '@/ui/Modal';
|
||||
import ActivityIndicator from '@/ui/v2/ActivityIndicator';
|
||||
import Box from '@/ui/v2/Box';
|
||||
import Button from '@/ui/v2/Button';
|
||||
import Checkbox from '@/ui/v2/Checkbox';
|
||||
import IconButton from '@/ui/v2/IconButton';
|
||||
import CopyIcon from '@/ui/v2/icons/CopyIcon';
|
||||
import Input from '@/ui/v2/Input';
|
||||
import InputAdornment from '@/ui/v2/InputAdornment';
|
||||
import Option from '@/ui/v2/Option';
|
||||
import Radio from '@/ui/v2/Radio';
|
||||
import RadioGroup from '@/ui/v2/RadioGroup';
|
||||
import Select from '@/ui/v2/Select';
|
||||
import type { TextProps } from '@/ui/v2/Text';
|
||||
import Text from '@/ui/v2/Text';
|
||||
import Tooltip from '@/ui/v2/Tooltip';
|
||||
import { MAX_FREE_PROJECTS } from '@/utils/CONSTANTS';
|
||||
import { copy } from '@/utils/copy';
|
||||
import { discordAnnounce } from '@/utils/discordAnnounce';
|
||||
import { getErrorMessage } from '@/utils/getErrorMessage';
|
||||
import { getCurrentEnvironment, slugifyString } from '@/utils/helpers';
|
||||
import { nhost } from '@/utils/nhost';
|
||||
import { getCurrentEnvironment } from '@/utils/helpers';
|
||||
import { planDescriptions } from '@/utils/planDescriptions';
|
||||
import generateRandomDatabasePassword from '@/utils/settings/generateRandomDatabasePassword';
|
||||
import { resetDatabasePasswordValidationSchema } from '@/utils/settings/resetDatabasePasswordValidationSchema';
|
||||
import { getToastStyleProps } from '@/utils/settings/settingsConstants';
|
||||
import { triggerToast } from '@/utils/toast';
|
||||
import type {
|
||||
PrefetchNewAppPlansFragment,
|
||||
@@ -35,19 +37,25 @@ import type {
|
||||
PrefetchNewAppWorkspaceFragment,
|
||||
} from '@/utils/__generated__/graphql';
|
||||
import {
|
||||
useGetFreeAndActiveProjectsQuery,
|
||||
useInsertApplicationMutation,
|
||||
usePrefetchNewAppQuery,
|
||||
} from '@/utils/__generated__/graphql';
|
||||
import type { ApolloError } from '@apollo/client';
|
||||
import { useUserData } from '@nhost/nextjs';
|
||||
import Image from 'next/image';
|
||||
import { useRouter } from 'next/router';
|
||||
import type { ReactElement } from 'react';
|
||||
import { cloneElement, isValidElement, useState } from 'react';
|
||||
import { toast } from 'react-hot-toast';
|
||||
import slugify from 'slugify';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
type NewAppPageProps = {
|
||||
regions: PrefetchNewAppRegionsFragment[];
|
||||
plans: PrefetchNewAppPlansFragment[];
|
||||
workspaces: PrefetchNewAppWorkspaceFragment[];
|
||||
numberOfFreeAndLiveProjects: number;
|
||||
preSelectedWorkspace: PrefetchNewAppWorkspaceFragment;
|
||||
preSelectedRegion: PrefetchNewAppRegionsFragment;
|
||||
};
|
||||
@@ -56,6 +64,7 @@ export function NewProjectPageContent({
|
||||
regions,
|
||||
plans,
|
||||
workspaces,
|
||||
numberOfFreeAndLiveProjects,
|
||||
preSelectedWorkspace,
|
||||
preSelectedRegion,
|
||||
}: NewAppPageProps) {
|
||||
@@ -86,15 +95,23 @@ export function NewProjectPageContent({
|
||||
generateRandomDatabasePassword(),
|
||||
);
|
||||
|
||||
const [plan, setPlan] = useState(plans[0]);
|
||||
// find the first acceptable plan as default plan
|
||||
const defaultSelectedPlan = plans.find((plan) => {
|
||||
if (!plan.isFree) {
|
||||
return true;
|
||||
}
|
||||
return numberOfFreeAndLiveProjects < MAX_FREE_PROJECTS;
|
||||
});
|
||||
|
||||
const [plan, setPlan] = useState(defaultSelectedPlan);
|
||||
|
||||
// state
|
||||
const { submitState, setSubmitState } = useSubmitState();
|
||||
const [applicationError, setApplicationError] = useState<any>('');
|
||||
const [showPaymentModal, setShowPaymentModal] = useState(false);
|
||||
|
||||
// graphql mutations
|
||||
const [insertApp] = useInsertApplicationMutation();
|
||||
|
||||
const [insertApp] = useInsertApplicationMutation({});
|
||||
const { refetchUserData } = useLazyRefetchUserData();
|
||||
|
||||
// options
|
||||
@@ -119,8 +136,6 @@ export function NewProjectPageContent({
|
||||
(availableWorkspace) => availableWorkspace.id === selectedWorkspace.id,
|
||||
);
|
||||
|
||||
const user = nhost.auth.getUser();
|
||||
|
||||
const isK8SPostgresEnabledInCurrentEnvironment = features[
|
||||
'k8s-postgres'
|
||||
].enabled.find((e) => e === getCurrentEnvironment());
|
||||
@@ -133,30 +148,24 @@ export function NewProjectPageContent({
|
||||
setDatabasePassword(newRandomDatabasePassword);
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (!plan.isFree && workspace.paymentMethods.length === 0) {
|
||||
setShowPaymentModal(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setSubmitState({
|
||||
error: null,
|
||||
loading: true,
|
||||
});
|
||||
|
||||
if (name.length < 1 || name.length > 32) {
|
||||
setApplicationError(
|
||||
`The project name must be between 1 and 32 characters`,
|
||||
);
|
||||
setSubmitState({
|
||||
error: null,
|
||||
error: Error('The project name must be between 1 and 32 characters'),
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
|
||||
const slug = slugifyString(name);
|
||||
|
||||
if (slug.length < 1 || slug.length > 32) {
|
||||
setSubmitState({
|
||||
error: Error('The project slug must be between 1 and 32 characters.'),
|
||||
loading: false,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -173,14 +182,11 @@ export function NewProjectPageContent({
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Maybe we'll reintroduce this way of creating the subdomain in the future
|
||||
// https://www.rfc-editor.org/rfc/rfc1034#section-3.1
|
||||
// subdomain max length is 63 characters
|
||||
// const subdomain = `${slug}-${workspaceSlug}`.substring(0, 63);
|
||||
const slug = slugify(name, { lower: true, strict: true });
|
||||
|
||||
try {
|
||||
if (isK8SPostgresEnabledInCurrentEnvironment) {
|
||||
await insertApp({
|
||||
await toast.promise(
|
||||
insertApp({
|
||||
variables: {
|
||||
app: {
|
||||
name,
|
||||
@@ -188,37 +194,40 @@ export function NewProjectPageContent({
|
||||
planId: plan.id,
|
||||
workspaceId: selectedWorkspace.id,
|
||||
regionId: selectedRegion.id,
|
||||
postgresPassword: databasePassword,
|
||||
postgresPassword: isK8SPostgresEnabledInCurrentEnvironment
|
||||
? databasePassword
|
||||
: undefined,
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
await insertApp({
|
||||
variables: {
|
||||
app: {
|
||||
name,
|
||||
slug,
|
||||
planId: plan.id,
|
||||
workspaceId: selectedWorkspace.id,
|
||||
regionId: selectedRegion.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}),
|
||||
{
|
||||
loading: 'Creating the project...',
|
||||
success: 'The project has been created successfully.',
|
||||
error: (arg: ApolloError) => {
|
||||
// we need to get the internal error message from the GraphQL error
|
||||
const { internal } = arg.graphQLErrors[0]?.extensions || {};
|
||||
const { message } = (internal as Record<string, any>)?.error || {};
|
||||
|
||||
triggerToast(`New project ${name} created`);
|
||||
} catch (error) {
|
||||
discordAnnounce(
|
||||
`Error creating project: ${error.message}. (${user.email})`,
|
||||
// we use the default Apollo error message if we can't find the
|
||||
// internal error message
|
||||
return (
|
||||
message ||
|
||||
arg.message ||
|
||||
'An error occurred while creating the project. Please try again.'
|
||||
);
|
||||
},
|
||||
},
|
||||
getToastStyleProps(),
|
||||
);
|
||||
|
||||
await refetchUserData();
|
||||
await router.push(`/${selectedWorkspace.slug}/${slug}`);
|
||||
} catch (error) {
|
||||
setSubmitState({
|
||||
error: Error(getErrorMessage(error, 'application')),
|
||||
error: null,
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
|
||||
await refetchUserData();
|
||||
router.push(`/${selectedWorkspace.slug}/${slug}`);
|
||||
};
|
||||
|
||||
if (!selectedWorkspace) {
|
||||
@@ -243,383 +252,376 @@ export function NewProjectPageContent({
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<div className="mx-auto grid max-w-[760px] grid-flow-row gap-4 py-6 sm:py-14">
|
||||
<Text variant="h2" component="h1">
|
||||
New Project
|
||||
</Text>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="mx-auto grid max-w-[760px] grid-flow-row gap-4 py-6 sm:py-14">
|
||||
<Text variant="h2" component="h1">
|
||||
New Project
|
||||
</Text>
|
||||
|
||||
<div className="grid grid-flow-row gap-4">
|
||||
<Input
|
||||
id="name"
|
||||
autoComplete="off"
|
||||
label="Project Name"
|
||||
variant="inline"
|
||||
fullWidth
|
||||
hideEmptyHelperText
|
||||
placeholder="Project Name"
|
||||
onChange={(event) => {
|
||||
setSubmitState({
|
||||
error: null,
|
||||
loading: false,
|
||||
});
|
||||
setApplicationError('');
|
||||
setName(event.target.value);
|
||||
}}
|
||||
value={name}
|
||||
autoFocus
|
||||
/>
|
||||
|
||||
<Select
|
||||
id="workspace"
|
||||
label="Workspace"
|
||||
variant="inline"
|
||||
hideEmptyHelperText
|
||||
placeholder="Select Workspace"
|
||||
slotProps={{
|
||||
root: { className: 'grid grid-flow-col gap-1' },
|
||||
}}
|
||||
onChange={(_event, value) => {
|
||||
const workspaceInList = workspaces.find(({ id }) => id === value);
|
||||
setPlan(plans[0]);
|
||||
setSelectedWorkspace({
|
||||
id: workspaceInList.id,
|
||||
name: workspaceInList.name,
|
||||
disabled: false,
|
||||
slug: workspaceInList.slug,
|
||||
});
|
||||
}}
|
||||
value={selectedWorkspace.id}
|
||||
renderValue={(option) => (
|
||||
<span className="inline-grid grid-flow-col items-center gap-2">
|
||||
{option?.label}
|
||||
</span>
|
||||
)}
|
||||
>
|
||||
{workspaceOptions.map((option) => (
|
||||
<Option
|
||||
value={option.id}
|
||||
key={option.id}
|
||||
className="grid grid-flow-col items-center gap-2"
|
||||
>
|
||||
<span className="inline-block h-6 w-6 overflow-hidden rounded-md">
|
||||
<Image
|
||||
src="/logos/new.svg"
|
||||
alt="Nhost Logo"
|
||||
width={24}
|
||||
height={24}
|
||||
/>
|
||||
</span>
|
||||
|
||||
{option.name}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
|
||||
{isK8SPostgresEnabledInCurrentEnvironment && (
|
||||
<div className="grid grid-flow-row gap-4">
|
||||
<Input
|
||||
name="databasePassword"
|
||||
id="databasePassword"
|
||||
autoComplete="new-password"
|
||||
label="Database Password"
|
||||
value={databasePassword}
|
||||
id="name"
|
||||
autoComplete="off"
|
||||
label="Project Name"
|
||||
variant="inline"
|
||||
type="password"
|
||||
error={!!passwordError}
|
||||
fullWidth
|
||||
hideEmptyHelperText
|
||||
endAdornment={
|
||||
<InputAdornment position="end" className="mr-2">
|
||||
<IconButton
|
||||
color="secondary"
|
||||
onClick={() => {
|
||||
copy(databasePassword, 'Postgres password');
|
||||
}}
|
||||
variant="borderless"
|
||||
aria-label="Copy password"
|
||||
>
|
||||
<CopyIcon className="h-4 w-4" />
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
}
|
||||
slotProps={{
|
||||
// Note: this is supposed to fix a `validateDOMNesting` error
|
||||
helperText: { component: 'div' },
|
||||
}}
|
||||
helperText={
|
||||
<div className="grid max-w-xs grid-flow-row gap-2">
|
||||
{passwordError && (
|
||||
<Text
|
||||
variant="subtitle2"
|
||||
sx={{
|
||||
color: (theme) =>
|
||||
`${theme.palette.error.main} !important`,
|
||||
}}
|
||||
>
|
||||
{passwordError}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
<Box className="font-medium">
|
||||
The root Postgres password for your database - it must be
|
||||
strong and hard to guess.{' '}
|
||||
<Button
|
||||
type="button"
|
||||
variant="borderless"
|
||||
color="secondary"
|
||||
onClick={handleGenerateRandomPassword}
|
||||
className="px-1 py-0.5 text-xs underline underline-offset-2 hover:underline"
|
||||
tabIndex={-1}
|
||||
>
|
||||
Generate a password
|
||||
</Button>
|
||||
</Box>
|
||||
</div>
|
||||
}
|
||||
onChange={async (e) => {
|
||||
e.preventDefault();
|
||||
placeholder="Project Name"
|
||||
onChange={(event) => {
|
||||
setSubmitState({
|
||||
error: null,
|
||||
loading: false,
|
||||
});
|
||||
if (e.target.value.length === 0) {
|
||||
setDatabasePassword(e.target.value);
|
||||
setPasswordError('Please enter a password');
|
||||
|
||||
return;
|
||||
}
|
||||
setDatabasePassword(e.target.value);
|
||||
setPasswordError('');
|
||||
try {
|
||||
await resetDatabasePasswordValidationSchema.validate({
|
||||
databasePassword: e.target.value,
|
||||
});
|
||||
setPasswordError('');
|
||||
} catch (validationError) {
|
||||
setPasswordError(validationError.message);
|
||||
}
|
||||
setName(event.target.value);
|
||||
}}
|
||||
fullWidth
|
||||
value={name}
|
||||
autoFocus
|
||||
/>
|
||||
)}
|
||||
|
||||
<Select
|
||||
id="region"
|
||||
label="Region"
|
||||
variant="inline"
|
||||
hideEmptyHelperText
|
||||
placeholder="Select Region"
|
||||
slotProps={{
|
||||
root: { className: 'grid grid-flow-col gap-1' },
|
||||
}}
|
||||
onChange={(_event, value) => {
|
||||
const regionInList = regions.find(({ id }) => id === value);
|
||||
setPlan(plans[0]);
|
||||
setSelectedRegion({
|
||||
id: regionInList.id,
|
||||
name: regionInList.country.name,
|
||||
disabled: false,
|
||||
code: regionInList.country.code,
|
||||
});
|
||||
}}
|
||||
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}
|
||||
</span>
|
||||
);
|
||||
}}
|
||||
>
|
||||
{regionOptions.map((option) => (
|
||||
<Option
|
||||
value={option.id}
|
||||
key={option.id}
|
||||
className={twMerge(
|
||||
'relative grid grid-flow-col grid-rows-2 items-center justify-start gap-x-3',
|
||||
option.disabled && 'pointer-events-none opacity-50',
|
||||
)}
|
||||
disabled={option.disabled}
|
||||
>
|
||||
<span className="row-span-2 flex">
|
||||
<Image
|
||||
src={`/assets/flags/${option.code}.svg`}
|
||||
alt={`${option.country} country flag`}
|
||||
width={16}
|
||||
height={12}
|
||||
/>
|
||||
<Select
|
||||
id="workspace"
|
||||
label="Workspace"
|
||||
variant="inline"
|
||||
hideEmptyHelperText
|
||||
placeholder="Select Workspace"
|
||||
slotProps={{
|
||||
root: { className: 'grid grid-flow-col gap-1' },
|
||||
}}
|
||||
onChange={(_event, value) => {
|
||||
const workspaceInList = workspaces.find(
|
||||
({ id }) => id === value,
|
||||
);
|
||||
setPlan(plans[0]);
|
||||
setSelectedWorkspace({
|
||||
id: workspaceInList.id,
|
||||
name: workspaceInList.name,
|
||||
disabled: false,
|
||||
slug: workspaceInList.slug,
|
||||
});
|
||||
}}
|
||||
value={selectedWorkspace.id}
|
||||
renderValue={(option) => (
|
||||
<span className="inline-grid grid-flow-col items-center gap-2">
|
||||
{option?.label}
|
||||
</span>
|
||||
)}
|
||||
>
|
||||
{workspaceOptions.map((option) => (
|
||||
<Option
|
||||
value={option.id}
|
||||
key={option.id}
|
||||
className="grid grid-flow-col items-center gap-2"
|
||||
>
|
||||
<span className="inline-block h-6 w-6 overflow-hidden rounded-md">
|
||||
<Image
|
||||
src="/logos/new.svg"
|
||||
alt="Nhost Logo"
|
||||
width={24}
|
||||
height={24}
|
||||
/>
|
||||
</span>
|
||||
|
||||
<Text className="row-span-1 font-medium">{option.name}</Text>
|
||||
{option.name}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
|
||||
<Text variant="subtitle2" className="row-span-1">
|
||||
{option.country}
|
||||
</Text>
|
||||
{isK8SPostgresEnabledInCurrentEnvironment && (
|
||||
<Input
|
||||
name="databasePassword"
|
||||
id="databasePassword"
|
||||
autoComplete="new-password"
|
||||
label="Database Password"
|
||||
value={databasePassword}
|
||||
variant="inline"
|
||||
type="password"
|
||||
error={!!passwordError}
|
||||
hideEmptyHelperText
|
||||
endAdornment={
|
||||
<InputAdornment position="end" className="mr-2">
|
||||
<IconButton
|
||||
color="secondary"
|
||||
onClick={() => {
|
||||
copy(databasePassword, 'Postgres password');
|
||||
}}
|
||||
variant="borderless"
|
||||
aria-label="Copy password"
|
||||
>
|
||||
<CopyIcon className="h-4 w-4" />
|
||||
</IconButton>
|
||||
</InputAdornment>
|
||||
}
|
||||
slotProps={{
|
||||
// Note: this is supposed to fix a `validateDOMNesting` error
|
||||
helperText: { component: 'div' },
|
||||
}}
|
||||
helperText={
|
||||
<div className="grid max-w-xs grid-flow-row gap-2">
|
||||
{passwordError && (
|
||||
<Text
|
||||
variant="subtitle2"
|
||||
sx={{
|
||||
color: (theme) =>
|
||||
`${theme.palette.error.main} !important`,
|
||||
}}
|
||||
>
|
||||
{passwordError}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
{option.disabled && (
|
||||
<Text
|
||||
variant="subtitle2"
|
||||
className="absolute top-1/2 right-4 -translate-y-1/2"
|
||||
>
|
||||
Disabled
|
||||
</Text>
|
||||
)}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
<Box className="font-medium">
|
||||
The root Postgres password for your database - it must be
|
||||
strong and hard to guess.{' '}
|
||||
<Button
|
||||
type="button"
|
||||
variant="borderless"
|
||||
color="secondary"
|
||||
onClick={handleGenerateRandomPassword}
|
||||
className="px-1 py-0.5 text-xs underline underline-offset-2 hover:underline"
|
||||
tabIndex={-1}
|
||||
>
|
||||
Generate a password
|
||||
</Button>
|
||||
</Box>
|
||||
</div>
|
||||
}
|
||||
onChange={async (e) => {
|
||||
e.preventDefault();
|
||||
setSubmitState({
|
||||
error: null,
|
||||
loading: false,
|
||||
});
|
||||
setDatabasePassword(e.target.value);
|
||||
|
||||
<div className="grid w-full grid-cols-8 gap-x-4 gap-y-2">
|
||||
<div className="col-span-8 sm:col-span-2">
|
||||
<Text className="text-xs font-medium">Plan</Text>
|
||||
<Text variant="subtitle2">You can change this later.</Text>
|
||||
</div>
|
||||
try {
|
||||
await resetDatabasePasswordValidationSchema.validate({
|
||||
databasePassword: e.target.value,
|
||||
});
|
||||
setPasswordError('');
|
||||
} catch (validationError) {
|
||||
setPasswordError(validationError.message);
|
||||
}
|
||||
}}
|
||||
fullWidth
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="col-span-8 sm:col-span-6">
|
||||
{plans.map((currentPlan) => {
|
||||
const checked = plan.id === currentPlan.id;
|
||||
<Select
|
||||
id="region"
|
||||
label="Region"
|
||||
variant="inline"
|
||||
hideEmptyHelperText
|
||||
placeholder="Select Region"
|
||||
slotProps={{
|
||||
root: { className: 'grid grid-flow-col gap-1' },
|
||||
}}
|
||||
onChange={(_event, value) => {
|
||||
const regionInList = regions.find(({ id }) => id === value);
|
||||
setSelectedRegion({
|
||||
id: regionInList.id,
|
||||
name: regionInList.country.name,
|
||||
disabled: false,
|
||||
code: regionInList.country.code,
|
||||
});
|
||||
}}
|
||||
value={selectedRegion.id}
|
||||
renderValue={(option) => {
|
||||
const [flag, , country] = (option?.label as any[]) || [];
|
||||
|
||||
return (
|
||||
<Box
|
||||
className="border-t py-4 last-of-type:border-b"
|
||||
key={currentPlan.id}
|
||||
>
|
||||
<Checkbox
|
||||
label={
|
||||
<>
|
||||
<span className="inline-block max-w-xs">
|
||||
<span className="font-medium">
|
||||
{currentPlan.name}:
|
||||
</span>{' '}
|
||||
{planDescriptions[currentPlan.name]}
|
||||
</span>
|
||||
<span className="inline-grid grid-flow-col grid-rows-none items-center gap-x-2">
|
||||
{flag}
|
||||
|
||||
{currentPlan.isFree ? (
|
||||
<Text variant="h3" component="span">
|
||||
Free
|
||||
</Text>
|
||||
) : (
|
||||
<Text
|
||||
variant="h3"
|
||||
component="span"
|
||||
className="inline-grid grid-flow-col items-center gap-1"
|
||||
>
|
||||
$ {currentPlan.price}{' '}
|
||||
<Text variant="subtitle2" component="span">
|
||||
/ mo
|
||||
</Text>
|
||||
</Text>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
componentsProps={{
|
||||
formControlLabel: {
|
||||
className: 'flex',
|
||||
componentsProps: {
|
||||
typography: {
|
||||
className:
|
||||
'font-regular text-xs grid grid-flow-col justify-between items-center w-full',
|
||||
},
|
||||
},
|
||||
},
|
||||
}}
|
||||
checked={checked}
|
||||
key={currentPlan.id}
|
||||
onChange={(event, inputChecked) => {
|
||||
if (!inputChecked) {
|
||||
event.preventDefault();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
setPlan(currentPlan);
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
{isValidElement<TextProps>(country)
|
||||
? cloneElement(country, {
|
||||
...country.props,
|
||||
variant: 'body1',
|
||||
})
|
||||
: null}
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{submitState.error && (
|
||||
<Alert severity="error" className="text-left">
|
||||
<Text className="font-medium">Warning</Text>{' '}
|
||||
<Text className="font-medium">
|
||||
{submitState.error &&
|
||||
getErrorMessage(submitState.error, 'application')}
|
||||
</Text>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
<div className="flex justify-end">
|
||||
{showPaymentModal && (
|
||||
<Modal
|
||||
showModal={showPaymentModal}
|
||||
close={() => {
|
||||
setShowPaymentModal(false);
|
||||
}}
|
||||
>
|
||||
<BillingPaymentMethodForm
|
||||
{regionOptions.map((option) => (
|
||||
<Option
|
||||
value={option.id}
|
||||
key={option.id}
|
||||
className={twMerge(
|
||||
'relative grid grid-flow-col grid-rows-2 items-center justify-start gap-x-3',
|
||||
option.disabled && 'pointer-events-none opacity-50',
|
||||
)}
|
||||
disabled={option.disabled}
|
||||
>
|
||||
<span className="row-span-2 flex">
|
||||
<Image
|
||||
src={`/assets/flags/${option.code}.svg`}
|
||||
alt={`${option.country} country flag`}
|
||||
width={16}
|
||||
height={12}
|
||||
/>
|
||||
</span>
|
||||
|
||||
<Text className="row-span-1 font-medium">{option.name}</Text>
|
||||
|
||||
<Text variant="subtitle2" className="row-span-1">
|
||||
{option.country}
|
||||
</Text>
|
||||
|
||||
{option.disabled && (
|
||||
<Text
|
||||
variant="subtitle2"
|
||||
className="absolute top-1/2 right-4 -translate-y-1/2"
|
||||
>
|
||||
Disabled
|
||||
</Text>
|
||||
)}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
|
||||
<div className="grid w-full grid-cols-8 gap-x-4 gap-y-2">
|
||||
<div className="col-span-8 sm:col-span-2">
|
||||
<Text className="text-xs font-medium">Plan</Text>
|
||||
<Text variant="subtitle2">You can change this later.</Text>
|
||||
</div>
|
||||
|
||||
<RadioGroup
|
||||
value={plan.id}
|
||||
onChange={(_event, value) => {
|
||||
setPlan(plans.find((p) => p.id === value));
|
||||
}}
|
||||
className="col-span-8 space-y-2 sm:col-span-6"
|
||||
>
|
||||
{plans.map((currentPlan) => {
|
||||
const disabledPlan =
|
||||
currentPlan.isFree &&
|
||||
numberOfFreeAndLiveProjects >= MAX_FREE_PROJECTS;
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
visible={disabledPlan}
|
||||
title="Only one free project can be active at any given time. Please pause your active free project before creating a new one."
|
||||
key={currentPlan.id}
|
||||
slotProps={{
|
||||
tooltip: { className: '!max-w-xs w-full text-center' },
|
||||
}}
|
||||
>
|
||||
<Box className="w-full rounded-md border">
|
||||
<Radio
|
||||
slotProps={{
|
||||
formControl: {
|
||||
className: 'p-3 w-full',
|
||||
slotProps: {
|
||||
typography: { className: 'w-full' },
|
||||
},
|
||||
},
|
||||
}}
|
||||
value={currentPlan.id}
|
||||
disabled={disabledPlan}
|
||||
label={
|
||||
<div className="flex w-full items-center justify-between ">
|
||||
<div className="inline-block max-w-xs">
|
||||
<Text className="font-medium text-[inherit]">
|
||||
{currentPlan.name}
|
||||
</Text>
|
||||
<Text className="text-xs text-[inherit]">
|
||||
{planDescriptions[currentPlan.name]}
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
{currentPlan.isFree ? (
|
||||
<Text
|
||||
variant="h3"
|
||||
component="span"
|
||||
className="text-[inherit]"
|
||||
>
|
||||
Free
|
||||
</Text>
|
||||
) : (
|
||||
<Text variant="h3" component="span">
|
||||
${currentPlan.price}/mo
|
||||
</Text>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</Box>
|
||||
</Tooltip>
|
||||
);
|
||||
})}
|
||||
</RadioGroup>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{submitState.error && (
|
||||
<Alert severity="error" className="text-left">
|
||||
<Text className="font-medium">Error</Text>{' '}
|
||||
<Text className="font-medium">
|
||||
{submitState.error &&
|
||||
getErrorMessage(submitState.error, 'application')}{' '}
|
||||
</Text>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
<div className="flex justify-end">
|
||||
{showPaymentModal && (
|
||||
<Modal
|
||||
showModal={showPaymentModal}
|
||||
close={() => {
|
||||
setShowPaymentModal(false);
|
||||
}}
|
||||
onPaymentMethodAdded={handleSubmit}
|
||||
workspaceId={workspace.id}
|
||||
/>
|
||||
</Modal>
|
||||
)}
|
||||
>
|
||||
<BillingPaymentMethodForm
|
||||
close={() => {
|
||||
setShowPaymentModal(false);
|
||||
}}
|
||||
onPaymentMethodAdded={handleSubmit}
|
||||
workspaceId={workspace.id}
|
||||
/>
|
||||
</Modal>
|
||||
)}
|
||||
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (!plan.isFree && workspace.paymentMethods.length === 0) {
|
||||
setShowPaymentModal(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
handleSubmit();
|
||||
}}
|
||||
type="submit"
|
||||
loading={submitState.loading}
|
||||
disabled={
|
||||
!!applicationError ||
|
||||
!!submitState.error ||
|
||||
!!passwordError ||
|
||||
maintenanceActive
|
||||
}
|
||||
id="create-app"
|
||||
>
|
||||
Create Project
|
||||
</Button>
|
||||
<Button
|
||||
type="submit"
|
||||
loading={submitState.loading}
|
||||
disabled={!!passwordError || maintenanceActive}
|
||||
id="create-app"
|
||||
>
|
||||
Create Project
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
export default function NewProjectPage() {
|
||||
const { data, loading, error } = usePrefetchNewAppQuery();
|
||||
const router = useRouter();
|
||||
const user = useUserData();
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
const { data, loading, error } = usePrefetchNewAppQuery();
|
||||
|
||||
const {
|
||||
data: freeAndActiveProjectsData,
|
||||
loading: freeAndActiveProjectsLoading,
|
||||
error: freeAndActiveProjectsError,
|
||||
} = useGetFreeAndActiveProjectsQuery({
|
||||
variables: { userId: user?.id },
|
||||
fetchPolicy: 'cache-and-network',
|
||||
});
|
||||
|
||||
if (error || freeAndActiveProjectsError) {
|
||||
throw error || freeAndActiveProjectsError;
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
if (loading || freeAndActiveProjectsLoading) {
|
||||
return (
|
||||
<ActivityIndicator delay={500} label="Loading plans and regions..." />
|
||||
);
|
||||
}
|
||||
|
||||
const { workspace } = router.query;
|
||||
|
||||
const { regions, plans, workspaces } = data;
|
||||
|
||||
// get pre-selected workspace
|
||||
@@ -628,13 +630,16 @@ export default function NewProjectPage() {
|
||||
? workspaces.find((w) => w.slug === workspace)
|
||||
: workspaces[0];
|
||||
|
||||
const preSelectedRegion = regions.filter((region) => region.active)[0];
|
||||
const preSelectedRegion = regions.find((region) => region.active);
|
||||
|
||||
return (
|
||||
<NewProjectPageContent
|
||||
regions={regions}
|
||||
plans={plans}
|
||||
workspaces={workspaces}
|
||||
numberOfFreeAndLiveProjects={
|
||||
freeAndActiveProjectsData?.freeAndActiveProjects.length
|
||||
}
|
||||
preSelectedWorkspace={preSelectedWorkspace}
|
||||
preSelectedRegion={preSelectedRegion}
|
||||
/>
|
||||
|
||||
@@ -22,3 +22,8 @@ export const READ_ONLY_SCHEMAS = ['auth', 'storage'];
|
||||
* Key used to store the color preference in local storage.
|
||||
*/
|
||||
export const COLOR_PREFERENCE_STORAGE_KEY = 'nhost-color-preference';
|
||||
|
||||
/**
|
||||
* Maximum number of free projects a user is allowed to have.
|
||||
*/
|
||||
export const MAX_FREE_PROJECTS = 1;
|
||||
|
||||
163
dashboard/src/utils/__generated__/graphql.ts
generated
163
dashboard/src/utils/__generated__/graphql.ts
generated
@@ -865,6 +865,38 @@ export type ConfigBooleanComparisonExp = {
|
||||
_nin?: InputMaybe<Array<Scalars['Boolean']>>;
|
||||
};
|
||||
|
||||
export type ConfigClaimMap = {
|
||||
__typename?: 'ConfigClaimMap';
|
||||
claim: Scalars['String'];
|
||||
default?: Maybe<Scalars['String']>;
|
||||
path?: Maybe<Scalars['String']>;
|
||||
value?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type ConfigClaimMapComparisonExp = {
|
||||
_and?: InputMaybe<Array<ConfigClaimMapComparisonExp>>;
|
||||
_not?: InputMaybe<ConfigClaimMapComparisonExp>;
|
||||
_or?: InputMaybe<Array<ConfigClaimMapComparisonExp>>;
|
||||
claim?: InputMaybe<ConfigStringComparisonExp>;
|
||||
default?: InputMaybe<ConfigStringComparisonExp>;
|
||||
path?: InputMaybe<ConfigStringComparisonExp>;
|
||||
value?: InputMaybe<ConfigStringComparisonExp>;
|
||||
};
|
||||
|
||||
export type ConfigClaimMapInsertInput = {
|
||||
claim: Scalars['String'];
|
||||
default?: InputMaybe<Scalars['String']>;
|
||||
path?: InputMaybe<Scalars['String']>;
|
||||
value?: InputMaybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type ConfigClaimMapUpdateInput = {
|
||||
claim?: InputMaybe<Scalars['String']>;
|
||||
default?: InputMaybe<Scalars['String']>;
|
||||
path?: InputMaybe<Scalars['String']>;
|
||||
value?: InputMaybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type ConfigConfig = {
|
||||
__typename?: 'ConfigConfig';
|
||||
auth?: Maybe<ConfigAuth>;
|
||||
@@ -1079,6 +1111,7 @@ export type ConfigJwtSecret = {
|
||||
allowed_skew?: Maybe<Scalars['ConfigUint32']>;
|
||||
audience?: Maybe<Scalars['String']>;
|
||||
claims_format?: Maybe<Scalars['String']>;
|
||||
claims_map?: Maybe<Array<ConfigClaimMap>>;
|
||||
claims_namespace?: Maybe<Scalars['String']>;
|
||||
claims_namespace_path?: Maybe<Scalars['String']>;
|
||||
header?: Maybe<Scalars['String']>;
|
||||
@@ -1095,6 +1128,7 @@ export type ConfigJwtSecretComparisonExp = {
|
||||
allowed_skew?: InputMaybe<ConfigUint32ComparisonExp>;
|
||||
audience?: InputMaybe<ConfigStringComparisonExp>;
|
||||
claims_format?: InputMaybe<ConfigStringComparisonExp>;
|
||||
claims_map?: InputMaybe<ConfigClaimMapComparisonExp>;
|
||||
claims_namespace?: InputMaybe<ConfigStringComparisonExp>;
|
||||
claims_namespace_path?: InputMaybe<ConfigStringComparisonExp>;
|
||||
header?: InputMaybe<ConfigStringComparisonExp>;
|
||||
@@ -1108,6 +1142,7 @@ export type ConfigJwtSecretInsertInput = {
|
||||
allowed_skew?: InputMaybe<Scalars['ConfigUint32']>;
|
||||
audience?: InputMaybe<Scalars['String']>;
|
||||
claims_format?: InputMaybe<Scalars['String']>;
|
||||
claims_map?: InputMaybe<Array<ConfigClaimMapInsertInput>>;
|
||||
claims_namespace?: InputMaybe<Scalars['String']>;
|
||||
claims_namespace_path?: InputMaybe<Scalars['String']>;
|
||||
header?: InputMaybe<Scalars['String']>;
|
||||
@@ -1121,6 +1156,7 @@ export type ConfigJwtSecretUpdateInput = {
|
||||
allowed_skew?: InputMaybe<Scalars['ConfigUint32']>;
|
||||
audience?: InputMaybe<Scalars['String']>;
|
||||
claims_format?: InputMaybe<Scalars['String']>;
|
||||
claims_map?: InputMaybe<Array<ConfigClaimMapUpdateInput>>;
|
||||
claims_namespace?: InputMaybe<Scalars['String']>;
|
||||
claims_namespace_path?: InputMaybe<Scalars['String']>;
|
||||
header?: InputMaybe<Scalars['String']>;
|
||||
@@ -16361,6 +16397,13 @@ export type InsertApplicationMutationVariables = Exact<{
|
||||
|
||||
export type InsertApplicationMutation = { __typename?: 'mutation_root', insertApp?: { __typename?: 'apps', id: any, name: string, slug: string, workspace: { __typename?: 'workspaces', id: any, name: string, slug: string } } | null };
|
||||
|
||||
export type PauseApplicationMutationVariables = Exact<{
|
||||
appId: Scalars['uuid'];
|
||||
}>;
|
||||
|
||||
|
||||
export type PauseApplicationMutation = { __typename?: 'mutation_root', updateApp?: { __typename?: 'apps', id: any } | null };
|
||||
|
||||
export type PrefetchNewAppRegionsFragment = { __typename?: 'regions', id: any, city: string, active: boolean, country: { __typename?: 'countries', code: any, name: string } };
|
||||
|
||||
export type PrefetchNewAppPlansFragment = { __typename?: 'plans', id: any, name: string, isDefault: boolean, isFree: boolean, price: number, featureBackupEnabled: boolean, featureCustomDomainsEnabled: boolean, featureMaxDbSize: number };
|
||||
@@ -16454,6 +16497,13 @@ export type UpdateConfigMutationVariables = Exact<{
|
||||
|
||||
export type UpdateConfigMutation = { __typename?: 'mutation_root', updateConfig: { __typename?: 'ConfigConfig', id: 'ConfigConfig' } };
|
||||
|
||||
export type UnpauseApplicationMutationVariables = Exact<{
|
||||
appId: Scalars['uuid'];
|
||||
}>;
|
||||
|
||||
|
||||
export type UnpauseApplicationMutation = { __typename?: 'mutation_root', updateApp?: { __typename?: 'apps', id: any } | null };
|
||||
|
||||
export type UpdateAppMutationVariables = Exact<{
|
||||
id: Scalars['uuid'];
|
||||
app: Apps_Set_Input;
|
||||
@@ -16784,6 +16834,13 @@ export type GetAvatarQueryVariables = Exact<{
|
||||
|
||||
export type GetAvatarQuery = { __typename?: 'query_root', user?: { __typename?: 'users', id: any, avatarUrl: string } | null };
|
||||
|
||||
export type GetFreeAndActiveProjectsQueryVariables = Exact<{
|
||||
userId: Scalars['uuid'];
|
||||
}>;
|
||||
|
||||
|
||||
export type GetFreeAndActiveProjectsQuery = { __typename?: 'query_root', freeAndActiveProjects: Array<{ __typename?: 'apps', id: any }> };
|
||||
|
||||
export type ProjectFragment = { __typename?: 'apps', id: any, slug: string, name: string, repositoryProductionBranch: string, subdomain: string, isProvisioned: boolean, createdAt: any, desiredState: number, nhostBaseFolder: string, providersUpdated?: boolean | null, config?: { __typename?: 'ConfigConfig', hasura: { __typename?: 'ConfigHasura', adminSecret: string } } | null, featureFlags: Array<{ __typename?: 'featureFlags', description: string, id: any, name: string, value: string }>, appStates: Array<{ __typename?: 'appStateHistory', id: any, appId: any, message?: string | null, stateId: number, createdAt: any }>, region: { __typename?: 'regions', id: any, countryCode: string, awsName: string, city: string }, plan: { __typename?: 'plans', id: any, name: string, isFree: boolean }, githubRepository?: { __typename?: 'githubRepositories', fullName: string } | null, deployments: Array<{ __typename?: 'deployments', id: any, commitSHA: string, commitMessage?: string | null, commitUserName?: string | null, deploymentStartedAt?: any | null, deploymentEndedAt?: any | null, commitUserAvatarUrl?: string | null, deploymentStatus?: string | null }> };
|
||||
|
||||
export type GetOneUserQueryVariables = Exact<{
|
||||
@@ -17729,6 +17786,39 @@ export function useInsertApplicationMutation(baseOptions?: Apollo.MutationHookOp
|
||||
export type InsertApplicationMutationHookResult = ReturnType<typeof useInsertApplicationMutation>;
|
||||
export type InsertApplicationMutationResult = Apollo.MutationResult<InsertApplicationMutation>;
|
||||
export type InsertApplicationMutationOptions = Apollo.BaseMutationOptions<InsertApplicationMutation, InsertApplicationMutationVariables>;
|
||||
export const PauseApplicationDocument = gql`
|
||||
mutation PauseApplication($appId: uuid!) {
|
||||
updateApp(pk_columns: {id: $appId}, _set: {desiredState: 6}) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
export type PauseApplicationMutationFn = Apollo.MutationFunction<PauseApplicationMutation, PauseApplicationMutationVariables>;
|
||||
|
||||
/**
|
||||
* __usePauseApplicationMutation__
|
||||
*
|
||||
* To run a mutation, you first call `usePauseApplicationMutation` within a React component and pass it any options that fit your needs.
|
||||
* When your component renders, `usePauseApplicationMutation` returns a tuple that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - An object with fields that represent the current status of the mutation's execution
|
||||
*
|
||||
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
|
||||
*
|
||||
* @example
|
||||
* const [pauseApplicationMutation, { data, loading, error }] = usePauseApplicationMutation({
|
||||
* variables: {
|
||||
* appId: // value for 'appId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function usePauseApplicationMutation(baseOptions?: Apollo.MutationHookOptions<PauseApplicationMutation, PauseApplicationMutationVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useMutation<PauseApplicationMutation, PauseApplicationMutationVariables>(PauseApplicationDocument, options);
|
||||
}
|
||||
export type PauseApplicationMutationHookResult = ReturnType<typeof usePauseApplicationMutation>;
|
||||
export type PauseApplicationMutationResult = Apollo.MutationResult<PauseApplicationMutation>;
|
||||
export type PauseApplicationMutationOptions = Apollo.BaseMutationOptions<PauseApplicationMutation, PauseApplicationMutationVariables>;
|
||||
export const PrefetchNewAppDocument = gql`
|
||||
query PrefetchNewApp {
|
||||
regions(order_by: {city: asc}) {
|
||||
@@ -18314,6 +18404,39 @@ export function useUpdateConfigMutation(baseOptions?: Apollo.MutationHookOptions
|
||||
export type UpdateConfigMutationHookResult = ReturnType<typeof useUpdateConfigMutation>;
|
||||
export type UpdateConfigMutationResult = Apollo.MutationResult<UpdateConfigMutation>;
|
||||
export type UpdateConfigMutationOptions = Apollo.BaseMutationOptions<UpdateConfigMutation, UpdateConfigMutationVariables>;
|
||||
export const UnpauseApplicationDocument = gql`
|
||||
mutation UnpauseApplication($appId: uuid!) {
|
||||
updateApp(pk_columns: {id: $appId}, _set: {desiredState: 5}) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
export type UnpauseApplicationMutationFn = Apollo.MutationFunction<UnpauseApplicationMutation, UnpauseApplicationMutationVariables>;
|
||||
|
||||
/**
|
||||
* __useUnpauseApplicationMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useUnpauseApplicationMutation` within a React component and pass it any options that fit your needs.
|
||||
* When your component renders, `useUnpauseApplicationMutation` returns a tuple that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - An object with fields that represent the current status of the mutation's execution
|
||||
*
|
||||
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
|
||||
*
|
||||
* @example
|
||||
* const [unpauseApplicationMutation, { data, loading, error }] = useUnpauseApplicationMutation({
|
||||
* variables: {
|
||||
* appId: // value for 'appId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useUnpauseApplicationMutation(baseOptions?: Apollo.MutationHookOptions<UnpauseApplicationMutation, UnpauseApplicationMutationVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useMutation<UnpauseApplicationMutation, UnpauseApplicationMutationVariables>(UnpauseApplicationDocument, options);
|
||||
}
|
||||
export type UnpauseApplicationMutationHookResult = ReturnType<typeof useUnpauseApplicationMutation>;
|
||||
export type UnpauseApplicationMutationResult = Apollo.MutationResult<UnpauseApplicationMutation>;
|
||||
export type UnpauseApplicationMutationOptions = Apollo.BaseMutationOptions<UnpauseApplicationMutation, UnpauseApplicationMutationVariables>;
|
||||
export const UpdateAppDocument = gql`
|
||||
mutation updateApp($id: uuid!, $app: apps_set_input!) {
|
||||
updateApp(pk_columns: {id: $id}, _set: $app) {
|
||||
@@ -20072,6 +20195,46 @@ export type GetAvatarQueryResult = Apollo.QueryResult<GetAvatarQuery, GetAvatarQ
|
||||
export function refetchGetAvatarQuery(variables: GetAvatarQueryVariables) {
|
||||
return { query: GetAvatarDocument, variables: variables }
|
||||
}
|
||||
export const GetFreeAndActiveProjectsDocument = gql`
|
||||
query GetFreeAndActiveProjects($userId: uuid!) {
|
||||
freeAndActiveProjects: apps(
|
||||
where: {creatorUserId: {_eq: $userId}, plan: {isFree: {_eq: true}}, desiredState: {_eq: 5}}
|
||||
) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* __useGetFreeAndActiveProjectsQuery__
|
||||
*
|
||||
* To run a query within a React component, call `useGetFreeAndActiveProjectsQuery` and pass it any options that fit your needs.
|
||||
* When your component renders, `useGetFreeAndActiveProjectsQuery` 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 } = useGetFreeAndActiveProjectsQuery({
|
||||
* variables: {
|
||||
* userId: // value for 'userId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useGetFreeAndActiveProjectsQuery(baseOptions: Apollo.QueryHookOptions<GetFreeAndActiveProjectsQuery, GetFreeAndActiveProjectsQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useQuery<GetFreeAndActiveProjectsQuery, GetFreeAndActiveProjectsQueryVariables>(GetFreeAndActiveProjectsDocument, options);
|
||||
}
|
||||
export function useGetFreeAndActiveProjectsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetFreeAndActiveProjectsQuery, GetFreeAndActiveProjectsQueryVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useLazyQuery<GetFreeAndActiveProjectsQuery, GetFreeAndActiveProjectsQueryVariables>(GetFreeAndActiveProjectsDocument, options);
|
||||
}
|
||||
export type GetFreeAndActiveProjectsQueryHookResult = ReturnType<typeof useGetFreeAndActiveProjectsQuery>;
|
||||
export type GetFreeAndActiveProjectsLazyQueryHookResult = ReturnType<typeof useGetFreeAndActiveProjectsLazyQuery>;
|
||||
export type GetFreeAndActiveProjectsQueryResult = Apollo.QueryResult<GetFreeAndActiveProjectsQuery, GetFreeAndActiveProjectsQueryVariables>;
|
||||
export function refetchGetFreeAndActiveProjectsQuery(variables: GetFreeAndActiveProjectsQueryVariables) {
|
||||
return { query: GetFreeAndActiveProjectsDocument, variables: variables }
|
||||
}
|
||||
export const GetOneUserDocument = gql`
|
||||
query getOneUser($userId: uuid!) {
|
||||
user(id: $userId) {
|
||||
|
||||
@@ -7,7 +7,7 @@ export interface ColumnDetails {
|
||||
hasDefaultValue: boolean;
|
||||
}
|
||||
|
||||
function createGenericValidationSchema<T extends yup.BaseSchema>(
|
||||
function createGenericValidationSchema<T extends yup.Schema>(
|
||||
genericSchema: T,
|
||||
{ isNullable, hasDefaultValue, isIdentity }: ColumnDetails,
|
||||
): T {
|
||||
@@ -136,7 +136,10 @@ export function createDynamicValidationSchema(
|
||||
};
|
||||
}
|
||||
|
||||
if (column.type === 'text' && column.specificType === 'jsonb') {
|
||||
if (
|
||||
column.type === 'text' &&
|
||||
(column.specificType === 'jsonb' || column.specificType === 'json')
|
||||
) {
|
||||
return {
|
||||
...schema,
|
||||
[column.id]: createJSONValidationSchema(details),
|
||||
|
||||
@@ -4,6 +4,10 @@ import { isDevOrStaging } from './helpers';
|
||||
* @param content {string} This string to log on the particular channel.
|
||||
*/
|
||||
export const discordAnnounce = async (content: string) => {
|
||||
if (!process.env.NEXT_PUBLIC_DISCORD_LOGGING) {
|
||||
return;
|
||||
}
|
||||
|
||||
const username = isDevOrStaging() ? 'console-next(dev)' : 'console-next';
|
||||
|
||||
const params = {
|
||||
|
||||
@@ -10,5 +10,6 @@ export default defineConfig({
|
||||
environment: 'jsdom',
|
||||
globals: true,
|
||||
setupFiles: 'src/setupTests.ts',
|
||||
include: ['src/**/*.(spec|test).{js,jsx,ts,tsx}'],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -56,6 +56,7 @@ Follow this guide to sign in users with Google.
|
||||
- Click on **Credentials** under **APIs & Services** in the left menu.
|
||||
- Click **+ CREATE CREDENTIALS** and then **OAuth client ID** in the top menu.
|
||||
- On the **Create OAuth client ID** page for **Application Type** select **Web application**.
|
||||
- Under **Authorized JavaScript origins**, add your project's redirect URL for the Google sign-in method in the following format: `https://<subdomain>.auth.<region>.nhost.run`
|
||||
- Under **Authorized redirect URIs** add your **OAuth Callback URL** from Nhost.
|
||||
- Click **CREATE**.
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ export default (req: Request, res: Response) => {
|
||||
To get the `Request`, and `Response` types you can install the `@types/express` package.
|
||||
|
||||
```bash
|
||||
npm install -d @types/express
|
||||
npm install -D @types/express
|
||||
# or yarn
|
||||
yarn add -d @types/express
|
||||
yarn add -D @types/express
|
||||
# or pnpm
|
||||
pnpm add -d @types/express
|
||||
pnpm add -D @types/express
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/apollo
|
||||
|
||||
## 5.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@2.1.1
|
||||
|
||||
## 5.1.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/apollo",
|
||||
"version": "5.1.0",
|
||||
"version": "5.1.1",
|
||||
"description": "Nhost Apollo Client library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @nhost/react-apollo
|
||||
|
||||
## 5.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/apollo@5.1.1
|
||||
- @nhost/react@2.0.11
|
||||
|
||||
## 5.0.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/react-apollo",
|
||||
"version": "5.0.11",
|
||||
"version": "5.0.12",
|
||||
"description": "Nhost React Apollo client",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/react-urql
|
||||
|
||||
## 2.0.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@2.0.11
|
||||
|
||||
## 2.0.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/react-urql",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Nhost React URQL client",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
"test": "turbo run test --filter=!@nhost/dashboard --filter=!@nhost/docs --filter=!@nhost-examples/* --no-deps --include-dependencies",
|
||||
"test:all": "turbo run test",
|
||||
"test:dashboard": "turbo run test --filter=@nhost/dashboard",
|
||||
"e2e:dashboard": "turbo run e2e --filter=@nhost/dashboard",
|
||||
"e2e": "turbo run e2e --concurrency=1",
|
||||
"changeset": "changeset",
|
||||
"docgen": "turbo run build --filter=@nhost/docgen --no-deps && pnpm i && turbo run docgen --filter=!@nhost/docgen --filter=@nhost/* && :",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/hasura-storage-js
|
||||
|
||||
## 2.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 614f213e: fix(hasura-storage-js): allow image transformation parameters in `getPresignedUrl`
|
||||
|
||||
## 2.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/hasura-storage-js",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.4",
|
||||
"description": "Hasura-storage client",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
@@ -47,6 +47,7 @@
|
||||
"e2e": "start-test e2e:backend http-get://localhost:9695 ci:test",
|
||||
"ci:test": "vitest run",
|
||||
"e2e:backend": "nhost dev --no-browser",
|
||||
"test": "vitest --config ./vite.unit.config.js",
|
||||
"test:watch": "vitest",
|
||||
"test:coverage": "vitest run --coverage",
|
||||
"prettier": "prettier --check src/",
|
||||
|
||||
@@ -129,6 +129,7 @@ export class HasuraStorageClient {
|
||||
async getPresignedUrl(
|
||||
params: StorageGetPresignedUrlParams
|
||||
): Promise<StorageGetPresignedUrlResponse> {
|
||||
const { fileId, ...imageTransformationParams } = params
|
||||
const { presignedUrl, error } = await this.api.getPresignedUrl(params)
|
||||
if (error) {
|
||||
return { presignedUrl: null, error }
|
||||
@@ -138,7 +139,18 @@ export class HasuraStorageClient {
|
||||
return { presignedUrl: null, error: new Error('Invalid file id') }
|
||||
}
|
||||
|
||||
return { presignedUrl, error: null }
|
||||
const urlWithTransformationParams = appendImageTransformationParameters(
|
||||
presignedUrl.url,
|
||||
imageTransformationParams
|
||||
)
|
||||
|
||||
return {
|
||||
presignedUrl: {
|
||||
...presignedUrl,
|
||||
url: urlWithTransformationParams
|
||||
},
|
||||
error: null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { expect, test } from 'vitest'
|
||||
import appendImageTransformationParameters from './appendImageTransformationParameters'
|
||||
|
||||
test('should append image transformation parameters to a simple URL', () => {
|
||||
expect(
|
||||
appendImageTransformationParameters('https://example.com/', {
|
||||
width: 100,
|
||||
height: 100,
|
||||
blur: 50,
|
||||
quality: 80
|
||||
})
|
||||
).toBe('https://example.com/?w=100&h=100&b=50&q=80')
|
||||
})
|
||||
|
||||
test('should append image transformation parameters to a URL with existing query parameters', () => {
|
||||
expect(
|
||||
appendImageTransformationParameters('https://example.com/?foo=bar', {
|
||||
width: 100,
|
||||
height: 100,
|
||||
blur: 50,
|
||||
quality: 80
|
||||
})
|
||||
).toBe('https://example.com/?foo=bar&w=100&h=100&b=50&q=80')
|
||||
})
|
||||
|
||||
test('should not append falsy values', () => {
|
||||
expect(
|
||||
appendImageTransformationParameters('https://example.com/', {
|
||||
width: undefined,
|
||||
height: 100,
|
||||
blur: undefined,
|
||||
quality: 80
|
||||
})
|
||||
).toBe('https://example.com/?h=100&q=80')
|
||||
})
|
||||
|
||||
test('should keep the original URL if no transformation parameters are provided', () => {
|
||||
expect(appendImageTransformationParameters('https://example.com/', {})).toBe(
|
||||
'https://example.com/'
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,36 @@
|
||||
import { StorageImageTransformationParams } from '../types'
|
||||
|
||||
/**
|
||||
* Appends image transformation parameters to the URL. If the URL already
|
||||
* contains query parameters, the transformation parameters are appended to
|
||||
* the existing query parameters.
|
||||
*
|
||||
* @internal
|
||||
* @param url - The URL to append the transformation parameters to.
|
||||
* @param params - The image transformation parameters.
|
||||
* @returns The URL with the transformation parameters appended.
|
||||
*/
|
||||
export default function appendImageTransformationParameters(
|
||||
url: string,
|
||||
params: StorageImageTransformationParams
|
||||
): string {
|
||||
const urlObject = new URL(url)
|
||||
|
||||
// create an object with the transformation parameters by using the first
|
||||
// character of the parameter name as the key
|
||||
const imageTransformationParams = Object.entries(params).reduce(
|
||||
(accumulator, [key, value]) => ({ ...accumulator, [key.charAt(0)]: value }),
|
||||
{} as Record<string, any>
|
||||
)
|
||||
|
||||
// set the query parameters in the URL object
|
||||
Object.entries(imageTransformationParams).forEach(([key, value]) => {
|
||||
if (!value) {
|
||||
return
|
||||
}
|
||||
|
||||
urlObject.searchParams.set(key, value)
|
||||
})
|
||||
|
||||
return urlObject.toString()
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { default as appendImageTransformationParameters } from './appendImageTransformationParameters'
|
||||
@@ -1,13 +1,2 @@
|
||||
import { StorageImageTransformationParams } from './types'
|
||||
|
||||
export * from './appendImageTransformationParameters'
|
||||
export * from './types'
|
||||
|
||||
export const appendImageTransformationParameters = (
|
||||
url: string,
|
||||
params: StorageImageTransformationParams
|
||||
): string => {
|
||||
const queryParameters = Object.entries(params)
|
||||
.map(([key, value]) => `${key.charAt(0)}=${value}`)
|
||||
.join('&')
|
||||
return queryParameters ? `${url}?${queryParameters}` : url
|
||||
}
|
||||
|
||||
@@ -65,9 +65,7 @@ export interface StorageGetUrlParams extends StorageImageTransformationParams {
|
||||
fileId: string
|
||||
}
|
||||
|
||||
// TODO not implemented yet in hasura-storage
|
||||
// export interface StorageGetPresignedUrlParams extends StorageImageTransformationParams {
|
||||
export interface StorageGetPresignedUrlParams {
|
||||
export interface StorageGetPresignedUrlParams extends StorageImageTransformationParams {
|
||||
fileId: string
|
||||
}
|
||||
|
||||
|
||||
15
packages/hasura-storage-js/vite.unit.config.js
Normal file
15
packages/hasura-storage-js/vite.unit.config.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
import baseConfig from '../../config/vite.lib.config'
|
||||
|
||||
const PWD = process.env.PWD
|
||||
|
||||
export default defineConfig({
|
||||
...baseConfig,
|
||||
test: {
|
||||
...(baseConfig.test || {}),
|
||||
testTimeout: 30000,
|
||||
environment: 'node',
|
||||
include: [`${PWD}/src/**/*.{spec,test}.{ts,tsx}`]
|
||||
}
|
||||
})
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/nextjs
|
||||
|
||||
## 1.13.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/react@2.0.11
|
||||
|
||||
## 1.13.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/nextjs",
|
||||
"version": "1.13.16",
|
||||
"version": "1.13.17",
|
||||
"description": "Nhost NextJS library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @nhost/nhost-js
|
||||
|
||||
## 2.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [614f213e]
|
||||
- @nhost/hasura-storage-js@2.0.4
|
||||
|
||||
## 2.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/nhost-js",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"description": "Nhost JavaScript SDK",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/react
|
||||
|
||||
## 2.0.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@2.1.1
|
||||
|
||||
## 2.0.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/react",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Nhost React library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/vue
|
||||
|
||||
## 1.13.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @nhost/nhost-js@2.1.1
|
||||
|
||||
## 1.13.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/vue",
|
||||
"version": "1.13.16",
|
||||
"version": "1.13.17",
|
||||
"description": "Nhost Vue library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
85
pnpm-lock.yaml
generated
85
pnpm-lock.yaml
generated
@@ -95,7 +95,7 @@ importers:
|
||||
'@graphql-codegen/typescript-react-apollo': ^3.3.1
|
||||
'@headlessui/react': ^1.6.5
|
||||
'@heroicons/react': ^1.0.6
|
||||
'@hookform/resolvers': ^2.9.10
|
||||
'@hookform/resolvers': ^3.0.0
|
||||
'@mui/base': ^5.0.0-alpha.106
|
||||
'@mui/material': ^5.10.14
|
||||
'@mui/system': ^5.10.14
|
||||
@@ -103,6 +103,7 @@ importers:
|
||||
'@next/bundle-analyzer': ^12.3.1
|
||||
'@nhost/nextjs': workspace:*
|
||||
'@nhost/react-apollo': workspace:*
|
||||
'@playwright/test': ^1.31.2
|
||||
'@segment/snippet': ^4.15.3
|
||||
'@storybook/addon-actions': ^6.5.14
|
||||
'@storybook/addon-essentials': ^6.5.14
|
||||
@@ -143,6 +144,7 @@ importers:
|
||||
clsx: ^1.2.1
|
||||
csstype: ^3.0.10
|
||||
date-fns: ^2.29.3
|
||||
dotenv: ^16.0.3
|
||||
encoding: ^0.1.13
|
||||
eslint: ^8.28.0
|
||||
eslint-config-airbnb: 19.0.4
|
||||
@@ -201,7 +203,7 @@ importers:
|
||||
vite-tsconfig-paths: ^4.0.3
|
||||
vitest: ^0.29.0
|
||||
webpack: ^5.75.0
|
||||
yup: ^0.32.11
|
||||
yup: ^1.0.2
|
||||
yup-password: ^0.2.2
|
||||
dependencies:
|
||||
'@apollo/client': 3.7.7_xe4twbeoqswbn2uas4ov5melbq
|
||||
@@ -216,7 +218,7 @@ importers:
|
||||
'@graphiql/toolkit': 0.8.2_7fbl5omhlrpwpn5f5culy6mafe
|
||||
'@headlessui/react': 1.7.4_biqbaboplfbrettd7655fr4n2y
|
||||
'@heroicons/react': 1.0.6_react@18.2.0
|
||||
'@hookform/resolvers': 2.9.10_react-hook-form@7.42.1
|
||||
'@hookform/resolvers': 3.0.0_react-hook-form@7.42.1
|
||||
'@mui/base': 5.0.0-alpha.106_zula6vjvt3wdocc4mwcxqa6nzi
|
||||
'@mui/material': 5.10.14_acl7mc3llczqccvmbrsweq6vga
|
||||
'@mui/system': 5.10.14_teoksulxetwanny5ohzazahldq
|
||||
@@ -263,7 +265,7 @@ importers:
|
||||
tailwind-merge: 1.8.0
|
||||
utility-types: 3.10.0
|
||||
validator: 13.7.0
|
||||
yup: 0.32.11
|
||||
yup: 1.0.2
|
||||
yup-password: 0.2.2
|
||||
devDependencies:
|
||||
'@babel/core': 7.20.2
|
||||
@@ -273,6 +275,7 @@ importers:
|
||||
'@graphql-codegen/typescript-operations': 3.0.1_rjjjs2nwgns3bcvnnqb5eu5nry
|
||||
'@graphql-codegen/typescript-react-apollo': 3.3.4_h5id4k276q7jixaqo46vuuayz4
|
||||
'@next/bundle-analyzer': 12.3.1
|
||||
'@playwright/test': 1.31.2
|
||||
'@storybook/addon-actions': 6.5.14_biqbaboplfbrettd7655fr4n2y
|
||||
'@storybook/addon-essentials': 6.5.14_2d2r642xwmvaauuvastzobrbwe
|
||||
'@storybook/addon-interactions': 6.5.14_o2w7dvvbfxaohzk6den2xlbkgq
|
||||
@@ -302,6 +305,7 @@ importers:
|
||||
babel-loader: 8.3.0_npabyccmuonwo2rku4k53xo3hi
|
||||
babel-plugin-transform-remove-console: 6.9.4
|
||||
csstype: 3.1.0
|
||||
dotenv: 16.0.3
|
||||
encoding: 0.1.13
|
||||
eslint: 8.28.0
|
||||
eslint-config-airbnb: 19.0.4_vt5pco6i6xyxmp2zptq3cuddue
|
||||
@@ -4494,7 +4498,6 @@ packages:
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.9
|
||||
dev: true
|
||||
|
||||
/@cypress/request/2.88.10:
|
||||
resolution: {integrity: sha512-Zp7F+R93N0yZyG34GutyTNr+okam7s/Fzc1+i3kcqOP8vk6OuajuE9qZJ6Rs+10/1JFtXFYMdyarnU1rZuJesg==}
|
||||
@@ -8246,8 +8249,8 @@ packages:
|
||||
react: 18.2.0
|
||||
dev: false
|
||||
|
||||
/@hookform/resolvers/2.9.10_react-hook-form@7.42.1:
|
||||
resolution: {integrity: sha512-JIL1DgJIlH9yuxcNGtyhsWX/PgNltz+5Gr6+8SX9fhXc/hPbEIk6wPI82nhgvp3uUb6ZfAM5mqg/x7KR7NAb+A==}
|
||||
/@hookform/resolvers/3.0.0_react-hook-form@7.42.1:
|
||||
resolution: {integrity: sha512-SQPefakODpyq25b/phHXDKCdRrEfPcCXV7B4nAa139wE1DxufYbbNAjeo0T04ZXBokRxZ+wD8iA1kkVMa3QwjQ==}
|
||||
peerDependencies:
|
||||
react-hook-form: ^7.0.0
|
||||
dependencies:
|
||||
@@ -8440,7 +8443,6 @@ packages:
|
||||
dependencies:
|
||||
'@jridgewell/resolve-uri': 3.1.0
|
||||
'@jridgewell/sourcemap-codec': 1.4.14
|
||||
dev: true
|
||||
|
||||
/@leichtgewicht/ip-codec/2.0.3:
|
||||
resolution: {integrity: sha512-nkalE/f1RvRGChwBnEIoBfSEYOXnCRdleKuv6+lePbMDrMZXeDQnqak5XDOeBgrPPyPfAdcCu/B5z+v3VhplGg==}
|
||||
@@ -9410,6 +9412,17 @@ packages:
|
||||
tslib: 2.5.0
|
||||
webcrypto-core: 1.7.5
|
||||
|
||||
/@playwright/test/1.31.2:
|
||||
resolution: {integrity: sha512-BYVutxDI4JeZKV1+ups6dt5WiqKhjBtIYowyZIJ3kBDmJgsuPKsqqKNIMFbUePLSCmp2cZu+BDL427RcNKTRYw==}
|
||||
engines: {node: '>=14'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@types/node': 16.18.11
|
||||
playwright-core: 1.31.2
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.2
|
||||
dev: true
|
||||
|
||||
/@pmmmwh/react-refresh-webpack-plugin/0.5.9_ohj47mxwagpoxvu7nhhwxzphqm:
|
||||
resolution: {integrity: sha512-7QV4cqUwhkDIHpMAZ9mestSJ2DMIotVTbOUwbiudhjCRTAWWKIaBecELiEM2LT3AHFeOAaHIcFu4dbXjX+9GBA==}
|
||||
engines: {node: '>= 10.13'}
|
||||
@@ -11930,7 +11943,7 @@ packages:
|
||||
tailwindcss: '>=3.0.0 || >= 3.0.0-alpha.1'
|
||||
dependencies:
|
||||
mini-svg-data-uri: 1.4.4
|
||||
tailwindcss: 3.2.1_postcss@8.4.20
|
||||
tailwindcss: 3.2.1_v776zzvn44o7tpgzieipaairwm
|
||||
|
||||
/@tailwindcss/forms/0.5.3_tailwindcss@3.2.4:
|
||||
resolution: {integrity: sha512-y5mb86JUoiUgBjY/o6FJSFZSEttfb3Q5gllE4xoKjAAD+vBrnIhE4dViwUuow3va8mpH4s9jyUbUbrRGoRdc2Q==}
|
||||
@@ -12164,19 +12177,15 @@ packages:
|
||||
|
||||
/@tsconfig/node10/1.0.8:
|
||||
resolution: {integrity: sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==}
|
||||
dev: true
|
||||
|
||||
/@tsconfig/node12/1.0.9:
|
||||
resolution: {integrity: sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==}
|
||||
dev: true
|
||||
|
||||
/@tsconfig/node14/1.0.1:
|
||||
resolution: {integrity: sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==}
|
||||
dev: true
|
||||
|
||||
/@tsconfig/node16/1.0.2:
|
||||
resolution: {integrity: sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==}
|
||||
dev: true
|
||||
|
||||
/@types/argparse/1.0.38:
|
||||
resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==}
|
||||
@@ -12401,6 +12410,7 @@ packages:
|
||||
|
||||
/@types/lodash/4.14.188:
|
||||
resolution: {integrity: sha512-zmEmF5OIM3rb7SbLCFYoQhO4dGt2FRM9AMkxvA3LaADOF1n8in/zGJlWji9fmafLoNyz+FoL6FE0SLtGIArD7w==}
|
||||
dev: true
|
||||
|
||||
/@types/long/4.0.2:
|
||||
resolution: {integrity: sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==}
|
||||
@@ -13382,7 +13392,7 @@ packages:
|
||||
'@babel/plugin-transform-react-jsx-source': 7.19.6_@babel+core@7.20.5
|
||||
magic-string: 0.27.0
|
||||
react-refresh: 0.14.0
|
||||
vite: 4.0.2_@types+node@18.11.17
|
||||
vite: 4.0.2_@types+node@16.18.11
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
@@ -13459,7 +13469,7 @@ packages:
|
||||
c8: 7.13.0
|
||||
picocolors: 1.0.0
|
||||
std-env: 3.3.2
|
||||
vitest: 0.29.1
|
||||
vitest: 0.29.1_jsdom@21.0.0
|
||||
dev: true
|
||||
|
||||
/@vitest/expect/0.29.1:
|
||||
@@ -14415,7 +14425,6 @@ packages:
|
||||
resolution: {integrity: sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/acorn/8.8.1:
|
||||
resolution: {integrity: sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==}
|
||||
@@ -14668,7 +14677,6 @@ packages:
|
||||
|
||||
/arg/4.1.3:
|
||||
resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==}
|
||||
dev: true
|
||||
|
||||
/arg/5.0.2:
|
||||
resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==}
|
||||
@@ -16805,7 +16813,6 @@ packages:
|
||||
|
||||
/create-require/1.1.1:
|
||||
resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==}
|
||||
dev: true
|
||||
|
||||
/cross-fetch/3.1.5:
|
||||
resolution: {integrity: sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==}
|
||||
@@ -17937,7 +17944,6 @@ packages:
|
||||
/diff/4.0.2:
|
||||
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
|
||||
engines: {node: '>=0.3.1'}
|
||||
dev: true
|
||||
|
||||
/diff/5.1.0:
|
||||
resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==}
|
||||
@@ -23750,7 +23756,6 @@ packages:
|
||||
|
||||
/make-error/1.3.6:
|
||||
resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==}
|
||||
dev: true
|
||||
|
||||
/makeerror/1.0.12:
|
||||
resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==}
|
||||
@@ -24476,10 +24481,6 @@ packages:
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/nanoclone/0.2.1:
|
||||
resolution: {integrity: sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==}
|
||||
dev: false
|
||||
|
||||
/nanoid/3.3.4:
|
||||
resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
@@ -25680,6 +25681,12 @@ packages:
|
||||
find-up: 3.0.0
|
||||
dev: false
|
||||
|
||||
/playwright-core/1.31.2:
|
||||
resolution: {integrity: sha512-a1dFgCNQw4vCsG7bnojZjDnPewZcw7tZUNFN0ZkcLYKj+mPmXvg4MpaaKZ5SgqPsOmqIf2YsVRkgqiRDxD+fDQ==}
|
||||
engines: {node: '>=14'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/pluralize/8.0.0:
|
||||
resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -25824,7 +25831,6 @@ packages:
|
||||
postcss-value-parser: 4.2.0
|
||||
read-cache: 1.0.0
|
||||
resolve: 1.22.1
|
||||
dev: true
|
||||
|
||||
/postcss-import/14.1.0_postcss@8.4.20:
|
||||
resolution: {integrity: sha512-flwI+Vgm4SElObFVPpTIT7SU7R3qk2L7PyduMcokiaVKuWv9d/U+Gm/QAd8NDLuykTWTkcrjOeD2Pp1rMeBTGw==}
|
||||
@@ -25836,6 +25842,7 @@ packages:
|
||||
postcss-value-parser: 4.2.0
|
||||
read-cache: 1.0.0
|
||||
resolve: 1.22.1
|
||||
dev: true
|
||||
|
||||
/postcss-js/4.0.0_postcss@8.4.18:
|
||||
resolution: {integrity: sha512-77QESFBwgX4irogGVPgQ5s07vLvFqWr228qZY+w6lW599cRlK/HmnlivnnVUxkjHnCu4J16PDMHcH+e+2HbvTQ==}
|
||||
@@ -25855,7 +25862,6 @@ packages:
|
||||
dependencies:
|
||||
camelcase-css: 2.0.1
|
||||
postcss: 8.4.19
|
||||
dev: true
|
||||
|
||||
/postcss-js/4.0.0_postcss@8.4.20:
|
||||
resolution: {integrity: sha512-77QESFBwgX4irogGVPgQ5s07vLvFqWr228qZY+w6lW599cRlK/HmnlivnnVUxkjHnCu4J16PDMHcH+e+2HbvTQ==}
|
||||
@@ -25865,6 +25871,7 @@ packages:
|
||||
dependencies:
|
||||
camelcase-css: 2.0.1
|
||||
postcss: 8.4.20
|
||||
dev: true
|
||||
|
||||
/postcss-load-config/3.1.4_postcss@8.4.18:
|
||||
resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}
|
||||
@@ -25898,6 +25905,7 @@ packages:
|
||||
lilconfig: 2.0.6
|
||||
postcss: 8.4.20
|
||||
yaml: 1.10.2
|
||||
dev: true
|
||||
|
||||
/postcss-load-config/3.1.4_v776zzvn44o7tpgzieipaairwm:
|
||||
resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}
|
||||
@@ -25915,7 +25923,6 @@ packages:
|
||||
postcss: 8.4.19
|
||||
ts-node: 10.9.1_@types+node@16.18.11
|
||||
yaml: 1.10.2
|
||||
dev: true
|
||||
|
||||
/postcss-loader/4.3.0_gzaxsinx64nntyd3vmdqwl7coe:
|
||||
resolution: {integrity: sha512-M/dSoIiNDOo8Rk0mUqoj4kpGq91gcxCfb9PoyZVdZ76/AuhxylHDYZblNE8o+EQ9AMSASeMFEKxZf5aU6wlx1Q==}
|
||||
@@ -26129,7 +26136,6 @@ packages:
|
||||
dependencies:
|
||||
postcss: 8.4.19
|
||||
postcss-selector-parser: 6.0.10
|
||||
dev: true
|
||||
|
||||
/postcss-nested/6.0.0_postcss@8.4.20:
|
||||
resolution: {integrity: sha512-0DkamqrPcmkBDsLn+vQDIrtkSbNkv5AD/M322ySo9kqFkCIYklym2xEmWkwo+Y3/qZo34tzEPNUw4y7yMCdv5w==}
|
||||
@@ -26139,6 +26145,7 @@ packages:
|
||||
dependencies:
|
||||
postcss: 8.4.20
|
||||
postcss-selector-parser: 6.0.10
|
||||
dev: true
|
||||
|
||||
/postcss-normalize-charset/5.1.0_postcss@8.4.21:
|
||||
resolution: {integrity: sha512-mSgUJ+pd/ldRGVx26p2wz9dNZ7ji6Pn8VWBajMXFf8jk7vUoSrZ2lt/wZR7DtlZYKesmZI680qjr2CeFF2fbUg==}
|
||||
@@ -26355,7 +26362,6 @@ packages:
|
||||
nanoid: 3.3.4
|
||||
picocolors: 1.0.0
|
||||
source-map-js: 1.0.2
|
||||
dev: true
|
||||
|
||||
/postcss/8.4.20:
|
||||
resolution: {integrity: sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g==}
|
||||
@@ -29318,6 +29324,7 @@ packages:
|
||||
resolve: 1.22.1
|
||||
transitivePeerDependencies:
|
||||
- ts-node
|
||||
dev: true
|
||||
|
||||
/tailwindcss/3.2.1_v776zzvn44o7tpgzieipaairwm:
|
||||
resolution: {integrity: sha512-Uw+GVSxp5CM48krnjHObqoOwlCt5Qo6nw1jlCRwfGy68dSYb/LwS9ZFidYGRiM+w6rMawkZiu1mEMAsHYAfoLg==}
|
||||
@@ -29351,7 +29358,6 @@ packages:
|
||||
resolve: 1.22.1
|
||||
transitivePeerDependencies:
|
||||
- ts-node
|
||||
dev: true
|
||||
|
||||
/tailwindcss/3.2.4_postcss@8.4.20:
|
||||
resolution: {integrity: sha512-AhwtHCKMtR71JgeYDaswmZXhPcW9iuI9Sp2LvZPo9upDZ7231ZJ7eA9RaURbhpXGVlrjX4cFNlB4ieTetEb7hQ==}
|
||||
@@ -29590,6 +29596,10 @@ packages:
|
||||
setimmediate: 1.0.5
|
||||
dev: true
|
||||
|
||||
/tiny-case/1.0.3:
|
||||
resolution: {integrity: sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==}
|
||||
dev: false
|
||||
|
||||
/tiny-invariant/1.2.0:
|
||||
resolution: {integrity: sha512-1Uhn/aqw5C6RI4KejVeTg6mIS7IqxnLJ8Mv2tV5rTc0qWobay7pDUz6Wi392Cnc8ak1H0F2cjoRzb2/AW4+Fvg==}
|
||||
dev: false
|
||||
@@ -29893,7 +29903,6 @@ packages:
|
||||
make-error: 1.3.6
|
||||
v8-compile-cache-lib: 3.0.1
|
||||
yn: 3.1.1
|
||||
dev: true
|
||||
|
||||
/ts-node/10.9.1_moeqx3xmzxqxagf2sz6mqkbb7m:
|
||||
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
|
||||
@@ -30982,7 +30991,6 @@ packages:
|
||||
|
||||
/v8-compile-cache-lib/3.0.1:
|
||||
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
|
||||
dev: true
|
||||
|
||||
/v8-to-istanbul/9.0.1:
|
||||
resolution: {integrity: sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==}
|
||||
@@ -32517,7 +32525,6 @@ packages:
|
||||
/yn/3.1.1:
|
||||
resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/yocto-queue/0.1.0:
|
||||
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
||||
@@ -32532,17 +32539,13 @@ packages:
|
||||
resolution: {integrity: sha512-2PHfqGWtbXg4OfDV7VKFIb3hyEaYgTYpEORnFqgGAYqzENWmGzWMoeGvJg2Ohmq6maTRxhJzLZpNTITrqlZTrA==}
|
||||
dev: false
|
||||
|
||||
/yup/0.32.11:
|
||||
resolution: {integrity: sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==}
|
||||
engines: {node: '>=10'}
|
||||
/yup/1.0.2:
|
||||
resolution: {integrity: sha512-Lpi8nITFKjWtCoK3yQP8MUk78LJmHWqbFd0OOMXTar+yjejlQ4OIIoZgnTW1bnEUKDw6dZBcy3/IdXnt2KDUow==}
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.4
|
||||
'@types/lodash': 4.14.188
|
||||
lodash: 4.17.21
|
||||
lodash-es: 4.17.21
|
||||
nanoclone: 0.2.1
|
||||
property-expr: 2.0.5
|
||||
tiny-case: 1.0.3
|
||||
toposort: 2.0.2
|
||||
type-fest: 2.19.0
|
||||
dev: false
|
||||
|
||||
/z-schema/5.0.5:
|
||||
|
||||
Reference in New Issue
Block a user