Compare commits
11 Commits
@nhost/das
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d43bd2c3b | ||
|
|
6f324afcae | ||
|
|
c1eff3a66b | ||
|
|
c774efee40 | ||
|
|
b36aa6041d | ||
|
|
9ed9857e17 | ||
|
|
b4b057e12c | ||
|
|
5b087257e4 | ||
|
|
f1b2117c37 | ||
|
|
c1514eb098 | ||
|
|
21bddeed6a |
4
.github/workflows/ci.yaml
vendored
4
.github/workflows/ci.yaml
vendored
@@ -22,6 +22,10 @@ env:
|
||||
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_ORGANIZATION_NAME: ${{ vars.NHOST_TEST_ORGANIZATION_NAME }}
|
||||
NHOST_TEST_ORGANIZATION_SLUG: ${{ vars.NHOST_TEST_ORGANIZATION_SLUG }}
|
||||
NHOST_TEST_PERSONAL_ORG_SLUG: ${{ vars.NHOST_TEST_PERSONAL_ORG_SLUG }}
|
||||
NHOST_TEST_PROJECT_SUBDOMAIN: ${{ vars.NHOST_TEST_PROJECT_SUBDOMAIN }}
|
||||
NHOST_PRO_TEST_PROJECT_NAME: ${{ vars.NHOST_PRO_TEST_PROJECT_NAME }}
|
||||
NHOST_TEST_USER_EMAIL: ${{ secrets.NHOST_TEST_USER_EMAIL }}
|
||||
NHOST_TEST_USER_PASSWORD: ${{ secrets.NHOST_TEST_USER_PASSWORD }}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {
|
||||
PRO_TEST_PROJECT_NAME,
|
||||
PRO_TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { openProject } from '@/e2e/utils';
|
||||
import { TEST_ORGANIZATION_SLUG, TEST_PROJECT_SUBDOMAIN } from '@/e2e/env';
|
||||
import { navigateToProject } from '@/e2e/utils';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
@@ -16,17 +12,15 @@ test.beforeAll(async ({ browser }) => {
|
||||
test.beforeEach(async () => {
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
await navigateToProject({
|
||||
page,
|
||||
projectName: PRO_TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: PRO_TEST_PROJECT_SLUG,
|
||||
orgSlug: TEST_ORGANIZATION_SLUG,
|
||||
projectSubdomain: TEST_PROJECT_SUBDOMAIN,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /ai/i })
|
||||
.click();
|
||||
const AIRoute = `/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/ai/assistants`;
|
||||
await page.goto(AIRoute);
|
||||
await page.waitForURL(AIRoute);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {
|
||||
PRO_TEST_PROJECT_NAME,
|
||||
PRO_TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { openProject } from '@/e2e/utils';
|
||||
import { TEST_ORGANIZATION_SLUG, TEST_PROJECT_SUBDOMAIN } from '@/e2e/env';
|
||||
import { navigateToProject } from '@/e2e/utils';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
@@ -16,17 +12,15 @@ test.beforeAll(async ({ browser }) => {
|
||||
test.beforeEach(async () => {
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
await navigateToProject({
|
||||
page,
|
||||
projectName: PRO_TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: PRO_TEST_PROJECT_SLUG,
|
||||
orgSlug: TEST_ORGANIZATION_SLUG,
|
||||
projectSubdomain: TEST_PROJECT_SUBDOMAIN,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /ai/i })
|
||||
.click();
|
||||
const AIRoute = `/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/ai/auto-embeddings`;
|
||||
await page.goto(AIRoute);
|
||||
await page.waitForURL(AIRoute);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
|
||||
@@ -1,30 +1,12 @@
|
||||
import {
|
||||
PRO_TEST_PROJECT_NAME,
|
||||
PRO_TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { createUser, generateTestEmail, openProject } from '@/e2e/utils';
|
||||
import { TEST_ORGANIZATION_SLUG, TEST_PROJECT_SUBDOMAIN } from '@/e2e/env';
|
||||
import { createUser, generateTestEmail } from '@/e2e/utils';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import test, { expect } from '@playwright/test';
|
||||
|
||||
test('should be able to ban and unban a user', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
page,
|
||||
projectName: PRO_TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: PRO_TEST_PROJECT_SLUG,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /auth/i })
|
||||
.click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/users`,
|
||||
);
|
||||
const authUrl = `/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/users`;
|
||||
await page.goto(authUrl);
|
||||
await page.waitForURL(authUrl, { waitUntil: 'networkidle' });
|
||||
|
||||
const email = generateTestEmail();
|
||||
const password = faker.internet.password();
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {
|
||||
PRO_TEST_PROJECT_NAME,
|
||||
PRO_TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { createUser, generateTestEmail, openProject } from '@/e2e/utils';
|
||||
import { TEST_ORGANIZATION_SLUG, TEST_PROJECT_SUBDOMAIN } from '@/e2e/env';
|
||||
import { createUser, generateTestEmail } from '@/e2e/utils';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import type { Page } from '@playwright/test';
|
||||
import test, { expect } from '@playwright/test';
|
||||
@@ -15,23 +11,9 @@ test.beforeAll(async ({ browser }) => {
|
||||
});
|
||||
|
||||
test.beforeEach(async () => {
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
page,
|
||||
projectName: PRO_TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: PRO_TEST_PROJECT_SLUG,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /auth/i })
|
||||
.click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/users`,
|
||||
);
|
||||
const authUrl = `/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/users`;
|
||||
await page.goto(authUrl);
|
||||
await page.waitForURL(authUrl, { waitUntil: 'networkidle' });
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {
|
||||
PRO_TEST_PROJECT_NAME,
|
||||
PRO_TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { createUser, generateTestEmail, openProject } from '@/e2e/utils';
|
||||
import { TEST_ORGANIZATION_SLUG, TEST_PROJECT_SUBDOMAIN } from '@/e2e/env';
|
||||
import { createUser, generateTestEmail } from '@/e2e/utils';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import type { Page } from '@playwright/test';
|
||||
import test, { expect } from '@playwright/test';
|
||||
@@ -15,23 +11,9 @@ test.beforeAll(async ({ browser }) => {
|
||||
});
|
||||
|
||||
test.beforeEach(async () => {
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
page,
|
||||
projectName: PRO_TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: PRO_TEST_PROJECT_SLUG,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /auth/i })
|
||||
.click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/users`,
|
||||
);
|
||||
const authUrl = `/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/users`;
|
||||
await page.goto(authUrl);
|
||||
await page.waitForURL(authUrl, { waitUntil: 'networkidle' });
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {
|
||||
PRO_TEST_PROJECT_NAME,
|
||||
PRO_TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { createUser, generateTestEmail, openProject } from '@/e2e/utils';
|
||||
import { TEST_ORGANIZATION_SLUG, TEST_PROJECT_SUBDOMAIN } from '@/e2e/env';
|
||||
import { createUser, generateTestEmail } from '@/e2e/utils';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
@@ -15,23 +11,9 @@ test.beforeAll(async ({ browser }) => {
|
||||
});
|
||||
|
||||
test.beforeEach(async () => {
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
page,
|
||||
projectName: PRO_TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: PRO_TEST_PROJECT_SLUG,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /auth/i })
|
||||
.click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/users`,
|
||||
);
|
||||
const authUrl = `/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/users`;
|
||||
await page.goto(authUrl);
|
||||
await page.waitForURL(authUrl, { waitUntil: 'networkidle' });
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {
|
||||
PRO_TEST_PROJECT_NAME,
|
||||
PRO_TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { openProject, prepareTable } from '@/e2e/utils';
|
||||
import { TEST_ORGANIZATION_SLUG, TEST_PROJECT_SUBDOMAIN } from '@/e2e/env';
|
||||
import { navigateToProject, prepareTable } from '@/e2e/utils';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
@@ -18,17 +14,15 @@ test.beforeAll(async ({ browser }) => {
|
||||
test.beforeEach(async () => {
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
await navigateToProject({
|
||||
page,
|
||||
projectName: PRO_TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: PRO_TEST_PROJECT_SLUG,
|
||||
orgSlug: TEST_ORGANIZATION_SLUG,
|
||||
projectSubdomain: TEST_PROJECT_SUBDOMAIN,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /database/i })
|
||||
.click();
|
||||
const databaseRoute = `/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default`;
|
||||
await page.goto(databaseRoute);
|
||||
await page.waitForURL(databaseRoute);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
@@ -55,7 +49,7 @@ test('should create a simple table', async () => {
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
`/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
@@ -84,7 +78,7 @@ test('should create a table with unique constraints', async () => {
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
`/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
@@ -113,7 +107,7 @@ test('should create a table with nullable columns', async () => {
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
`/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
@@ -146,7 +140,7 @@ test('should create a table with an identity column', async () => {
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
`/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
@@ -174,7 +168,7 @@ test('should create table with foreign key constraint', async () => {
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/database/browser/default/public/${firstTableName}`,
|
||||
`/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default/public/${firstTableName}`,
|
||||
);
|
||||
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
@@ -219,7 +213,7 @@ test('should create table with foreign key constraint', async () => {
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/database/browser/default/public/${secondTableName}`,
|
||||
`/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default/public/${secondTableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
@@ -247,7 +241,7 @@ test('should not be able to create a table with a name that already exists', asy
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
`/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {
|
||||
PRO_TEST_PROJECT_NAME,
|
||||
PRO_TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { deleteTable, openProject, prepareTable } from '@/e2e/utils';
|
||||
import { TEST_ORGANIZATION_SLUG, TEST_PROJECT_SUBDOMAIN } from '@/e2e/env';
|
||||
import { deleteTable, navigateToProject, prepareTable } from '@/e2e/utils';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
@@ -18,17 +14,15 @@ test.beforeAll(async ({ browser }) => {
|
||||
test.beforeEach(async () => {
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
await navigateToProject({
|
||||
page,
|
||||
projectName: PRO_TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: PRO_TEST_PROJECT_SLUG,
|
||||
orgSlug: TEST_ORGANIZATION_SLUG,
|
||||
projectSubdomain: TEST_PROJECT_SUBDOMAIN,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /database/i })
|
||||
.click();
|
||||
const databaseRoute = `/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default`;
|
||||
await page.goto(databaseRoute);
|
||||
await page.waitForURL(databaseRoute);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
@@ -53,7 +47,7 @@ test('should delete a table', async () => {
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/database/browser/default/public/${tableName}`,
|
||||
`/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default/public/${tableName}`,
|
||||
);
|
||||
|
||||
await deleteTable({
|
||||
@@ -63,7 +57,7 @@ test('should delete a table', async () => {
|
||||
|
||||
// navigate to next URL
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/database/browser/default/public/**`,
|
||||
`/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default/public/**`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
@@ -91,7 +85,7 @@ test('should not be able to delete a table if other tables have foreign keys ref
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/database/browser/default/public/${firstTableName}`,
|
||||
`/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default/public/${firstTableName}`,
|
||||
);
|
||||
|
||||
await page.getByRole('button', { name: /new table/i }).click();
|
||||
@@ -138,7 +132,7 @@ test('should not be able to delete a table if other tables have foreign keys ref
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await page.waitForURL(
|
||||
`/${TEST_WORKSPACE_SLUG}/${PRO_TEST_PROJECT_SLUG}/database/browser/default/public/${secondTableName}`,
|
||||
`/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/database/browser/default/public/${secondTableName}`,
|
||||
);
|
||||
|
||||
await expect(
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import slugify from 'slugify';
|
||||
|
||||
/**
|
||||
* URL of the dashboard to test against.
|
||||
*/
|
||||
@@ -8,15 +6,12 @@ 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;
|
||||
export const TEST_ORGANIZATION_NAME = process.env.NHOST_TEST_ORGANIZATION_NAME;
|
||||
|
||||
/**
|
||||
* Slugified name of the workspace to test against.
|
||||
* Slug of the organization to test against.
|
||||
*/
|
||||
export const TEST_WORKSPACE_SLUG = slugify(TEST_WORKSPACE_NAME, {
|
||||
lower: true,
|
||||
strict: true,
|
||||
});
|
||||
export const TEST_ORGANIZATION_SLUG = process.env.NHOST_TEST_ORGANIZATION_SLUG;
|
||||
|
||||
/**
|
||||
* Name of the project to test against.
|
||||
@@ -24,25 +19,9 @@ export const TEST_WORKSPACE_SLUG = slugify(TEST_WORKSPACE_NAME, {
|
||||
export const TEST_PROJECT_NAME = process.env.NHOST_TEST_PROJECT_NAME;
|
||||
|
||||
/**
|
||||
* Name of the pro test project to test against.
|
||||
* Subdomain of the project to test against.
|
||||
*/
|
||||
export const PRO_TEST_PROJECT_NAME = process.env.NHOST_PRO_TEST_PROJECT_NAME;
|
||||
|
||||
/**
|
||||
* Slugified name of the project to test against.
|
||||
*/
|
||||
export const TEST_PROJECT_SLUG = slugify(TEST_PROJECT_NAME, {
|
||||
lower: true,
|
||||
strict: true,
|
||||
});
|
||||
|
||||
/**
|
||||
* Slugified name of the pro project to test against.
|
||||
*/
|
||||
export const PRO_TEST_PROJECT_SLUG = slugify(PRO_TEST_PROJECT_NAME, {
|
||||
lower: true,
|
||||
strict: true,
|
||||
});
|
||||
export const TEST_PROJECT_SUBDOMAIN = process.env.NHOST_TEST_PROJECT_SUBDOMAIN;
|
||||
|
||||
/**
|
||||
* Hasura admin secret of the test project to use.
|
||||
@@ -59,3 +38,5 @@ 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;
|
||||
|
||||
export const TEST_PERSONAL_ORG_SLUG = process.env.NHOST_TEST_PERSONAL_ORG_SLUG;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import {
|
||||
TEST_PROJECT_NAME,
|
||||
TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_NAME,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { openProject } from '@/e2e/utils';
|
||||
import { TEST_ORGANIZATION_SLUG, TEST_PROJECT_SUBDOMAIN } from '@/e2e/env';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { navigateToProject } from '../utils';
|
||||
|
||||
let page: Page;
|
||||
|
||||
@@ -14,11 +9,11 @@ test.beforeAll(async ({ browser }) => {
|
||||
page = await browser.newPage();
|
||||
|
||||
await page.goto('/');
|
||||
await openProject({
|
||||
|
||||
await navigateToProject({
|
||||
page,
|
||||
projectName: TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: TEST_PROJECT_SLUG,
|
||||
orgSlug: TEST_ORGANIZATION_SLUG,
|
||||
projectSubdomain: TEST_PROJECT_SUBDOMAIN,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,60 +21,34 @@ test.afterAll(async () => {
|
||||
await page.close();
|
||||
});
|
||||
|
||||
test('should show a sidebar with menu items', async () => {
|
||||
const navLocator = page.getByRole('navigation', { name: /main navigation/i });
|
||||
test('should show the navtree with all links visible', async () => {
|
||||
const navLocator = page.getByLabel('Navigation Tree');
|
||||
await expect(navLocator).toBeVisible();
|
||||
await expect(navLocator.getByRole('list').getByRole('listitem')).toHaveCount(
|
||||
13,
|
||||
);
|
||||
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: /metrics/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();
|
||||
const links = [
|
||||
'Nhost Automation Test Project',
|
||||
'Overview',
|
||||
'Database',
|
||||
'GraphQL',
|
||||
'Hasura',
|
||||
'Auth',
|
||||
'Storage',
|
||||
'Run',
|
||||
'AI',
|
||||
'Deployments',
|
||||
'Backups',
|
||||
'Logs',
|
||||
'Metrics',
|
||||
'Settings',
|
||||
];
|
||||
|
||||
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(/starter/i)).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: /upgrade/i })).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole('main').getByRole('link', { name: /settings/i }),
|
||||
).toBeVisible();
|
||||
for (const linkName of links) {
|
||||
const link =
|
||||
linkName === 'Settings'
|
||||
? page.getByRole('link', { name: linkName }).first()
|
||||
: page.getByRole('link', { name: linkName });
|
||||
await expect(link).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test("should show the project's region and subdomain", async () => {
|
||||
@@ -96,27 +65,3 @@ test('should not have a GitHub repository connected', async () => {
|
||||
page.getByRole('button', { name: /connect to github/i }).first(),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('should show metrics', async () => {
|
||||
await expect(page.getByText(/cpu usage seconds\d+/i)).toBeVisible();
|
||||
await expect(page.getByText(/total requests\d+/i)).toBeVisible();
|
||||
await expect(page.getByText(/function invocations\d+/i)).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(/egress volume\d+(\.\d+)? [a-zA-Z]+/i),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText(/logs\d+(\.\d+)? [a-zA-Z]+/i)).toBeVisible();
|
||||
});
|
||||
|
||||
test('should show proper limits for the free project', async () => {
|
||||
await expect(
|
||||
page.getByText(/database\d+(\.\d+)? [a-zA-Z]+ of \d+(\.\d+)? [a-zA-Z]+/i),
|
||||
).toBeVisible();
|
||||
|
||||
await expect(
|
||||
page.getByText(/storage\d+(\.\d+)? [a-zA-Z]+ of \d+(\.\d+)? [a-zA-Z]+/i),
|
||||
).toBeVisible();
|
||||
|
||||
await expect(page.getByText(/users[0-9]+ of [0-9]+/i)).toBeVisible();
|
||||
|
||||
await expect(page.getByText(/functions[0-9]+ of [0-9]+/i)).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import {
|
||||
PRO_TEST_PROJECT_NAME,
|
||||
PRO_TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
} from '@/e2e/env';
|
||||
import { openProject } from '@/e2e/utils';
|
||||
import { TEST_ORGANIZATION_SLUG, TEST_PROJECT_SUBDOMAIN } from '@/e2e/env';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { navigateToProject } from '../utils';
|
||||
|
||||
let page: Page;
|
||||
|
||||
@@ -16,17 +12,15 @@ test.beforeAll(async ({ browser }) => {
|
||||
test.beforeEach(async () => {
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
await navigateToProject({
|
||||
page,
|
||||
projectName: PRO_TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: PRO_TEST_PROJECT_SLUG,
|
||||
orgSlug: TEST_ORGANIZATION_SLUG,
|
||||
projectSubdomain: TEST_PROJECT_SUBDOMAIN,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('navigation', { name: /main navigation/i })
|
||||
.getByRole('link', { name: /run/i })
|
||||
.click();
|
||||
const runRoute = `/orgs/${TEST_ORGANIZATION_SLUG}/projects/${TEST_PROJECT_SUBDOMAIN}/run`;
|
||||
await page.goto(runRoute);
|
||||
await page.waitForURL(runRoute);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
@@ -39,6 +33,10 @@ test('should create and delete a run service', async () => {
|
||||
await page.getByPlaceholder(/service name/i).click();
|
||||
await page.getByPlaceholder(/service name/i).fill('test');
|
||||
|
||||
await page.getByText('Nhost registry').click();
|
||||
await page.getByPlaceholder('Replicas').click();
|
||||
await page.getByPlaceholder('Replicas').fill('0');
|
||||
|
||||
await page.getByRole('button', { name: /create/i }).click();
|
||||
|
||||
await expect(
|
||||
@@ -47,12 +45,6 @@ test('should create and delete a run service', async () => {
|
||||
|
||||
await page.getByRole('button', { name: /confirm/i }).click();
|
||||
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /service details/i }),
|
||||
).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: /ok/i }).click();
|
||||
|
||||
await expect(page.getByRole('heading', { name: /test/i })).toBeVisible();
|
||||
|
||||
await page.getByLabel(/more options/i).click();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
TEST_DASHBOARD_URL,
|
||||
TEST_PERSONAL_ORG_SLUG,
|
||||
TEST_USER_EMAIL,
|
||||
TEST_USER_PASSWORD,
|
||||
} from '@/e2e/env';
|
||||
@@ -15,6 +16,9 @@ setup('authenticate user', async ({ page }) => {
|
||||
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.waitForURL(
|
||||
`${TEST_DASHBOARD_URL}/orgs/${TEST_PERSONAL_ORG_SLUG}/projects`,
|
||||
{ waitUntil: 'networkidle' },
|
||||
);
|
||||
await page.context().storageState({ path: 'e2e/.auth/user.json' });
|
||||
});
|
||||
|
||||
@@ -5,24 +5,27 @@ import type { Page } from '@playwright/test';
|
||||
* Open a project by navigating to the project's overview page.
|
||||
*
|
||||
* @param page - The Playwright page object.
|
||||
* @param workspaceSlug - The slug of the workspace that contains the project.
|
||||
* @param projectSlug - The slug of the project to open.
|
||||
* @param projectName - The name of the project to open.
|
||||
* @param orgSlug - The slug of the organization that contains the project.
|
||||
* @param projectSubdomain - The subdomain of the project to open.
|
||||
* @returns A promise that resolves when the project is opened.
|
||||
*/
|
||||
export async function openProject({
|
||||
export async function navigateToProject({
|
||||
page,
|
||||
projectName,
|
||||
workspaceSlug,
|
||||
projectSlug,
|
||||
orgSlug,
|
||||
projectSubdomain,
|
||||
}: {
|
||||
page: Page;
|
||||
workspaceSlug: string;
|
||||
projectSlug: string;
|
||||
projectName: string;
|
||||
orgSlug: string;
|
||||
projectSubdomain: string;
|
||||
}) {
|
||||
await page.getByRole('link', { name: projectName }).click();
|
||||
await page.waitForURL(`/${workspaceSlug}/${projectSlug}`);
|
||||
const projectUrl = `/orgs/${orgSlug}/projects/${projectSubdomain}`;
|
||||
|
||||
try {
|
||||
await page.goto(projectUrl, { waitUntil: 'networkidle' });
|
||||
await page.waitForURL(projectUrl, { timeout: 10000 });
|
||||
} catch (error) {
|
||||
console.error(`Failed to navigate to project URL: ${projectUrl}`, error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import {
|
||||
TEST_DASHBOARD_URL,
|
||||
TEST_ORGANIZATION_SLUG,
|
||||
TEST_PROJECT_ADMIN_SECRET,
|
||||
TEST_PROJECT_NAME,
|
||||
TEST_PROJECT_SLUG,
|
||||
TEST_WORKSPACE_SLUG,
|
||||
TEST_PROJECT_SUBDOMAIN,
|
||||
} from '@/e2e/env';
|
||||
import { openProject } from '@/e2e/utils';
|
||||
import { navigateToProject } from '@/e2e/utils';
|
||||
import { chromium } from '@playwright/test';
|
||||
|
||||
async function globalTeardown() {
|
||||
@@ -18,13 +17,10 @@ async function globalTeardown() {
|
||||
|
||||
const page = await context.newPage();
|
||||
|
||||
await page.goto('/');
|
||||
|
||||
await openProject({
|
||||
await navigateToProject({
|
||||
page,
|
||||
projectName: TEST_PROJECT_NAME,
|
||||
workspaceSlug: TEST_WORKSPACE_SLUG,
|
||||
projectSlug: TEST_PROJECT_SLUG,
|
||||
orgSlug: TEST_ORGANIZATION_SLUG,
|
||||
projectSubdomain: TEST_PROJECT_SUBDOMAIN,
|
||||
});
|
||||
|
||||
const pagePromise = context.waitForEvent('page');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/dashboard",
|
||||
"version": "2.2.1",
|
||||
"version": "2.4.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
@@ -128,7 +128,7 @@
|
||||
"@graphql-codegen/typescript-operations": "^3.0.4",
|
||||
"@graphql-codegen/typescript-react-apollo": "^3.3.7",
|
||||
"@next/bundle-analyzer": "^12.3.4",
|
||||
"@playwright/test": "1.41.0",
|
||||
"@playwright/test": "1.47.0",
|
||||
"@storybook/addon-actions": "^6.5.16",
|
||||
"@storybook/addon-essentials": "^6.5.16",
|
||||
"@storybook/addon-interactions": "^6.5.16",
|
||||
|
||||
@@ -6,7 +6,7 @@ dotenv.config({ path: path.resolve(__dirname, '.env.test') });
|
||||
|
||||
export default defineConfig({
|
||||
testDir: './e2e',
|
||||
timeout: 30 * 1000,
|
||||
timeout: 40 * 1000,
|
||||
expect: {
|
||||
timeout: 5000,
|
||||
},
|
||||
@@ -20,6 +20,9 @@ export default defineConfig({
|
||||
actionTimeout: 0,
|
||||
trace: 'on-first-retry',
|
||||
baseURL: process.env.NHOST_TEST_DASHBOARD_URL,
|
||||
launchOptions: {
|
||||
slowMo: 500,
|
||||
},
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
|
||||
@@ -105,7 +105,7 @@ export default function OrgsComboBox() {
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
className="w-full justify-between gap-2 bg-background text-foreground hover:bg-accent dark:hover:bg-muted"
|
||||
className="justify-between w-full gap-2 bg-background text-foreground hover:bg-accent dark:hover:bg-muted"
|
||||
>
|
||||
{selectedItem ? (
|
||||
<div className="flex flex-row items-center justify-center">
|
||||
@@ -115,7 +115,7 @@ export default function OrgsComboBox() {
|
||||
) : (
|
||||
'Select organization / workspace'
|
||||
)}
|
||||
<ChevronsUpDown className="h-5 w-5 text-muted-foreground" />
|
||||
<ChevronsUpDown className="w-5 h-5 text-muted-foreground" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="p-0" side="bottom" align="start">
|
||||
@@ -129,7 +129,7 @@ export default function OrgsComboBox() {
|
||||
keywords={[option.label]}
|
||||
key={option.value}
|
||||
value={option.value}
|
||||
className="flex items-center justify-between bg-background text-foreground dark:hover:bg-muted"
|
||||
className="flex items-center text-foreground dark:hover:bg-muted"
|
||||
onSelect={() => {
|
||||
setSelectedItem(option);
|
||||
setOpen(false);
|
||||
@@ -144,17 +144,15 @@ export default function OrgsComboBox() {
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center font-normal">
|
||||
<Check
|
||||
className={cn(
|
||||
'mr-2 h-4 w-4',
|
||||
selectedItem?.value === option.value
|
||||
? 'opacity-100'
|
||||
: 'opacity-0',
|
||||
)}
|
||||
/>
|
||||
<span className="max-w-52 truncate">{option.label}</span>
|
||||
</div>
|
||||
<Check
|
||||
className={cn(
|
||||
'mr-2 h-4 w-4',
|
||||
selectedItem?.value === option.value
|
||||
? 'opacity-100'
|
||||
: 'opacity-0',
|
||||
)}
|
||||
/>
|
||||
<span className="w-full truncate">{option.label}</span>
|
||||
{renderBadge(option.plan)}
|
||||
</CommandItem>
|
||||
))}
|
||||
@@ -170,7 +168,7 @@ export default function OrgsComboBox() {
|
||||
keywords={[option.label]}
|
||||
key={option.value}
|
||||
value={option.value}
|
||||
className="flex items-center justify-between bg-background text-foreground hover:bg-accent dark:hover:bg-muted"
|
||||
className="flex items-center text-foreground dark:hover:bg-muted"
|
||||
onSelect={() => {
|
||||
setSelectedItem(option);
|
||||
setOpen(false);
|
||||
@@ -185,19 +183,15 @@ export default function OrgsComboBox() {
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<Check
|
||||
className={cn(
|
||||
'mr-2 h-4 w-4',
|
||||
selectedItem?.value === option.value
|
||||
? 'opacity-100'
|
||||
: 'opacity-0',
|
||||
)}
|
||||
/>
|
||||
<span className="max-w-52 truncate">
|
||||
{option.label}
|
||||
</span>
|
||||
</div>
|
||||
<Check
|
||||
className={cn(
|
||||
'mr-2 h-4 w-4',
|
||||
selectedItem?.value === option.value
|
||||
? 'opacity-100'
|
||||
: 'opacity-0',
|
||||
)}
|
||||
/>
|
||||
<span className="w-full truncate">{option.label}</span>
|
||||
{renderBadge(option.plan)}
|
||||
</CommandItem>
|
||||
))}
|
||||
|
||||
@@ -68,6 +68,7 @@ const projectSettingsPages = [
|
||||
route: 'rate-limiting',
|
||||
},
|
||||
{ name: 'AI', slug: 'ai', route: 'ai' },
|
||||
{ name: 'Observability', slug: 'metrics', route: 'metrics' },
|
||||
{ name: 'Configuration Editor', slug: 'editor', route: 'editor' },
|
||||
].map((item) => ({
|
||||
label: item.name,
|
||||
|
||||
@@ -151,6 +151,7 @@ const projectSettingsPages = [
|
||||
route: 'rate-limiting',
|
||||
},
|
||||
{ name: 'AI', slug: 'ai', route: 'ai' },
|
||||
{ name: 'Observability', slug: 'metrics', route: 'metrics' },
|
||||
{ name: 'Configuration Editor', slug: 'editor', route: 'editor' },
|
||||
];
|
||||
|
||||
|
||||
@@ -17,18 +17,18 @@ export default function SettingsLayout({ children }: SettingsLayoutProps) {
|
||||
return (
|
||||
<Box
|
||||
sx={{ backgroundColor: 'background.default' }}
|
||||
className="flex w-full flex-auto flex-col overflow-y-auto overflow-x-hidden"
|
||||
className="flex flex-col flex-auto w-full overflow-x-hidden overflow-y-auto"
|
||||
>
|
||||
<Box
|
||||
sx={{ backgroundColor: 'background.default' }}
|
||||
className="flex h-full flex-col"
|
||||
className="flex flex-col h-full"
|
||||
>
|
||||
<RetryableErrorBoundary>
|
||||
<div className="flex flex-col space-y-2">
|
||||
{hasGitRepo && (
|
||||
<Alert
|
||||
severity="warning"
|
||||
className="grid grid-flow-row place-content-center gap-2"
|
||||
className="grid grid-flow-row gap-2 place-content-center"
|
||||
>
|
||||
<Text color="warning" className="text-sm">
|
||||
As you have a connected repository, make sure to synchronize
|
||||
@@ -52,9 +52,9 @@ export default function SettingsLayout({ children }: SettingsLayoutProps) {
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="underline"
|
||||
href="https://docs.nhost.io/cli/overlays"
|
||||
href="https://docs.nhost.io/guides/cli/configuration-overlays#configuration-overlays"
|
||||
>
|
||||
docs.nhost.io/cli/overlays
|
||||
Configuration Overlays
|
||||
</a>{' '}
|
||||
for guidance.
|
||||
</Text>
|
||||
|
||||
@@ -9,7 +9,6 @@ import { useIsPlatform } from '@/features/projects/common/hooks/useIsPlatform';
|
||||
import { useLocalMimirClient } from '@/hooks/useLocalMimirClient';
|
||||
import { execPromiseWithErrorToast } from '@/utils/execPromiseWithErrorToast';
|
||||
import {
|
||||
GetAuthenticationSettingsDocument,
|
||||
useGetAuthenticationSettingsQuery,
|
||||
useUpdateConfigMutation,
|
||||
} from '@/utils/__generated__/graphql';
|
||||
@@ -30,7 +29,6 @@ export default function DisableNewUsersSettings() {
|
||||
const localMimirClient = useLocalMimirClient();
|
||||
const { currentProject } = useCurrentWorkspaceAndProject();
|
||||
const [updateConfig] = useUpdateConfigMutation({
|
||||
refetchQueries: [GetAuthenticationSettingsDocument],
|
||||
...(!isPlatform ? { client: localMimirClient } : {}),
|
||||
});
|
||||
|
||||
@@ -42,14 +40,14 @@ export default function DisableNewUsersSettings() {
|
||||
const form = useForm<DisableNewUsersFormValues>({
|
||||
reValidateMode: 'onSubmit',
|
||||
defaultValues: {
|
||||
disabled: !data?.config?.auth?.signUp?.enabled,
|
||||
disabled: data?.config?.auth?.signUp?.disableNewUsers,
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!loading) {
|
||||
form.reset({
|
||||
disabled: !data?.config?.auth?.signUp?.enabled,
|
||||
disabled: data?.config?.auth?.signUp?.disableNewUsers,
|
||||
});
|
||||
}
|
||||
}, [loading, data, form]);
|
||||
@@ -58,7 +56,7 @@ export default function DisableNewUsersSettings() {
|
||||
return (
|
||||
<ActivityIndicator
|
||||
delay={1000}
|
||||
label="Loading disabled sign up settings..."
|
||||
label="Loading disabled new users settings..."
|
||||
className="justify-center"
|
||||
/>
|
||||
);
|
||||
@@ -79,7 +77,7 @@ export default function DisableNewUsersSettings() {
|
||||
config: {
|
||||
auth: {
|
||||
signUp: {
|
||||
enabled: !values.disabled,
|
||||
disableNewUsers: values.disabled,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -104,10 +102,10 @@ export default function DisableNewUsersSettings() {
|
||||
}
|
||||
},
|
||||
{
|
||||
loadingMessage: 'Disabling new user sign ups...',
|
||||
successMessage: 'New user sign ups have been disabled successfully.',
|
||||
loadingMessage: 'Disabling new users sign ins...',
|
||||
successMessage: 'New users sign ins have been disabled successfully.',
|
||||
errorMessage:
|
||||
'An error occurred while trying to disable new user sign ups.',
|
||||
'An error occurred while trying to disable new users sign ins.',
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
@@ -15,6 +15,7 @@ query GetAuthenticationSettings($appId: uuid!) {
|
||||
}
|
||||
signUp {
|
||||
enabled
|
||||
disableNewUsers
|
||||
}
|
||||
session {
|
||||
accessToken {
|
||||
|
||||
@@ -52,9 +52,9 @@ export default function SettingsLayout({ children }: SettingsLayoutProps) {
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="underline"
|
||||
href="https://docs.nhost.io/cli/overlays"
|
||||
href="https://docs.nhost.io/guides/cli/configuration-overlays#configuration-overlays"
|
||||
>
|
||||
docs.nhost.io/cli/overlays
|
||||
Configuration Overlays
|
||||
</a>{' '}
|
||||
for guidance.
|
||||
</Text>
|
||||
|
||||
@@ -42,14 +42,14 @@ export default function DisableNewUsersSettings() {
|
||||
const form = useForm<DisableNewUsersFormValues>({
|
||||
reValidateMode: 'onSubmit',
|
||||
defaultValues: {
|
||||
disabled: !data?.config?.auth?.signUp?.enabled,
|
||||
disabled: data?.config?.auth?.signUp?.disableNewUsers,
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!loading) {
|
||||
form.reset({
|
||||
disabled: !data?.config?.auth?.signUp?.enabled,
|
||||
disabled: data?.config?.auth?.signUp?.disableNewUsers,
|
||||
});
|
||||
}
|
||||
}, [loading, data, form]);
|
||||
@@ -58,7 +58,7 @@ export default function DisableNewUsersSettings() {
|
||||
return (
|
||||
<ActivityIndicator
|
||||
delay={1000}
|
||||
label="Loading disabled sign up settings..."
|
||||
label="Loading disabled new users settings..."
|
||||
className="justify-center"
|
||||
/>
|
||||
);
|
||||
@@ -79,7 +79,7 @@ export default function DisableNewUsersSettings() {
|
||||
config: {
|
||||
auth: {
|
||||
signUp: {
|
||||
enabled: !values.disabled,
|
||||
disableNewUsers: values.disabled,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -104,10 +104,10 @@ export default function DisableNewUsersSettings() {
|
||||
}
|
||||
},
|
||||
{
|
||||
loadingMessage: 'Disabling new user sign ups...',
|
||||
successMessage: 'New user sign ups have been disabled successfully.',
|
||||
loadingMessage: 'Disabling new users sign ins...',
|
||||
successMessage: 'New users sign ins have been disabled successfully.',
|
||||
errorMessage:
|
||||
'An error occurred while trying to disable new user sign ups.',
|
||||
'An error occurred while trying to disable new users sign ins.',
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
import { ApplyLocalSettingsDialog } from '@/components/common/ApplyLocalSettingsDialog';
|
||||
import { useDialog } from '@/components/common/DialogProvider';
|
||||
import { useUI } from '@/components/common/UIProvider';
|
||||
import { Form } from '@/components/form/Form';
|
||||
import { SettingsContainer } from '@/components/layout/SettingsContainer';
|
||||
import { ActivityIndicator } from '@/components/ui/v2/ActivityIndicator';
|
||||
import {
|
||||
useGetAuthenticationSettingsQuery,
|
||||
useUpdateConfigMutation,
|
||||
} from '@/utils/__generated__/graphql';
|
||||
import { useEffect } from 'react';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
import * as Yup from 'yup';
|
||||
|
||||
import { useIsPlatform } from '@/features/orgs/projects/common/hooks/useIsPlatform';
|
||||
import { useLocalMimirClient } from '@/features/orgs/projects/hooks/useLocalMimirClient';
|
||||
import { useProject } from '@/features/orgs/projects/hooks/useProject';
|
||||
import { execPromiseWithErrorToast } from '@/features/orgs/utils/execPromiseWithErrorToast';
|
||||
|
||||
const validationSchema = Yup.object({
|
||||
disabled: Yup.boolean(),
|
||||
});
|
||||
|
||||
export type DisableSignUpsFormValues = Yup.InferType<typeof validationSchema>;
|
||||
|
||||
export default function DisableSignUpsSettings() {
|
||||
const { openDialog } = useDialog();
|
||||
const isPlatform = useIsPlatform();
|
||||
const { maintenanceActive } = useUI();
|
||||
const localMimirClient = useLocalMimirClient();
|
||||
const { project } = useProject();
|
||||
const [updateConfig] = useUpdateConfigMutation({
|
||||
...(!isPlatform ? { client: localMimirClient } : {}),
|
||||
});
|
||||
|
||||
const { data, loading, error } = useGetAuthenticationSettingsQuery({
|
||||
variables: { appId: project?.id },
|
||||
...(!isPlatform ? { client: localMimirClient } : {}),
|
||||
});
|
||||
|
||||
const form = useForm<DisableSignUpsFormValues>({
|
||||
reValidateMode: 'onSubmit',
|
||||
defaultValues: {
|
||||
disabled: !data?.config?.auth?.signUp?.enabled,
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!loading) {
|
||||
form.reset({
|
||||
disabled: !data?.config?.auth?.signUp?.enabled,
|
||||
});
|
||||
}
|
||||
}, [loading, data, form]);
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<ActivityIndicator
|
||||
delay={1000}
|
||||
label="Loading disabled sign up settings..."
|
||||
className="justify-center"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const { formState } = form;
|
||||
|
||||
const handleDisableSignUpsChange = async (
|
||||
values: DisableSignUpsFormValues,
|
||||
) => {
|
||||
const updateConfigPromise = updateConfig({
|
||||
variables: {
|
||||
appId: project.id,
|
||||
config: {
|
||||
auth: {
|
||||
signUp: {
|
||||
enabled: !values.disabled,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await execPromiseWithErrorToast(
|
||||
async () => {
|
||||
await updateConfigPromise;
|
||||
form.reset(values);
|
||||
|
||||
if (!isPlatform) {
|
||||
openDialog({
|
||||
title: 'Apply your changes',
|
||||
component: <ApplyLocalSettingsDialog />,
|
||||
props: {
|
||||
PaperProps: {
|
||||
className: 'max-w-2xl',
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
loadingMessage: 'Disabling new users sign ups...',
|
||||
successMessage: 'New users sign ups have been disabled successfully.',
|
||||
errorMessage:
|
||||
'An error occurred while trying to disable new users sign ups.',
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
<Form onSubmit={handleDisableSignUpsChange}>
|
||||
<SettingsContainer
|
||||
title="Disable Sign Ups"
|
||||
description="If set, new users won't be able to sign up."
|
||||
docsLink="https://docs.nhost.io/guides/auth/overview#disable-sign-ups"
|
||||
switchId="disabled"
|
||||
showSwitch
|
||||
slotProps={{
|
||||
submitButton: {
|
||||
disabled: !formState.isDirty || maintenanceActive,
|
||||
loading: formState.isSubmitting,
|
||||
},
|
||||
}}
|
||||
className="hidden"
|
||||
/>
|
||||
</Form>
|
||||
</FormProvider>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { default as DisableSignUpsSettings } from './DisableSignUpsSettings';
|
||||
@@ -15,6 +15,7 @@ query GetAuthenticationSettings($appId: uuid!) {
|
||||
}
|
||||
signUp {
|
||||
enabled
|
||||
disableNewUsers
|
||||
}
|
||||
session {
|
||||
accessToken {
|
||||
|
||||
@@ -159,9 +159,6 @@ export default function TOMLEditor() {
|
||||
height="100%"
|
||||
width="100%"
|
||||
theme={theme.palette.mode === 'light' ? bbedit : githubDark}
|
||||
basicSetup={{
|
||||
searchKeymap: false,
|
||||
}}
|
||||
extensions={[StreamLanguage.define(toml)]}
|
||||
onChange={onChange}
|
||||
/>
|
||||
|
||||
@@ -11,12 +11,12 @@ import { Text } from '@/components/ui/v2/Text';
|
||||
import type {
|
||||
ColumnType,
|
||||
DatabaseColumn,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import {
|
||||
identityTypes,
|
||||
postgresFunctions,
|
||||
postgresTypeGroups,
|
||||
} from '@/features/database/dataGrid/utils/postgresqlConstants';
|
||||
} from '@/features/orgs/projects/database/dataGrid/utils/postgresqlConstants';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import clsx from 'clsx';
|
||||
import { useEffect, useState } from 'react';
|
||||
@@ -102,7 +102,7 @@ export default function BaseColumnForm({
|
||||
return (
|
||||
<Form
|
||||
onSubmit={handleExternalSubmit}
|
||||
className="flex flex-col content-between flex-auto overflow-hidden border-t-1"
|
||||
className="flex flex-auto flex-col content-between overflow-hidden border-t-1"
|
||||
>
|
||||
<div className="flex-auto overflow-y-auto">
|
||||
<section className="grid grid-cols-8 px-6 py-3">
|
||||
@@ -184,7 +184,7 @@ export default function BaseColumnForm({
|
||||
</Text>
|
||||
</span>
|
||||
}
|
||||
className="w-full col-span-8 py-3 m-0 sm:col-span-6 sm:col-start-3 sm:ml-1"
|
||||
className="col-span-8 m-0 w-full py-3 sm:col-span-6 sm:col-start-3 sm:ml-1"
|
||||
onChange={(_event, checked) => {
|
||||
if (checked) {
|
||||
setDefaultValueInputText('');
|
||||
@@ -197,7 +197,7 @@ export default function BaseColumnForm({
|
||||
|
||||
<Box
|
||||
component="section"
|
||||
className="grid grid-cols-8 px-6 py-3 border-t-1"
|
||||
className="grid grid-cols-8 border-t-1 px-6 py-3"
|
||||
>
|
||||
<ControlledAutocomplete
|
||||
id="defaultValue"
|
||||
@@ -249,7 +249,7 @@ export default function BaseColumnForm({
|
||||
/>
|
||||
|
||||
<ControlledCheckbox
|
||||
className="w-full col-span-8 py-3 m-0 sm:col-span-6 sm:col-start-3 sm:ml-1"
|
||||
className="col-span-8 m-0 w-full py-3 sm:col-span-6 sm:col-start-3 sm:ml-1"
|
||||
name="isNullable"
|
||||
label={
|
||||
<span className="inline-grid grid-flow-row">
|
||||
@@ -269,7 +269,7 @@ export default function BaseColumnForm({
|
||||
/>
|
||||
|
||||
<ControlledCheckbox
|
||||
className="w-full col-span-8 py-3 m-0 sm:col-span-6 sm:col-start-3 sm:ml-1"
|
||||
className="col-span-8 m-0 w-full py-3 sm:col-span-6 sm:col-start-3 sm:ml-1"
|
||||
name="isUnique"
|
||||
label={
|
||||
<span className="inline-grid grid-flow-row">
|
||||
@@ -306,7 +306,7 @@ export default function BaseColumnForm({
|
||||
</Box>
|
||||
</div>
|
||||
|
||||
<Box className="grid justify-between flex-shrink-0 grid-flow-col gap-3 p-2 border-t-1">
|
||||
<Box className="grid flex-shrink-0 grid-flow-col justify-between gap-3 border-t-1 p-2">
|
||||
<Button
|
||||
variant="borderless"
|
||||
color="secondary"
|
||||
|
||||
@@ -5,9 +5,9 @@ import { ArrowRightIcon } from '@/components/ui/v2/icons/ArrowRightIcon';
|
||||
import { LinkIcon } from '@/components/ui/v2/icons/LinkIcon';
|
||||
import { InputLabel } from '@/components/ui/v2/InputLabel';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import { CreateForeignKeyForm } from '@/features/database/dataGrid/components/CreateForeignKeyForm';
|
||||
import { EditForeignKeyForm } from '@/features/database/dataGrid/components/EditForeignKeyForm';
|
||||
import type { DatabaseColumn } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { CreateForeignKeyForm } from '@/features/orgs/projects/database/dataGrid/components/CreateForeignKeyForm';
|
||||
import { EditForeignKeyForm } from '@/features/orgs/projects/database/dataGrid/components/EditForeignKeyForm';
|
||||
import type { DatabaseColumn } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import type { ForwardedRef } from 'react';
|
||||
import { forwardRef, useRef } from 'react';
|
||||
import { useFormContext, useWatch } from 'react-hook-form';
|
||||
@@ -106,7 +106,7 @@ const ForeignKeyEditorInput = forwardRef(
|
||||
});
|
||||
}}
|
||||
variant="borderless"
|
||||
className="min-w-[initial] py-1 px-2"
|
||||
className="min-w-[initial] px-2 py-1"
|
||||
>
|
||||
Edit
|
||||
</Button>
|
||||
@@ -114,7 +114,7 @@ const ForeignKeyEditorInput = forwardRef(
|
||||
<Button
|
||||
onClick={() => setValue('foreignKeyRelation', null)}
|
||||
variant="borderless"
|
||||
className="min-w-[initial] py-1 px-2"
|
||||
className="min-w-[initial] px-2 py-1"
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
|
||||
@@ -6,11 +6,11 @@ import { Button } from '@/components/ui/v2/Button';
|
||||
import { Divider } from '@/components/ui/v2/Divider';
|
||||
import { Option } from '@/components/ui/v2/Option';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import { useDatabaseQuery } from '@/features/database/dataGrid/hooks/useDatabaseQuery';
|
||||
import { useDatabaseQuery } from '@/features/orgs/projects/database/dataGrid/hooks/useDatabaseQuery';
|
||||
import type {
|
||||
DatabaseColumn,
|
||||
ForeignKeyRelation,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useEffect } from 'react';
|
||||
@@ -107,9 +107,9 @@ export default function BaseForeignKeyForm({
|
||||
selectedColumn?.isPrimary || selectedColumn?.isUnique || false,
|
||||
});
|
||||
}}
|
||||
className="flex flex-col content-between flex-auto pb-4 overflow-hidden"
|
||||
className="flex flex-auto flex-col content-between overflow-hidden pb-4"
|
||||
>
|
||||
<Box className="grid flex-auto grid-flow-row gap-4 py-4 overflow-y-auto border-t-1">
|
||||
<Box className="grid flex-auto grid-flow-row gap-4 overflow-y-auto border-t-1 py-4">
|
||||
<Box component="section" className="grid grid-flow-row gap-4 px-6">
|
||||
<Text variant="h3">From</Text>
|
||||
|
||||
@@ -185,7 +185,7 @@ export default function BaseForeignKeyForm({
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<Box className="grid flex-shrink-0 grid-flow-row gap-2 px-6 pt-4 border-t-1">
|
||||
<Box className="grid flex-shrink-0 grid-flow-row gap-2 border-t-1 px-6 pt-4">
|
||||
<Button loading={isSubmitting} disabled={isSubmitting} type="submit">
|
||||
{submitButtonText}
|
||||
</Button>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ControlledSelect } from '@/components/form/ControlledSelect';
|
||||
import { Option } from '@/components/ui/v2/Option';
|
||||
import { useTableQuery } from '@/features/database/dataGrid/hooks/useTableQuery';
|
||||
import { useTableQuery } from '@/features/orgs/projects/database/dataGrid/hooks/useTableQuery';
|
||||
import { useFormState, useWatch } from 'react-hook-form';
|
||||
|
||||
export default function ReferencedColumnSelect() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ControlledSelectProps } from '@/components/form/ControlledSelect';
|
||||
import { ControlledSelect } from '@/components/form/ControlledSelect';
|
||||
import { Option } from '@/components/ui/v2/Option';
|
||||
import type { NormalizedQueryDataRow } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { NormalizedQueryDataRow } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import type { ForwardedRef, PropsWithoutRef } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { useFormContext, useFormState } from 'react-hook-form';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ControlledSelect } from '@/components/form/ControlledSelect';
|
||||
import { Option } from '@/components/ui/v2/Option';
|
||||
import type { NormalizedQueryDataRow } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { NormalizedQueryDataRow } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { useFormContext, useFormState, useWatch } from 'react-hook-form';
|
||||
import type { BaseForeignKeyFormValues } from './BaseForeignKeyForm';
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@ import { useDialog } from '@/components/common/DialogProvider';
|
||||
import { Form } from '@/components/form/Form';
|
||||
import { Box } from '@/components/ui/v2/Box';
|
||||
import { Button } from '@/components/ui/v2/Button';
|
||||
import { DatabaseRecordInputGroup } from '@/features/database/dataGrid/components/DatabaseRecordInputGroup';
|
||||
import { DatabaseRecordInputGroup } from '@/features/orgs/projects/database/dataGrid/components/DatabaseRecordInputGroup';
|
||||
import type {
|
||||
ColumnInsertOptions,
|
||||
DataBrowserGridColumn,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import { useEffect } from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
|
||||
@@ -4,11 +4,11 @@ import { Box } from '@/components/ui/v2/Box';
|
||||
import { Button } from '@/components/ui/v2/Button';
|
||||
import { Input } from '@/components/ui/v2/Input';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import { baseColumnValidationSchema } from '@/features/database/dataGrid/components/BaseColumnForm';
|
||||
import { baseColumnValidationSchema } from '@/features/orgs/projects/database/dataGrid/components/BaseColumnForm';
|
||||
import type {
|
||||
DatabaseTable,
|
||||
ForeignKeyRelation,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import type { DialogFormProps } from '@/types/common';
|
||||
import { useEffect } from 'react';
|
||||
import { useFormContext, useFormState } from 'react-hook-form';
|
||||
@@ -152,17 +152,17 @@ export default function BaseTableForm({
|
||||
className="flex flex-auto flex-col content-between overflow-hidden border-t-1"
|
||||
>
|
||||
<div className="flex-auto overflow-y-auto pb-4">
|
||||
<Box component="section" className="grid grid-cols-8 py-3 px-6">
|
||||
<Box component="section" className="grid grid-cols-8 px-6 py-3">
|
||||
<NameInput />
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
component="section"
|
||||
className="grid grid-cols-8 border-t-1 py-3 px-6"
|
||||
className="grid grid-cols-8 border-t-1 px-6 py-3"
|
||||
>
|
||||
<Text
|
||||
variant="h2"
|
||||
className="col-span-8 mt-3 mb-1.5 text-sm+ font-bold"
|
||||
className="col-span-8 mb-1.5 mt-3 text-sm+ font-bold"
|
||||
>
|
||||
Columns
|
||||
</Text>
|
||||
|
||||
@@ -10,12 +10,12 @@ import { OptionBase } from '@/components/ui/v2/Option';
|
||||
import type {
|
||||
ColumnType,
|
||||
ForeignKeyRelation,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import {
|
||||
identityTypes,
|
||||
postgresFunctions,
|
||||
postgresTypeGroups,
|
||||
} from '@/features/database/dataGrid/utils/postgresqlConstants';
|
||||
} from '@/features/orgs/projects/database/dataGrid/utils/postgresqlConstants';
|
||||
import clsx from 'clsx';
|
||||
import type { PropsWithoutRef } from 'react';
|
||||
import { memo, useEffect, useState } from 'react';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Button } from '@/components/ui/v2/Button';
|
||||
import { ArrowRightIcon } from '@/components/ui/v2/icons/ArrowRightIcon';
|
||||
import { LinkIcon } from '@/components/ui/v2/icons/LinkIcon';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import type { ForeignKeyRelation } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { ForeignKeyRelation } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { useWatch } from 'react-hook-form';
|
||||
|
||||
export interface ForeignKeyEditorRowProps {
|
||||
@@ -50,7 +50,7 @@ export default function ForeignKeyEditorRow({
|
||||
<Button
|
||||
onClick={onEdit}
|
||||
variant="borderless"
|
||||
className="min-w-[initial] py-1 px-2"
|
||||
className="min-w-[initial] px-2 py-1"
|
||||
>
|
||||
Edit
|
||||
</Button>
|
||||
@@ -58,7 +58,7 @@ export default function ForeignKeyEditorRow({
|
||||
<Button
|
||||
onClick={onDelete}
|
||||
variant="borderless"
|
||||
className="min-w-[initial] py-1 px-2"
|
||||
className="min-w-[initial] px-2 py-1"
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
|
||||
@@ -3,13 +3,13 @@ import { Button } from '@/components/ui/v2/Button';
|
||||
import { PlusIcon } from '@/components/ui/v2/icons/PlusIcon';
|
||||
import { InputLabel } from '@/components/ui/v2/InputLabel';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import type { BaseForeignKeyFormValues } from '@/features/database/dataGrid/components/BaseForeignKeyForm';
|
||||
import { CreateForeignKeyForm } from '@/features/database/dataGrid/components/CreateForeignKeyForm';
|
||||
import { EditForeignKeyForm } from '@/features/database/dataGrid/components/EditForeignKeyForm';
|
||||
import type { BaseForeignKeyFormValues } from '@/features/orgs/projects/database/dataGrid/components/BaseForeignKeyForm';
|
||||
import { CreateForeignKeyForm } from '@/features/orgs/projects/database/dataGrid/components/CreateForeignKeyForm';
|
||||
import { EditForeignKeyForm } from '@/features/orgs/projects/database/dataGrid/components/EditForeignKeyForm';
|
||||
import type {
|
||||
DatabaseColumn,
|
||||
ForeignKeyRelation,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { useFieldArray, useFormContext, useWatch } from 'react-hook-form';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
import ForeignKeyEditorRow from './ForeignKeyEditorRow';
|
||||
|
||||
@@ -3,8 +3,8 @@ import { Option } from '@/components/ui/v2/Option';
|
||||
import type {
|
||||
ColumnType,
|
||||
DatabaseColumn,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { identityTypes } from '@/features/database/dataGrid/utils/postgresqlConstants';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { identityTypes } from '@/features/orgs/projects/database/dataGrid/utils/postgresqlConstants';
|
||||
import { useMemo } from 'react';
|
||||
import { useFormContext, useFormState, useWatch } from 'react-hook-form';
|
||||
import type { BaseTableFormValues } from './BaseTableForm';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ControlledSelect } from '@/components/form/ControlledSelect';
|
||||
import { Option } from '@/components/ui/v2/Option';
|
||||
import type { DatabaseColumn } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { DatabaseColumn } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { useMemo } from 'react';
|
||||
import { useFormState, useWatch } from 'react-hook-form';
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ import { List } from '@/components/ui/v2/List';
|
||||
import { OptionBase } from '@/components/ui/v2/Option';
|
||||
import { OptionGroupBase } from '@/components/ui/v2/OptionGroup';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import { useMetadataQuery } from '@/features/database/dataGrid/hooks/useMetadataQuery';
|
||||
import { useTableQuery } from '@/features/database/dataGrid/hooks/useTableQuery';
|
||||
import { useMetadataQuery } from '@/features/orgs/projects/database/dataGrid/hooks/useMetadataQuery';
|
||||
import { useTableQuery } from '@/features/orgs/projects/database/dataGrid/hooks/useTableQuery';
|
||||
import { getTruncatedText } from '@/utils/getTruncatedText';
|
||||
import type { AutocompleteGroupedOption } from '@mui/base/useAutocomplete';
|
||||
import { useAutocomplete } from '@mui/base/useAutocomplete';
|
||||
@@ -210,7 +210,6 @@ function ColumnAutocomplete(
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
const options = useColumnGroups({
|
||||
selectedSchema,
|
||||
selectedTable,
|
||||
@@ -243,20 +242,20 @@ function ColumnAutocomplete(
|
||||
onChange: handleChange,
|
||||
});
|
||||
|
||||
|
||||
function handleInputValueChange(event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) {
|
||||
const {value} = event.target
|
||||
setInputValue(value)
|
||||
function handleInputValueChange(
|
||||
event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
|
||||
) {
|
||||
const { value } = event.target;
|
||||
setInputValue(value);
|
||||
|
||||
setSelectedColumn(
|
||||
{
|
||||
value,
|
||||
label: value,
|
||||
metadata: selectedColumn?.metadata || {
|
||||
table_schema: selectedSchema,
|
||||
table_name: selectedTable,
|
||||
}
|
||||
});
|
||||
setSelectedColumn({
|
||||
value,
|
||||
label: value,
|
||||
metadata: selectedColumn?.metadata || {
|
||||
table_schema: selectedSchema,
|
||||
table_name: selectedTable,
|
||||
},
|
||||
});
|
||||
|
||||
onChange?.(event, {
|
||||
value:
|
||||
@@ -395,11 +394,11 @@ function ColumnAutocomplete(
|
||||
);
|
||||
}}
|
||||
>
|
||||
<ArrowLeftIcon className="w-4 h-4" />
|
||||
<ArrowLeftIcon className="h-4 w-4" />
|
||||
</IconButton>
|
||||
)}
|
||||
|
||||
<Text className="text-left truncate direction-rtl">
|
||||
<Text className="direction-rtl truncate text-left">
|
||||
<Text component="span" color="disabled">
|
||||
{defaultTable}
|
||||
</Text>
|
||||
@@ -433,7 +432,7 @@ function ColumnAutocomplete(
|
||||
>
|
||||
{(
|
||||
groupedOptions as AutocompleteGroupedOption<
|
||||
typeof options[number]
|
||||
(typeof options)[number]
|
||||
>[]
|
||||
).map((optionGroup) =>
|
||||
renderGroup({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AutocompleteOption } from '@/components/ui/v2/Autocomplete';
|
||||
import type { FetchMetadataReturnType } from '@/features/database/dataGrid/hooks/useMetadataQuery';
|
||||
import type { FetchTableReturnType } from '@/features/database/dataGrid/hooks/useTableQuery';
|
||||
import type { HasuraMetadataTable } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { FetchMetadataReturnType } from '@/features/orgs/projects/database/dataGrid/hooks/useMetadataQuery';
|
||||
import type { FetchTableReturnType } from '@/features/orgs/projects/database/dataGrid/hooks/useTableQuery';
|
||||
import type { HasuraMetadataTable } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export interface UseAsyncValueOptions {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AutocompleteOption } from '@/components/ui/v2/Autocomplete';
|
||||
import type { FetchMetadataReturnType } from '@/features/database/dataGrid/hooks/useMetadataQuery';
|
||||
import type { FetchTableReturnType } from '@/features/database/dataGrid/hooks/useTableQuery';
|
||||
import type { FetchMetadataReturnType } from '@/features/orgs/projects/database/dataGrid/hooks/useMetadataQuery';
|
||||
import type { FetchTableReturnType } from '@/features/orgs/projects/database/dataGrid/hooks/useTableQuery';
|
||||
|
||||
export interface UseColumnGroupsOptions {
|
||||
/**
|
||||
@@ -65,44 +65,47 @@ export default function useColumnGroups({
|
||||
const objectAndArrayRelationships = [
|
||||
...(object_relationships || []),
|
||||
...(array_relationships || []),
|
||||
].reduce((relationships, currentRelationship) => {
|
||||
const { foreign_key_constraint_on, manual_configuration } =
|
||||
currentRelationship?.using || {};
|
||||
].reduce(
|
||||
(relationships, currentRelationship) => {
|
||||
const { foreign_key_constraint_on, manual_configuration } =
|
||||
currentRelationship?.using || {};
|
||||
|
||||
if (manual_configuration) {
|
||||
return [
|
||||
...relationships,
|
||||
...Object.keys(manual_configuration.column_mapping).map((column) => ({
|
||||
schema: manual_configuration.remote_table?.schema || 'public',
|
||||
table: manual_configuration.remote_table?.name,
|
||||
column,
|
||||
name: currentRelationship.name,
|
||||
})),
|
||||
];
|
||||
}
|
||||
if (manual_configuration) {
|
||||
return [
|
||||
...relationships,
|
||||
...Object.keys(manual_configuration.column_mapping).map((column) => ({
|
||||
schema: manual_configuration.remote_table?.schema || 'public',
|
||||
table: manual_configuration.remote_table?.name,
|
||||
column,
|
||||
name: currentRelationship.name,
|
||||
})),
|
||||
];
|
||||
}
|
||||
|
||||
if (typeof foreign_key_constraint_on === 'string') {
|
||||
return [
|
||||
...relationships,
|
||||
{
|
||||
schema: selectedSchema,
|
||||
table: selectedTable,
|
||||
column: foreign_key_constraint_on,
|
||||
name: currentRelationship.name,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (typeof foreign_key_constraint_on === 'string') {
|
||||
return [
|
||||
...relationships,
|
||||
{
|
||||
schema: selectedSchema,
|
||||
table: selectedTable,
|
||||
column: foreign_key_constraint_on,
|
||||
schema: foreign_key_constraint_on.table.schema,
|
||||
table: foreign_key_constraint_on.table.name,
|
||||
column: foreign_key_constraint_on.column,
|
||||
name: currentRelationship.name,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
...relationships,
|
||||
{
|
||||
schema: foreign_key_constraint_on.table.schema,
|
||||
table: foreign_key_constraint_on.table.name,
|
||||
column: foreign_key_constraint_on.column,
|
||||
name: currentRelationship.name,
|
||||
},
|
||||
];
|
||||
}, [] as { schema: string; table: string; column: string; name: string }[]);
|
||||
},
|
||||
[] as { schema: string; table: string; column: string; name: string }[],
|
||||
);
|
||||
|
||||
return [
|
||||
...columnOptions,
|
||||
|
||||
@@ -3,11 +3,11 @@ import { Button } from '@/components/ui/v2/Button';
|
||||
import type {
|
||||
BaseForeignKeyFormProps,
|
||||
BaseForeignKeyFormValues,
|
||||
} from '@/features/database/dataGrid/components/BaseForeignKeyForm';
|
||||
} from '@/features/orgs/projects/database/dataGrid/components/BaseForeignKeyForm';
|
||||
import {
|
||||
BaseForeignKeyForm,
|
||||
baseForeignKeyValidationSchema,
|
||||
} from '@/features/database/dataGrid/components/BaseForeignKeyForm';
|
||||
} from '@/features/orgs/projects/database/dataGrid/components/BaseForeignKeyForm';
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { useState } from 'react';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
|
||||
@@ -7,9 +7,9 @@ import { Input } from '@/components/ui/v2/Input';
|
||||
import { Option } from '@/components/ui/v2/Option';
|
||||
import { Select } from '@/components/ui/v2/Select';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import type { DataBrowserGridColumn } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getInputType } from '@/features/database/dataGrid/utils/inputHelpers';
|
||||
import { normalizeDefaultValue } from '@/features/database/dataGrid/utils/normalizeDefaultValue';
|
||||
import type { DataBrowserGridColumn } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getInputType } from '@/features/orgs/projects/database/dataGrid/utils/inputHelpers';
|
||||
import { normalizeDefaultValue } from '@/features/orgs/projects/database/dataGrid/utils/normalizeDefaultValue';
|
||||
import { Controller, useFormContext } from 'react-hook-form';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
@@ -82,7 +82,7 @@ export default function DatabaseRecordInputGroup({
|
||||
return (
|
||||
<Box component="section" className={twMerge('py-3', className)} {...props}>
|
||||
{title && (
|
||||
<Text variant="h2" className="mt-3 mb-1.5 text-sm+ font-bold">
|
||||
<Text variant="h2" className="mb-1.5 mt-3 text-sm+ font-bold">
|
||||
{title}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
@@ -3,12 +3,12 @@ import { Button } from '@/components/ui/v2/Button';
|
||||
import type {
|
||||
BaseForeignKeyFormProps,
|
||||
BaseForeignKeyFormValues,
|
||||
} from '@/features/database/dataGrid/components/BaseForeignKeyForm';
|
||||
} from '@/features/orgs/projects/database/dataGrid/components/BaseForeignKeyForm';
|
||||
import {
|
||||
BaseForeignKeyForm,
|
||||
baseForeignKeyValidationSchema,
|
||||
} from '@/features/database/dataGrid/components/BaseForeignKeyForm';
|
||||
import type { ForeignKeyRelation } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/components/BaseForeignKeyForm';
|
||||
import type { ForeignKeyRelation } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { useState } from 'react';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
|
||||
@@ -3,9 +3,9 @@ import { ActivityIndicator } from '@/components/ui/v2/ActivityIndicator';
|
||||
import { Button } from '@/components/ui/v2/Button';
|
||||
import { Checkbox } from '@/components/ui/v2/Checkbox';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import type { RolePermissionEditorFormValues } from '@/features/database/dataGrid/components/EditPermissionsForm/RolePermissionEditorForm';
|
||||
import { useTableQuery } from '@/features/database/dataGrid/hooks/useTableQuery';
|
||||
import type { DatabaseAction } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { RolePermissionEditorFormValues } from '@/features/orgs/projects/database/dataGrid/components/EditPermissionsForm/RolePermissionEditorForm';
|
||||
import { useTableQuery } from '@/features/orgs/projects/database/dataGrid/hooks/useTableQuery';
|
||||
import type { DatabaseAction } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { useFormContext, useWatch } from 'react-hook-form';
|
||||
import PermissionSettingsSection from './PermissionSettingsSection';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ControlledSwitch } from '@/components/form/ControlledSwitch';
|
||||
import { Button } from '@/components/ui/v2/Button';
|
||||
import { Checkbox } from '@/components/ui/v2/Checkbox';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import type { RolePermissionEditorFormValues } from '@/features/database/dataGrid/components/EditPermissionsForm/RolePermissionEditorForm';
|
||||
import type { RolePermissionEditorFormValues } from '@/features/orgs/projects/database/dataGrid/components/EditPermissionsForm/RolePermissionEditorForm';
|
||||
import { useFormContext, useWatch } from 'react-hook-form';
|
||||
import PermissionSettingsSection from './PermissionSettingsSection';
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ import { Input } from '@/components/ui/v2/Input';
|
||||
import { Radio } from '@/components/ui/v2/Radio';
|
||||
import { RadioGroup } from '@/components/ui/v2/RadioGroup';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import type { RolePermissionEditorFormValues } from '@/features/database/dataGrid/components/EditPermissionsForm/RolePermissionEditorForm';
|
||||
import { RuleGroupEditor } from '@/features/database/dataGrid/components/RuleGroupEditor';
|
||||
import type { RolePermissionEditorFormValues } from '@/features/orgs/projects/database/dataGrid/components/EditPermissionsForm/RolePermissionEditorForm';
|
||||
import { RuleGroupEditor } from '@/features/orgs/projects/database/dataGrid/components/RuleGroupEditor';
|
||||
import type {
|
||||
DatabaseAction,
|
||||
RuleGroup,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import type { FocusEvent } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DatabaseAction } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { DatabaseAction } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import * as Yup from 'yup';
|
||||
|
||||
const ruleSchema = Yup.object().shape({
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { ControlledSelect } from '@/components/form/ControlledSelect';
|
||||
import { Option } from '@/components/ui/v2/Option';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import { ColumnAutocomplete } from '@/features/database/dataGrid/components/ColumnAutocomplete';
|
||||
import type { HasuraOperator } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { ColumnAutocomplete } from '@/features/orgs/projects/database/dataGrid/components/ColumnAutocomplete';
|
||||
import type { HasuraOperator } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import type { DetailedHTMLProps, HTMLProps } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { useController, useFormContext } from 'react-hook-form';
|
||||
@@ -74,7 +74,7 @@ function renderOption({
|
||||
value,
|
||||
label,
|
||||
helperText,
|
||||
}: typeof commonOperators[number]) {
|
||||
}: (typeof commonOperators)[number]) {
|
||||
return (
|
||||
<Option key={value} value={value} className="grid grid-flow-col gap-2">
|
||||
<Text component="span" className="inline-block w-16">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ControlledSelect } from '@/components/form/ControlledSelect';
|
||||
import { Option } from '@/components/ui/v2/Option';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import type { RuleGroup } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { RuleGroup } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import type { DetailedHTMLProps, HTMLProps } from 'react';
|
||||
import { useWatch } from 'react-hook-form';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Form } from '@/components/form/Form';
|
||||
import { Button } from '@/components/ui/v2/Button';
|
||||
import { Text } from '@/components/ui/v2/Text';
|
||||
import type { RuleGroup } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { RuleGroup } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import permissionVariablesQuery from '@/tests/msw/mocks/graphql/permissionVariablesQuery';
|
||||
import hasuraMetadataQuery from '@/tests/msw/mocks/rest/hasuraMetadataQuery';
|
||||
import tableQuery from '@/tests/msw/mocks/rest/tableQuery';
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Text } from '@/components/ui/v2/Text';
|
||||
import type {
|
||||
Rule,
|
||||
RuleGroup,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
|
||||
import { generateAppServiceUrl } from '@/features/projects/common/utils/generateAppServiceUrl';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { XIcon } from '@/components/ui/v2/icons/XIcon';
|
||||
import type {
|
||||
Rule,
|
||||
RuleGroup,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { useWatch } from 'react-hook-form';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import type { AutocompleteOption } from '@/components/ui/v2/Autocomplete';
|
||||
import type { InputProps } from '@/components/ui/v2/Input';
|
||||
import { inputClasses } from '@/components/ui/v2/Input';
|
||||
import { Option } from '@/components/ui/v2/Option';
|
||||
import type { ColumnAutocompleteProps } from '@/features/database/dataGrid/components/ColumnAutocomplete';
|
||||
import { ColumnAutocomplete } from '@/features/database/dataGrid/components/ColumnAutocomplete';
|
||||
import type { HasuraOperator } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { ColumnAutocompleteProps } from '@/features/orgs/projects/database/dataGrid/components/ColumnAutocomplete';
|
||||
import { ColumnAutocomplete } from '@/features/orgs/projects/database/dataGrid/components/ColumnAutocomplete';
|
||||
import type { HasuraOperator } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { useCurrentWorkspaceAndProject } from '@/features/projects/common/hooks/useCurrentWorkspaceAndProject';
|
||||
import { getAllPermissionVariables } from '@/features/projects/permissions/settings/utils/getAllPermissionVariables';
|
||||
import { useGetRolesPermissionsQuery } from '@/utils/__generated__/graphql';
|
||||
|
||||
@@ -4,8 +4,8 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import prepareCreateColumnQuery from './prepareCreateColumnQuery';
|
||||
|
||||
export interface CreateColumnVariables {
|
||||
|
||||
@@ -4,9 +4,9 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||
import prepareCreateColumnQuery from './prepareCreateColumnQuery';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DatabaseColumn } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { DatabaseColumn } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { expect, test } from 'vitest';
|
||||
import prepareCreateColumnQuery from './prepareCreateColumnQuery';
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type {
|
||||
DatabaseColumn,
|
||||
MutationOrQueryBaseOptions,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { identityTypes } from '@/features/database/dataGrid/utils/postgresqlConstants';
|
||||
import { prepareCreateForeignKeyRelationQuery } from '@/features/database/dataGrid/utils/prepareCreateForeignKeyRelationQuery';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { identityTypes } from '@/features/orgs/projects/database/dataGrid/utils/postgresqlConstants';
|
||||
import { prepareCreateForeignKeyRelationQuery } from '@/features/orgs/projects/database/dataGrid/utils/prepareCreateForeignKeyRelationQuery';
|
||||
import { format } from 'node-pg-format';
|
||||
|
||||
export interface PrepareCreateColumnQueryVariables
|
||||
|
||||
@@ -4,9 +4,9 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { format } from 'node-pg-format';
|
||||
|
||||
export interface CreateRecordVariables<TData extends object = {}> {
|
||||
|
||||
@@ -4,8 +4,8 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import prepareCreateTableQuery from './prepareCreateTableQuery';
|
||||
|
||||
export interface CreateTableVariables {
|
||||
|
||||
@@ -4,9 +4,9 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||
import prepareCreateTableQuery from './prepareCreateTableQuery';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DatabaseTable } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { DatabaseTable } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { expect, test } from 'vitest';
|
||||
import prepareCreateTableQuery from './prepareCreateTableQuery';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type {
|
||||
DatabaseTable,
|
||||
MutationOrQueryBaseOptions,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { format } from 'node-pg-format';
|
||||
|
||||
export interface PrepareCreateTableQueryVariables
|
||||
|
||||
@@ -3,8 +3,8 @@ import type {
|
||||
NormalizedQueryDataRow,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedReadOnlyHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedReadOnlyHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
|
||||
export interface FetchDatabaseOptions
|
||||
extends Omit<MutationOrQueryBaseOptions, 'schema' | 'table'> {}
|
||||
|
||||
@@ -4,9 +4,9 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
|
||||
export interface DeleteColumnVariables {
|
||||
/**
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { prepareCreateColumnQuery } from '@/features/database/dataGrid/hooks/useCreateColumnMutation';
|
||||
import { prepareCreateColumnQuery } from '@/features/orgs/projects/database/dataGrid/hooks/useCreateColumnMutation';
|
||||
import type {
|
||||
AffectedRowsResult,
|
||||
DataBrowserGridColumn,
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||
|
||||
export interface DeleteColumnMigrationVariables {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { UseDeleteColumnMutationOptions } from '@/features/database/dataGrid/hooks/useDeleteColumnMutation';
|
||||
import type { UseDeleteColumnMutationOptions } from '@/features/orgs/projects/database/dataGrid/hooks/useDeleteColumnMutation';
|
||||
import { showLoadingToast, triggerToast } from '@/utils/toast';
|
||||
import { useEffect, useState } from 'react';
|
||||
import toast from 'react-hot-toast';
|
||||
|
||||
@@ -2,9 +2,9 @@ import type {
|
||||
AffectedRowsResult,
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { format } from 'node-pg-format';
|
||||
import type { Row } from 'react-table';
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
|
||||
export interface DeleteTableVariables {
|
||||
/**
|
||||
|
||||
@@ -3,12 +3,12 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import {
|
||||
getEmptyDownMigrationMessage,
|
||||
getPreparedHasuraQuery,
|
||||
} from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||
|
||||
export interface DeleteTableMigrationVariables {
|
||||
|
||||
@@ -5,8 +5,8 @@ import type {
|
||||
MetadataError,
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeMetadataError } from '@/features/database/dataGrid/utils/normalizeMetadataError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeMetadataError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeMetadataError';
|
||||
|
||||
export interface ManagePermissionVariables {
|
||||
/**
|
||||
|
||||
@@ -5,8 +5,8 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||
|
||||
export interface ManagePermissionMigrationVariables {
|
||||
|
||||
@@ -3,7 +3,7 @@ import type {
|
||||
HasuraMetadataSource,
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
|
||||
export interface FetchMetadataOptions
|
||||
extends Omit<MutationOrQueryBaseOptions, 'schema' | 'table'> {}
|
||||
|
||||
@@ -5,10 +5,10 @@ import type {
|
||||
OrderBy,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { extractForeignKeyRelation } from '@/features/database/dataGrid/utils/extractForeignKeyRelation';
|
||||
import { getPreparedReadOnlyHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { POSTGRESQL_ERROR_CODES } from '@/features/database/dataGrid/utils/postgresqlConstants';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { extractForeignKeyRelation } from '@/features/orgs/projects/database/dataGrid/utils/extractForeignKeyRelation';
|
||||
import { getPreparedReadOnlyHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { POSTGRESQL_ERROR_CODES } from '@/features/orgs/projects/database/dataGrid/utils/postgresqlConstants';
|
||||
import { formatWithArray } from 'node-pg-format';
|
||||
|
||||
export interface FetchTableOptions extends MutationOrQueryBaseOptions {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { HasuraMetadata } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { HasuraMetadata } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { rest } from 'msw';
|
||||
import { setupServer } from 'msw/node';
|
||||
import prepareTrackForeignKeyRelationsMetadata from './prepareTrackForeignKeyRelationsMetadata';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { fetchMetadata } from '@/features/database/dataGrid/hooks/useMetadataQuery';
|
||||
import { fetchMetadata } from '@/features/orgs/projects/database/dataGrid/hooks/useMetadataQuery';
|
||||
import type {
|
||||
ForeignKeyRelation,
|
||||
HasuraMetadataRelationship,
|
||||
MutationOrQueryBaseOptions,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { singular } from 'pluralize';
|
||||
|
||||
export type ForeignKeyMetadataOperation =
|
||||
|
||||
@@ -4,8 +4,8 @@ import type {
|
||||
MetadataError,
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeMetadataError } from '@/features/database/dataGrid/utils/normalizeMetadataError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeMetadataError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeMetadataError';
|
||||
import prepareTrackForeignKeyRelationsMetadata from './prepareTrackForeignKeyRelationsMetadata';
|
||||
|
||||
export interface TrackForeignKeyRelationsVariables {
|
||||
|
||||
@@ -4,8 +4,8 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||
import prepareTrackForeignKeyRelationsMetadata from './prepareTrackForeignKeyRelationsMetadata';
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import type {
|
||||
MetadataError,
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeMetadataError } from '@/features/database/dataGrid/utils/normalizeMetadataError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeMetadataError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeMetadataError';
|
||||
|
||||
export interface TrackTableVariables {
|
||||
/**
|
||||
|
||||
@@ -4,8 +4,8 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||
|
||||
export interface TrackTableMigrationVariables {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type {
|
||||
DatabaseColumn,
|
||||
MutationOrQueryBaseOptions,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeDefaultValue } from '@/features/database/dataGrid/utils/normalizeDefaultValue';
|
||||
import { prepareCreateForeignKeyRelationQuery } from '@/features/database/dataGrid/utils/prepareCreateForeignKeyRelationQuery';
|
||||
import { prepareUpdateForeignKeyRelationQuery } from '@/features/database/dataGrid/utils/prepareUpdateForeignKeyRelationQuery';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeDefaultValue } from '@/features/orgs/projects/database/dataGrid/utils/normalizeDefaultValue';
|
||||
import { prepareCreateForeignKeyRelationQuery } from '@/features/orgs/projects/database/dataGrid/utils/prepareCreateForeignKeyRelationQuery';
|
||||
import { prepareUpdateForeignKeyRelationQuery } from '@/features/orgs/projects/database/dataGrid/utils/prepareUpdateForeignKeyRelationQuery';
|
||||
import { format } from 'node-pg-format';
|
||||
|
||||
export interface PrepareUpdateColumnQueryVariables
|
||||
|
||||
@@ -4,8 +4,8 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import prepareUpdateColumnQuery from './prepareUpdateColumnQuery';
|
||||
|
||||
export interface UpdateColumnVariables {
|
||||
|
||||
@@ -4,9 +4,9 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getEmptyDownMigrationMessage } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getEmptyDownMigrationMessage } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||
import prepareUpdateColumnQuery from './prepareUpdateColumnQuery';
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@ import type {
|
||||
MutationOrQueryBaseOptions,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import {
|
||||
getPreparedHasuraQuery,
|
||||
getPreparedReadOnlyHasuraQuery,
|
||||
} from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { format } from 'node-pg-format';
|
||||
|
||||
export interface UpdateRecordVariables<TData extends object = {}> {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type {
|
||||
DatabaseColumn,
|
||||
DatabaseTable,
|
||||
NormalizedQueryDataRow,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import prepareUpdateTableQuery from './prepareUpdateTableQuery';
|
||||
|
||||
const originalTable: NormalizedQueryDataRow = {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { prepareCreateColumnQuery } from '@/features/database/dataGrid/hooks/useCreateColumnMutation';
|
||||
import { prepareUpdateColumnQuery } from '@/features/database/dataGrid/hooks/useUpdateColumnMutation';
|
||||
import { prepareCreateColumnQuery } from '@/features/orgs/projects/database/dataGrid/hooks/useCreateColumnMutation';
|
||||
import { prepareUpdateColumnQuery } from '@/features/orgs/projects/database/dataGrid/hooks/useUpdateColumnMutation';
|
||||
import type {
|
||||
DatabaseColumn,
|
||||
DatabaseTable,
|
||||
ForeignKeyRelation,
|
||||
MutationOrQueryBaseOptions,
|
||||
NormalizedQueryDataRow,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { prepareCreateForeignKeyRelationQuery } from '@/features/database/dataGrid/utils/prepareCreateForeignKeyRelationQuery';
|
||||
import { prepareUpdateForeignKeyRelationQuery } from '@/features/database/dataGrid/utils/prepareUpdateForeignKeyRelationQuery';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getPreparedHasuraQuery } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { prepareCreateForeignKeyRelationQuery } from '@/features/orgs/projects/database/dataGrid/utils/prepareCreateForeignKeyRelationQuery';
|
||||
import { prepareUpdateForeignKeyRelationQuery } from '@/features/orgs/projects/database/dataGrid/utils/prepareUpdateForeignKeyRelationQuery';
|
||||
|
||||
export interface PrepareUpdateTableQueryVariables
|
||||
extends Omit<MutationOrQueryBaseOptions, 'appUrl' | 'table' | 'adminSecret'> {
|
||||
|
||||
@@ -7,8 +7,8 @@ import type {
|
||||
NormalizedQueryDataRow,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import prepareUpdateTableQuery from './prepareUpdateTableQuery';
|
||||
|
||||
export interface UpdateTableVariables {
|
||||
|
||||
@@ -7,9 +7,9 @@ import type {
|
||||
NormalizedQueryDataRow,
|
||||
QueryError,
|
||||
QueryResult,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { getEmptyDownMigrationMessage } from '@/features/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/database/dataGrid/utils/normalizeQueryError';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { getEmptyDownMigrationMessage } from '@/features/orgs/projects/database/dataGrid/utils/hasuraQueryHelpers';
|
||||
import { normalizeQueryError } from '@/features/orgs/projects/database/dataGrid/utils/normalizeQueryError';
|
||||
import { getHasuraMigrationsApiUrl } from '@/utils/env';
|
||||
import prepareUpdateTableQuery from './prepareUpdateTableQuery';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DatabaseColumn } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { DatabaseColumn } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import convertDataBrowserGridColumnToDatabaseColumn from './convertDataBrowserGridColumnToDatabaseColumn';
|
||||
|
||||
test('should convert a data browser column to a database column', () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { AutocompleteOption } from '@/components/ui/v2/Autocomplete';
|
||||
import type {
|
||||
DatabaseColumn,
|
||||
DataBrowserGridColumn,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
|
||||
/**
|
||||
* Converts a data browser grid column to a normalized database column.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type {
|
||||
HasuraOperator,
|
||||
RuleGroup,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
|
||||
function createNestedObject(pathParts: string[], value: any) {
|
||||
const [currentPath, ...restPath] = pathParts;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type {
|
||||
ForeignKeyRelation,
|
||||
PostgresReferentialAction,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
|
||||
/**
|
||||
* Extracts foreign key relation data from a raw foreign key constraint. This
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { InputProps } from '@/components/ui/v2/Input';
|
||||
import type { DataBrowserGridColumn } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { DataBrowserGridColumn } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
|
||||
/**
|
||||
* Get the input type based on the column type.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type {
|
||||
DatabaseColumn,
|
||||
NormalizedQueryDataRow,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import normalizeDatabaseColumn from './normalizeDatabaseColumn';
|
||||
|
||||
const rawColumn: NormalizedQueryDataRow = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type {
|
||||
DatabaseColumn,
|
||||
NormalizedQueryDataRow,
|
||||
} from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeDefaultValue } from '@/features/database/dataGrid/utils/normalizeDefaultValue';
|
||||
} from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import { normalizeDefaultValue } from '@/features/orgs/projects/database/dataGrid/utils/normalizeDefaultValue';
|
||||
|
||||
/**
|
||||
* Converts a raw database column to a normalized database column.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MetadataError } from '@/features/database/dataGrid/types/dataBrowser';
|
||||
import type { MetadataError } from '@/features/orgs/projects/database/dataGrid/types/dataBrowser';
|
||||
import normalizeMetadataError from './normalizeMetadataError';
|
||||
|
||||
const baseMetadataError = {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user