Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: optimize schema editor ui (#20650)
ecmadao1dfa6b2987c3
diff --git a/frontend/src/react/components/SchemaEditorLite/Panels/DatabaseEditor.tsx b/frontend/src/react/components/SchemaEditorLite/Panels/DatabaseEditor.tsxindex e98a26e5bd..79b27cbe2f 100644--- a/frontend/src/react/components/SchemaEditorLite/Panels/DatabaseEditor.tsx+++ b/frontend/src/react/components/SchemaEditorLite/Panels/DatabaseEditor.tsx@@ -112,6 +112,7 @@ export function DatabaseEditor({value={selectedSchemaName ?? ""}onChange={(val) => onSelectedSchemaNameChange(val as string)}options={schemaOptions}+ size="sm"className="w-48"/>)}@@ -119,11 +120,12 @@ export function DatabaseEditor({<Buttonvariant="outline"size="sm"+ className="gap-1.5"onClick={() => {// Will be wired to TableNameDialog in T22}}>- <Plus className="mr-1 size-4" />+ <Plus className="size-4" />{t("schema-editor.actions.create-table")}</Button>)}diff --git a/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/DataTypeCell.tsx b/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/DataTypeCell.tsxindex c1d5aba49e..2a8ef0dec2 100644--- a/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/DataTypeCell.tsx+++ b/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/DataTypeCell.tsx@@ -3,6 +3,7 @@ import { Input } from "@/react/components/ui/input";import type { Engine } from "@/types/proto-es/v1/common_pb";import type { ColumnMetadata } from "@/types/proto-es/v1/database_service_pb";import { getDataTypeSuggestionList } from "@/utils";+import { INLINE_EDIT_INPUT_CLASS } from "../common";interface Props {column: ColumnMetadata;@@ -26,7 +27,7 @@ export function DataTypeCell({disabled={isReadonly}placeholder="column type"size="xs"- className="border-none bg-transparent shadow-none focus-visible:ring-1"+ className={INLINE_EDIT_INPUT_CLASS}onChange={(e) => onUpdateValue(e.target.value)}/>);diff --git a/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/DefaultValueCell.tsx b/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/DefaultValueCell.tsxindex 2a9052044e..b41fcf8b32 100644--- a/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/DefaultValueCell.tsx+++ b/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/DefaultValueCell.tsx@@ -2,6 +2,7 @@ import { useCallback } from "react";import { useTranslation } from "react-i18next";import { Input } from "@/react/components/ui/input";import type { ColumnMetadata } from "@/types/proto-es/v1/database_service_pb";+import { INLINE_EDIT_INPUT_CLASS } from "../common";interface DefaultValue {hasDefault: boolean;@@ -33,7 +34,7 @@ export function DefaultValueCell({ column, disabled, onUpdate }: Props) {disabled={disabled}placeholder={t("schema-editor.default.placeholder")}size="xs"- className="border-none bg-transparent shadow-none focus-visible:ring-1"+ className={INLINE_EDIT_INPUT_CLASS}onChange={(e) => handleChange(e.target.value)}/>);diff --git a/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.tsx b/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.tsxindex 60c30482fe..ea5c8b6848 100644--- a/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.tsx+++ b/frontend/src/react/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.tsx@@ -26,7 +26,7 @@ import {removeColumnPrimaryKey,upsertColumnPrimaryKey,} from "../../core/edit";-import { markUUID } from "../common";+import { INLINE_EDIT_INPUT_CLASS, markUUID } from "../common";import { DataTypeCell, DataTypeSuggestionsDatalist } from "./DataTypeCell";import { DefaultValueCell } from "./DefaultValueCell";@@ -198,10 +198,10 @@ export function TableColumnEditor({);const datalistId = `schema-editor-types-${engine}`;- // Compact override for table cells: reduce default px-4 py-3 padding so each- // row hugs the inline editor heights instead of doubling them.- const cellClass = "px-2 py-1";- const headClass = "h-8 px-2 py-1 whitespace-nowrap";+ // Use the shared Table defaults (px-4 py-3 cells, h-10 headers) so this grid+ // matches the table-list grid. Headers only add whitespace-nowrap.+ const cellClass = "";+ const headClass = "whitespace-nowrap";return (<div className="size-full overflow-auto">@@ -268,7 +268,7 @@ export function TableColumnEditor({value={column.name}disabled={disabled}size="xs"- className="border-none bg-transparent shadow-none enabled:hover:bg-control-bg/60 focus-visible:ring-1"+ className={INLINE_EDIT_INPUT_CLASS}onChange={(e) =>handleColumnNameChange(column, e.target.value)}@@ -295,7 +295,7 @@ export function TableColumnEditor({value={column.comment}disabled={disabled}size="xs"- className="border-none bg-transparent shadow-none enabled:hover:bg-control-bg/60 focus-visible:ring-1"+ className={INLINE_EDIT_INPUT_CLASS}onChange={(e) =>handleCommentChange(column, e.target.value)}diff --git a/frontend/src/react/components/SchemaEditorLite/Panels/TableEditor.tsx b/frontend/src/react/components/SchemaEditorLite/Panels/TableEditor.tsxindex 1ab4461728..7e02ab4bce 100644--- a/frontend/src/react/components/SchemaEditorLite/Panels/TableEditor.tsx+++ b/frontend/src/react/components/SchemaEditorLite/Panels/TableEditor.tsx@@ -176,28 +176,30 @@ export function TableEditor({<div className="flex size-full flex-col gap-y-2 overflow-y-hidden pt-2">{/* Toolbar */}<div className="flex items-center gap-x-2 px-4">- <SegmentedControl- value={mode}- options={modeOptions}- onValueChange={setMode}- ariaLabel={t("schema-editor.self")}- size="sm"- />+ {modeOptions.length > 1 && (+ <SegmentedControl+ value={mode}+ options={modeOptions}+ onValueChange={setMode}+ ariaLabel={t("schema-editor.self")}+ size="sm"+ />+ )}{addAction && (<Buttonvariant="outline"size="sm"- className="ml-auto"+ className="gap-1.5"onClick={addAction.onClick}>- <Plus className="mr-1 size-4" />+ <Plus className="size-4" />{addAction.label}</Button>)}</div>{/* Content */}- <div className="flex-1 overflow-y-hidden px-4">+ <div className="flex-1 overflow-y-hidden">{mode === "COLUMNS" && (<TableColumnEditordb={db}diff --git a/frontend/src/react/components/SchemaEditorLite/Panels/TableList/TableList.tsx b/frontend/src/react/components/SchemaEditorLite/Panels/TableList/TableList.tsxindex c2385487da..979ff0126b 100644--- a/frontend/src/react/components/SchemaEditorLite/Panels/TableList/TableList.tsx+++ b/frontend/src/react/components/SchemaEditorLite/Panels/TableList/TableList.tsx@@ -2,6 +2,7 @@ import { RotateCcw, Trash2 } from "lucide-react";import { useCallback, useMemo } from "react";import { useTranslation } from "react-i18next";import { Button } from "@/react/components/ui/button";+import { Input } from "@/react/components/ui/input";import {Table,TableBody,@@ -18,6 +19,7 @@ import type {TableMetadata,} from "@/types/proto-es/v1/database_service_pb";import { useSchemaEditorContext } from "../../context";+import { INLINE_EDIT_INPUT_CLASS } from "../common";interface Props {db: Database;@@ -73,6 +75,16 @@ export function TableList({[editStatus, db, schema]);+ const handleCommentChange = useCallback(+ (table: TableMetadata, comment: string) => {+ table.comment = comment;+ if (getStatus(table) === "normal") {+ editStatus.markEditStatus(db, { schema, table }, "updated");+ }+ },+ [getStatus, editStatus, db, schema]+ );+if (filteredTables.length === 0) {return (<div className="flex size-full items-center justify-center py-8 text-sm text-control-light">@@ -113,8 +125,21 @@ export function TableList({onClick={() => onEditTable(table)}><TableCell className="font-medium">{table.name}</TableCell>- <TableCell className="text-control-light">- {table.comment || "—"}+ <TableCell+ className="text-control-light"+ onClick={(e) => e.stopPropagation()}+ >+ {readonly ? (+ table.comment || "—"+ ) : (+ <Input+ value={table.comment}+ disabled={status === "dropped"}+ size="xs"+ className={INLINE_EDIT_INPUT_CLASS}+ onChange={(e) => handleCommentChange(table, e.target.value)}+ />+ )}</TableCell>{!readonly && (<TableCell className="text-right">diff --git a/frontend/src/react/components/SchemaEditorLite/Panels/common.ts b/frontend/src/react/components/SchemaEditorLite/Panels/common.tsindex c8e3ceb074..4fd7344208 100644--- a/frontend/src/react/components/SchemaEditorLite/Panels/common.ts+++ b/frontend/src/react/components/SchemaEditorLite/Panels/common.ts@@ -1,6 +1,16 @@import { v1 as uuidv1 } from "uuid";import type { EditStatus } from "../types";+// Inline-edit affordance for table-grid cells. The input carries a subtle+// resting border so users can immediately tell the cell is an editable field+// (a hover-only border was too hard to discover). The border darkens on hover+// and turns accent on focus. `text-sm` overrides the smaller font from the+// `size="xs"` input variant so inline-edit cells match the table's default+// plain-text cells (also text-sm), and `h-8 px-3` overrides the cramped+// `h-6 px-2` from that variant for roomier padding inside the field.+export const INLINE_EDIT_INPUT_CLASS =+ "h-8 border border-control-border/50 bg-transparent px-3 text-sm shadow-none enabled:hover:border-control-border focus-visible:border-accent focus-visible:ring-1";+interface ObjectWithHiddenProps {__uuid?: string;__status_before_drop?: EditStatus;diff --git a/frontend/src/react/components/SchemaEditorLite/TabsContainer.tsx b/frontend/src/react/components/SchemaEditorLite/TabsContainer.tsxindex ab7ef79bbb..b4d10936bd 100644--- a/frontend/src/react/components/SchemaEditorLite/TabsContainer.tsx+++ b/frontend/src/react/components/SchemaEditorLite/TabsContainer.tsx@@ -32,8 +32,8 @@ export function TabsContainer() {if (tabList.length === 0) return null;return (- <div className="flex items-center justify-between border-b border-control-border">- <div className="flex flex-1 items-center gap-x-1 overflow-x-auto px-1 py-1 scrollbar-hide">+ <div className="flex items-stretch border-b border-control-border">+ <div className="flex flex-1 items-stretch overflow-x-auto scrollbar-hide">{tabList.map((tab) => {const isActive = tab.id === currentTab?.id;const status = getTabStatus(tab, editStatus);@@ -42,10 +42,10 @@ export function TabsContainer() {key={tab.id}ref={isActive ? activeTabRef : undefined}className={cn(- "group flex w-40 shrink-0 cursor-pointer items-center gap-x-1 rounded-xs px-2 py-1 text-xs transition-colors",+ "flex h-9 w-40 shrink-0 cursor-pointer items-center gap-x-2 border-r border-t border-control-border pl-2 pr-1 text-xs transition-colors",isActive- ? "bg-control-bg-hover text-control"- : "text-control-light hover:bg-control-bg-hover",+ ? "border-t-[3px] border-t-accent bg-accent/10 pt-0.5 text-accent"+ : "border-t-transparent pt-1 text-control-light hover:bg-control-bg",status === "dropped" && "text-error line-through",status === "created" && "text-success",status === "updated" && "text-warning"@@ -55,13 +55,13 @@ export function TabsContainer() {<TabIcon type={tab.type} /><EllipsisText text={getTabName(tab)} className="flex-1" /><button- className="ml-auto hidden size-4 shrink-0 items-center justify-center rounded-xs hover:bg-control-border group-hover:flex"+ className="block size-5 shrink-0 rounded-xs p-0.5 text-control-light transition-colors hover:bg-control-bg hover:text-control"onClick={(e) => {e.stopPropagation();closeTab(tab.id);}}>- <X className="size-3" />+ <X className="size-full" /></button></div>);