mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
address feedback
This commit is contained in:
1 parent
aea640c2a8
commit
4100321c3e
4 files changed
+22
-20
No files matched your search
+3
-3
@@ -2,7 +2,7 @@ import type { PostgresTable } from '@supabase/postgres-meta'
|
||||
|
||||
interface HeaderTitleProps {
|
||||
schema: string
|
||||
table: PostgresTable
|
||||
table?: { name: string }
|
||||
isDuplicating: boolean
|
||||
}
|
||||
|
||||
@@ -17,13 +17,13 @@ const HeaderTitle = ({ schema, table, isDuplicating }: HeaderTitleProps) => {
|
||||
if (isDuplicating) {
|
||||
return (
|
||||
<>
|
||||
Duplicate table <code className="text-sm">{table.name}</code>
|
||||
Duplicate table <code className="text-sm">{table?.name}</code>
|
||||
</>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<>
|
||||
Update table <code className="text-sm">{table.name}</code>
|
||||
Update table <code className="text-sm">{table?.name}</code>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
+1
-5
@@ -170,11 +170,7 @@ const TableEditor = ({
|
||||
key="TableEditor"
|
||||
visible={visible}
|
||||
header={
|
||||
<HeaderTitle
|
||||
schema={snap.selectedSchemaName}
|
||||
table={table as any}
|
||||
isDuplicating={isDuplicating}
|
||||
/>
|
||||
<HeaderTitle schema={snap.selectedSchemaName} table={table} isDuplicating={isDuplicating} />
|
||||
}
|
||||
className={`transition-all duration-100 ease-in ${isImportingSpreadsheet ? ' mr-32' : ''}`}
|
||||
onCancel={closePanel}
|
||||
|
||||
@@ -411,7 +411,7 @@ const TableGridEditor = ({
|
||||
{(isViewSelected || isTableSelected) && <TableDefinition id={selectedTable?.id} />}
|
||||
</SupabaseGrid>
|
||||
|
||||
{!isUndefined(snap.selectedSchemaName) && (
|
||||
{snap.selectedSchemaName !== undefined && (
|
||||
<SidePanelEditor
|
||||
isDuplicating={isDuplicating}
|
||||
selectedTable={selectedTable as PostgresTable}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PostgresSchema } from '@supabase/postgres-meta'
|
||||
import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
import { get } from 'lib/common/fetch'
|
||||
import { API_URL } from 'lib/constants'
|
||||
|
||||
import { components } from 'data/api'
|
||||
import { get } from 'data/fetchers'
|
||||
import { ResponseError } from 'types'
|
||||
import { databaseKeys } from './keys'
|
||||
|
||||
@@ -10,9 +10,7 @@ export type SchemasVariables = {
|
||||
connectionString?: string
|
||||
}
|
||||
|
||||
export type Schema = PostgresSchema
|
||||
|
||||
export type SchemasResponse = Schema[] | { error?: any }
|
||||
export type Schema = components['schemas']['PostgresSchema']
|
||||
|
||||
export async function getSchemas(
|
||||
{ projectRef, connectionString }: SchemasVariables,
|
||||
@@ -25,16 +23,24 @@ export async function getSchemas(
|
||||
let headers = new Headers()
|
||||
if (connectionString) headers.set('x-connection-encrypted', connectionString)
|
||||
|
||||
const response = (await get(`${API_URL}/pg-meta/${projectRef}/schemas`, {
|
||||
const { data, error } = await get('/platform/pg-meta/{ref}/schemas', {
|
||||
params: {
|
||||
header: {
|
||||
'x-connection-encrypted': connectionString!,
|
||||
},
|
||||
path: {
|
||||
ref: projectRef,
|
||||
},
|
||||
},
|
||||
headers: Object.fromEntries(headers),
|
||||
signal,
|
||||
})) as SchemasResponse
|
||||
})
|
||||
|
||||
if (!Array.isArray(response) && response.error) {
|
||||
throw response.error
|
||||
if (error) {
|
||||
throw error
|
||||
}
|
||||
|
||||
return response as PostgresSchema[]
|
||||
return data
|
||||
}
|
||||
|
||||
export type SchemasData = Awaited<ReturnType<typeof getSchemas>>
|
||||
|
||||
Reference in new issue
Block a user