Skip to content

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

Only show CTA if table is not protected

Joshen Lim5817e8bd8b74
diff --git a/studio/components/grid/SupabaseGrid.tsx b/studio/components/grid/SupabaseGrid.tsx
index 888988ce60d..0cd01351b10 100644
--- a/studio/components/grid/SupabaseGrid.tsx
+++ b/studio/components/grid/SupabaseGrid.tsx
@@ -187,6 +187,7 @@ const SupabaseGridLayout = forwardRef<SupabaseGridRef, SupabaseGridProps>((props
{...gridProps}
rows={data?.rows ?? []}
updateRow={updateTableRow}
+ onAddRow={onAddRow}
onImportData={onImportData}
onEditForeignKeyColumnValue={onEditForeignKeyColumnValue}
/>
diff --git a/studio/components/grid/components/grid/Grid.tsx b/studio/components/grid/components/grid/Grid.tsx
index a64a6d0ee1b..3d28e84c4ad 100644
--- a/studio/components/grid/components/grid/Grid.tsx
+++ b/studio/components/grid/components/grid/Grid.tsx
@@ -28,6 +28,7 @@ const updateColumnResizeDebounced = AwesomeDebouncePromise(updateColumnResize, 5
interface IGrid extends GridProps {
rows: any[]
updateRow: (previousRow: any, updatedData: any) => void
+ onAddRow?: () => void
onImportData?: () => void
onEditForeignKeyColumnValue: (args: {
foreignKey: NonNullable<ForeignRowSelectorProps['foreignKey']>
@@ -48,6 +49,7 @@ export const Grid = memo(
rowClass,
rows,
updateRow,
+ onAddRow,
onImportData,
onEditForeignKeyColumnValue,
},
@@ -145,16 +147,20 @@ export const Grid = memo(
className="flex flex-col items-center justify-center"
>
<p className="text-base">This table is empty</p>
- <p className="text-sm text-light mt-1">Add or generate rows to get started.</p>
- <div className="flex items-center space-x-2 mt-4">
- {/* [Joshen] Leaving this as a placeholder */}
- {/* <Button type="outline">Generate random data</Button> */}
- {onImportData !== undefined && (
- <Button type="default" onClick={onImportData}>
- Import data via CSV
- </Button>
- )}
- </div>
+ {onAddRow !== undefined && onImportData !== undefined && (
+ <>
+ <p className="text-sm text-light mt-1">Add or generate rows to get started.</p>
+ <div className="flex items-center space-x-2 mt-4">
+ {/* [Joshen] Leaving this as a placeholder */}
+ {/* <Button type="outline">Generate random data</Button> */}
+ {onAddRow !== undefined && onImportData !== undefined && (
+ <Button type="default" onClick={onImportData}>
+ Import data via CSV
+ </Button>
+ )}
+ </div>
+ </>
+ )}
</div>
}
/>