From 521b8b63a013e8fa609faf96d702762018739f8c Mon Sep 17 00:00:00 2001 From: Ivan Vasilov Date: Tue, 1 Aug 2023 16:27:34 +0200 Subject: [PATCH 1/9] Fix the functions page not been able to reload. --- .../components/interfaces/Functions/EdgeFunctionsListItem.tsx | 2 +- studio/pages/project/[ref]/functions/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/studio/components/interfaces/Functions/EdgeFunctionsListItem.tsx b/studio/components/interfaces/Functions/EdgeFunctionsListItem.tsx index e968c6e115e..84daf7c27cd 100644 --- a/studio/components/interfaces/Functions/EdgeFunctionsListItem.tsx +++ b/studio/components/interfaces/Functions/EdgeFunctionsListItem.tsx @@ -21,7 +21,7 @@ const EdgeFunctionsListItem: FC = ({ function: item }) => { const { project } = useProjectContext() // get the .co or .net TLD from the restUrl const restUrl = project?.restUrl - const restUrlTld = new URL(restUrl as string).hostname.split('.').pop() + const restUrlTld = new URL(restUrl ?? 'http://example.com').hostname.split('.').pop() const functionUrl = `https://${ref}.supabase.${restUrlTld}/functions/v1/${item.slug}` return ( diff --git a/studio/pages/project/[ref]/functions/index.tsx b/studio/pages/project/[ref]/functions/index.tsx index 0673931084f..b19b56009a5 100644 --- a/studio/pages/project/[ref]/functions/index.tsx +++ b/studio/pages/project/[ref]/functions/index.tsx @@ -44,7 +44,7 @@ const PageLayout: NextPageWithLayout = () => { body={ <> {functions.length > 0 && - functions.map((item: any) => )} + functions.map((item) => )} } /> From be716807928a23f144162e65fea515570af91fa2 Mon Sep 17 00:00:00 2001 From: Ivan Vasilov Date: Tue, 1 Aug 2023 16:59:16 +0200 Subject: [PATCH 2/9] When creating a table, created_at should not be a nullable since it defaults to now() function. --- .../SidePanelEditor/TableEditor/TableEditor.constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.constants.ts b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.constants.ts index d0dac2adb38..7b924cffdbe 100644 --- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.constants.ts +++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.constants.ts @@ -24,7 +24,7 @@ export const DEFAULT_COLUMNS: ColumnField[] = [ defaultValue: 'now()', check: null, foreignKey: undefined, - isNullable: true, + isNullable: false, isUnique: false, isArray: false, isPrimaryKey: false, From ebdcaca6e0711886d9c10a158590042363d8c104 Mon Sep 17 00:00:00 2001 From: Ivan Vasilov Date: Tue, 1 Aug 2023 17:00:13 +0200 Subject: [PATCH 3/9] When creating a foreign key, always default to the primary key in column dropdown of the referenced table. --- .../ForeignKeySelector/ForeignKeySelector.tsx | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx index 3a6fb96cc55..65871c80afd 100644 --- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx +++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx @@ -1,16 +1,16 @@ -import React, { FC, useEffect, useState } from 'react' -import { get, find, isEmpty, sortBy } from 'lodash' +import type { PostgresColumn, PostgresSchema, PostgresTable } from '@supabase/postgres-meta' import { Dictionary } from 'components/grid' -import { SidePanel, Input, Listbox, IconHelpCircle, IconDatabase, Toggle } from 'ui' -import type { PostgresTable, PostgresColumn, PostgresSchema } from '@supabase/postgres-meta' +import { find, get, isEmpty, sortBy } from 'lodash' +import { FC, useEffect, useState } from 'react' +import { IconDatabase, IconHelpCircle, Input, Listbox, SidePanel } from 'ui' -import { useStore } from 'hooks' -import ActionBar from '../ActionBar' -import { ForeignKey } from './ForeignKeySelector.types' -import { ColumnField } from '../SidePanelEditor.types' import InformationBox from 'components/ui/InformationBox' import { FOREIGN_KEY_DELETION_ACTION } from 'data/database/database-query-constants' +import { useStore } from 'hooks' +import ActionBar from '../ActionBar' +import { ColumnField } from '../SidePanelEditor.types' import { FOREIGN_KEY_DELETION_OPTIONS } from './ForeignKeySelector.constants' +import { ForeignKey } from './ForeignKeySelector.types' import { generateDeletionActionDescription } from './ForeignKeySelector.utils' interface Props { @@ -98,10 +98,13 @@ const ForeignKeySelector: FC = ({ column, visible = false, closePanel, sa } const table = find(tables, { id: tableId }) if (table) { + const primaryColumn = table.primary_keys[0].name + const firstColumn = table.columns?.length ? table.columns[0].name : undefined + setSelectedForeignKey({ schema: table.schema, table: table.name, - column: table.columns?.length ? table.columns[0].name : undefined, + column: primaryColumn ?? firstColumn, deletionAction: FOREIGN_KEY_DELETION_ACTION.NO_ACTION, }) } From 3094b2abfc2b7f53597b0fb22be438b65bd3bf2d Mon Sep 17 00:00:00 2001 From: Ivan Vasilov Date: Tue, 1 Aug 2023 22:45:06 +0200 Subject: [PATCH 4/9] Change the wording for deleting a project or cancelling a subscription. --- studio/components/interfaces/BillingV2/Billing.constants.ts | 2 +- .../Organization/BillingSettingsV2/BillingSettings.constants.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/studio/components/interfaces/BillingV2/Billing.constants.ts b/studio/components/interfaces/BillingV2/Billing.constants.ts index 519a1ca2afc..c4a48de2d74 100644 --- a/studio/components/interfaces/BillingV2/Billing.constants.ts +++ b/studio/components/interfaces/BillingV2/Billing.constants.ts @@ -10,7 +10,7 @@ export const CANCELLATION_REASONS = [ 'Dashboard is too complicated', 'Postgres is too complicated', 'Problem not solved', - 'Bug issues', + 'Too many bugs/issues', 'I decided to use something else', 'My work has finished/discontinued', 'I’m migrating to/starting a new project', diff --git a/studio/components/interfaces/Organization/BillingSettingsV2/BillingSettings.constants.ts b/studio/components/interfaces/Organization/BillingSettingsV2/BillingSettings.constants.ts index 3e16e7b2138..d2f5238e5f4 100644 --- a/studio/components/interfaces/Organization/BillingSettingsV2/BillingSettings.constants.ts +++ b/studio/components/interfaces/Organization/BillingSettingsV2/BillingSettings.constants.ts @@ -8,7 +8,7 @@ export const CANCELLATION_REASONS = [ 'Dashboard is too complicated', 'Postgres is too complicated', 'Problem not solved', - 'Bug issues', + 'Too many bugs/issues', 'I decided to use something else', 'My work has finished/discontinued', 'I’m migrating to/starting a new project', From c8ddd1d1c258b1d949ff69a66741decd22b703d8 Mon Sep 17 00:00:00 2001 From: Ivan Vasilov Date: Thu, 3 Aug 2023 12:38:21 +0200 Subject: [PATCH 5/9] Add auth.uid for uuid suggestions. --- .../SidePanelEditor/ColumnEditor/ColumnEditor.constants.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.constants.ts b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.constants.ts index 407f2798911..056a8ac16bd 100644 --- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.constants.ts +++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.constants.ts @@ -31,6 +31,12 @@ const defaultTextBasedValues: Suggestion[] = [ // using meta-store's extensions to generate this partially on top of vanilla expressions export const typeExpressionSuggestions: Dictionary = { uuid: [ + { + name: 'auth.uid()', + value: 'auth.uid()', + description: + 'Extracts the unique user ID when rows are added or updated through serverless API', + }, { name: 'gen_random_uuid()', value: 'gen_random_uuid()', From e28f730bb576e87c9cde434648f9a293a934c472 Mon Sep 17 00:00:00 2001 From: Ivan Vasilov Date: Thu, 3 Aug 2023 13:38:05 +0200 Subject: [PATCH 6/9] Add ids to buttons on the top bar to make UI testing easier. --- studio/components/layouts/AppLayout/SettingsButton.tsx | 2 +- .../layouts/AppLayout/UserSettingsDropdown.tsx | 9 +++++++-- .../layouts/ProjectLayout/LayoutHeader/HelpPopover.tsx | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/studio/components/layouts/AppLayout/SettingsButton.tsx b/studio/components/layouts/AppLayout/SettingsButton.tsx index 7576d779903..70369a1dd1f 100644 --- a/studio/components/layouts/AppLayout/SettingsButton.tsx +++ b/studio/components/layouts/AppLayout/SettingsButton.tsx @@ -11,7 +11,7 @@ const SettingsButton = () => { - + diff --git a/studio/components/layouts/AppLayout/UserSettingsDropdown.tsx b/studio/components/layouts/AppLayout/UserSettingsDropdown.tsx index 51bba7ff4d7..19871d5866f 100644 --- a/studio/components/layouts/AppLayout/UserSettingsDropdown.tsx +++ b/studio/components/layouts/AppLayout/UserSettingsDropdown.tsx @@ -35,8 +35,13 @@ const UserSettingsDropdown = () => { return ( setOpen(!open)} modal={false}> - - {profile?.first_name ? profile?.first_name?.[0] : } + + diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/HelpPopover.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/HelpPopover.tsx index 05f28ff10ef..411eee235f6 100644 --- a/studio/components/layouts/ProjectLayout/LayoutHeader/HelpPopover.tsx +++ b/studio/components/layouts/ProjectLayout/LayoutHeader/HelpPopover.tsx @@ -33,6 +33,7 @@ const HelpPopover = ({ alt = false }: HelpPopoverProps) => {