The data grid header only showed column names, and column types were available only via tableMeta (open-table view). Arbitrary query results (e.g. `select * from pg_depend`) therefore showed no type at all, which is exactly the case the reporter hit. Backend: add `column_types` to QueryResult (serde-default, backward compatible) and populate it for the native drivers where the type is readily available — PostgreSQL, MySQL, SQL Server, ClickHouse. Other drivers leave it empty for now (no behavior change); schemaless stores (Mongo/Redis/ES) have no column types. Frontend: render a type row under each column name in the grid header, color-coded by type. The type is resolved from tableMeta first (richer, includes precision) and falls back to the query result's column_types by index. Add a `showColumnTypesInHeader` setting (default on) and keep the msgpack tab-result cache compatible. The source-selection logic is extracted to lib/dataGridColumnType.ts with unit tests. Co-authored-by: vrustx <vrustx@vrustxdeMac-mini.local> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
23 files changed
+284
-2
No files matched your search
@@ -246,6 +246,7 @@ export interface EditorSettings {
|
||||
redisScanPageSize: number;
|
||||
mongoViewMode: "document" | "table";
|
||||
showColumnCommentsInHeader: boolean;
|
||||
showColumnTypesInHeader: boolean;
|
||||
compactColumnHeaderActions: boolean;
|
||||
dataGridRenderMode: DataGridRenderMode;
|
||||
structureEditorDensity: StructureEditorDensity;
|
||||
@@ -311,6 +312,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
|
||||
redisScanPageSize: 1000,
|
||||
mongoViewMode: "document",
|
||||
showColumnCommentsInHeader: false,
|
||||
showColumnTypesInHeader: true,
|
||||
compactColumnHeaderActions: true,
|
||||
dataGridRenderMode: "canvas",
|
||||
structureEditorDensity: "compact",
|
||||
@@ -466,6 +468,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
|
||||
mongoViewMode: settings.mongoViewMode === "table" ? "table" : DEFAULT_EDITOR_SETTINGS.mongoViewMode,
|
||||
showColumnCommentsInHeader:
|
||||
settings.showColumnCommentsInHeader ?? DEFAULT_EDITOR_SETTINGS.showColumnCommentsInHeader,
|
||||
showColumnTypesInHeader: settings.showColumnTypesInHeader ?? DEFAULT_EDITOR_SETTINGS.showColumnTypesInHeader,
|
||||
compactColumnHeaderActions:
|
||||
settings.compactColumnHeaderActions ?? DEFAULT_EDITOR_SETTINGS.compactColumnHeaderActions,
|
||||
dataGridRenderMode: normalizeDataGridRenderMode(settings.dataGridRenderMode),
|
||||
@@ -648,6 +651,8 @@ export const useSettingsStore = defineStore("settings", () => {
|
||||
if (partial.mongoViewMode !== undefined) editorSettings.value.mongoViewMode = partial.mongoViewMode;
|
||||
if (partial.showColumnCommentsInHeader !== undefined)
|
||||
editorSettings.value.showColumnCommentsInHeader = partial.showColumnCommentsInHeader;
|
||||
if (partial.showColumnTypesInHeader !== undefined)
|
||||
editorSettings.value.showColumnTypesInHeader = partial.showColumnTypesInHeader;
|
||||
if (partial.compactColumnHeaderActions !== undefined)
|
||||
editorSettings.value.compactColumnHeaderActions = partial.compactColumnHeaderActions;
|
||||
if (partial.dataGridRenderMode !== undefined)
|
||||
|
||||
Reference in new issue
Block a user