diff --git a/components/database/edit-item-drawer.tsx b/components/database/edit-item-drawer.tsx index ee89226..86555a7 100644 --- a/components/database/edit-item-drawer.tsx +++ b/components/database/edit-item-drawer.tsx @@ -65,8 +65,8 @@ export function EditItemDrawer({ table, item, apiClient, open, onClose, onItemUp return ( - - + +
@@ -79,11 +79,11 @@ export function EditItemDrawer({ table, item, apiClient, open, onClose, onItemUp Edit record in {table.name} table - -
+ +
{table.fields?.map((field) => ( -
-
- -
+ +
diff --git a/components/database/table-config-drawer.tsx b/components/database/table-config-drawer.tsx index 9c40b18..7c3580d 100644 --- a/components/database/table-config-drawer.tsx +++ b/components/database/table-config-drawer.tsx @@ -18,6 +18,7 @@ import { import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { ScrollArea } from "@/components/ui/scroll-area" +import { Textarea } from "@/components/ui/textarea" import type { ApiClient, TableMetadata } from "@/lib/api" interface TableConfigDrawerProps { @@ -113,8 +114,8 @@ export function TableConfigDrawer({ table, apiClient, open, onClose, onTableUpda return ( - - + +
@@ -127,87 +128,93 @@ export function TableConfigDrawer({ table, apiClient, open, onClose, onTableUpda Manage table schema and access control rules - - - - Schema - Access Rules - + +
+ + + Schema + Access Rules + - -
-
-

Table Structure

-

Modify columns and their properties

+ +
+
+

Table Structure

+

Modify columns and their properties

+
+ {table.type !== "view" && ( + + )}
- {table.type !== "view" && ( - - )} -
- {table.type === "view" ? ( -
-
SQL Query
-
-                    {table.sql}
-                  
-
- ) : ( -
- {columns.map((column, index) => { - const isSystem = isSystemColumn(column.name) - return ( -
-
- updateColumn(index, "name", e.target.value)} - disabled={isSystem} - className={`flex-1 ${isSystem ? "bg-muted" : ""}`} - /> - {isSystem && ( - - System - - )} - -
+ {table.type === "view" ? ( +
+
SQL Query
+
+                      {table.sql}
+                    
+
+ ) : ( +
+ {columns.map((column, index) => { + const isSystem = isSystemColumn(column.name) + return ( +
+
+
+ +
+ updateColumn(index, "name", e.target.value)} + disabled={isSystem} + className={`flex-1 ${isSystem ? "bg-muted" : ""}`} + /> + {isSystem && ( + + System + + )} +
+
+
+ + +
+
+ +
+
-
- - -
+
-
@@ -230,7 +237,7 @@ export function TableConfigDrawer({ table, apiClient, open, onClose, onTableUpda disabled={isSystem} className="rounded" /> -
@@ -243,7 +250,7 @@ export function TableConfigDrawer({ table, apiClient, open, onClose, onTableUpda disabled={isSystem} className="rounded" /> -
@@ -256,121 +263,142 @@ export function TableConfigDrawer({ table, apiClient, open, onClose, onTableUpda disabled={isSystem} className="rounded" /> -
-
- ) - })} -
- )} - - {table.type !== "view" && ( -
-

- - System - - System columns are automatically managed and cannot be modified. -

-
- )} - - - -
-

Access Control Rules

-
-
- - setRules({ ...rules, list: e.target.value })} - /> -

Controls who can list records

+ ) + })}
+ )} -
- - setRules({ ...rules, get: e.target.value })} - /> -

Controls who can view individual records

-
- - {table.type !== "view" && ( - <> -
- - setRules({ ...rules, add: e.target.value })} - /> -

Controls who can create new records

-
- -
- - setRules({ ...rules, update: e.target.value })} - /> -

Controls who can update records

-
- -
- - setRules({ ...rules, delete: e.target.value })} - /> -

Controls who can delete records

-
- - )} -
- -
-
Rule Examples
-
+ {table.type !== "view" && ( +

- "" - Admin access only -

-

- "True" - Public access -

-

- "auth.id != None" - Authenticated users only -

-

- "auth.id == record.user_id" - Owner access only -

-

- "auth.role == \"admin\"" - Admin role required + + System + + System columns are automatically managed and cannot be modified.

+ )} + + + +
+

Access Control Rules

+
+
+ +