Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix:minimally show type in column editor if column type is not a native psql type

Joshen Lim62f3a0a207cb
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnType.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnType.tsx
index 1be64e209a8..70b2bd20016 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnType.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnType.tsx
@@ -1,7 +1,7 @@
import React, { FC } from 'react'
-import { IconCalendar, IconType, IconHash, Listbox, IconToggleRight } from '@supabase/ui'
+import { IconCalendar, IconType, IconHash, Listbox, IconToggleRight, Input } from '@supabase/ui'
import { PostgresType } from '@supabase/postgres-meta'
-import { POSTGRES_DATA_TYPE_OPTIONS } from '../SidePanelEditor.constants'
+import { POSTGRES_DATA_TYPES, POSTGRES_DATA_TYPE_OPTIONS } from '../SidePanelEditor.constants'
import { PostgresDataTypeOption } from '../SidePanelEditor.types'
interface Props {
@@ -25,6 +25,12 @@ const ColumnType: FC<Props> = ({
showLabel = true,
onOptionSelect = () => {},
}) => {
+ const isNativeDataType = POSTGRES_DATA_TYPES.includes(value)
+
+ if (!isNativeDataType) {
+ return <Input readOnly disabled label="Type" layout="horizontal" value={value} />
+ }
+
const inferIcon = (type: string) => {
switch (type) {
case 'number':
@@ -53,7 +59,7 @@ const ColumnType: FC<Props> = ({
value={value}
size={size}
error={error}
- disabled={disabled}
+ disabled={disabled || !isNativeDataType}
className={`${className} ${disabled ? 'column-type-disabled' : ''} rounded-md`}
onChange={(value: string) => onOptionSelect(value)}
optionsWidth={480}
@@ -67,13 +73,14 @@ const ColumnType: FC<Props> = ({
</Listbox.Option>
{enumTypes.length > 0 ? (
+ // @ts-ignore
enumTypes.map((enumType: PostgresType) => (
<Listbox.Option
key={enumType.name}
value={enumType.name}
label={enumType.name}
addOnBefore={() => {
- return <div className="mx-1 w-2 h-2 rounded-full bg-scale-1200" />
+ return <div className="bg-scale-1200 mx-1 h-2 w-2 rounded-full" />
}}
>
<div className="flex items-center space-x-4">
@@ -88,7 +95,7 @@ const ColumnType: FC<Props> = ({
value="no-enums"
label="no-enums"
addOnBefore={() => {
- return <div className="mx-1 w-2 h-2 rounded-full bg-gray-500" />
+ return <div className="mx-1 h-2 w-2 rounded-full bg-gray-500" />
}}
>
<div className="flex items-center space-x-4">