Skip to content

Feat/customizable result colors#354

Open
GabrielMalava wants to merge 6 commits into
TabularisDB:mainfrom
GabrielMalava:feat/customizable-result-colors
Open

Feat/customizable result colors#354
GabrielMalava wants to merge 6 commits into
TabularisDB:mainfrom
GabrielMalava:feat/customizable-result-colors

Conversation

@GabrielMalava

Copy link
Copy Markdown
Contributor

This PR adds two improvements to the data experience:

  1. Customizable result colors by data type: color query result values
    (numbers, text, dates, booleans) instead of rendering everything in a
    single color.
  2. Better in-place editing: save pending grid edits with Cmd/Ctrl+S and
    make editing single-table SELECT results reliable.

1. Result colors by data type

You can now colorize query result cells based on their data type, with full
control over the colors.

  • New Result Colors section under Settings → Appearance → General.
  • Toggle to enable/disable colorization (off by default — values render as
    before).
  • A color picker per type: Number, Text, Date/Time, Boolean, with a live
    preview and a "Reset to theme" button per type.
  • Defaults follow the active theme's semantic colors; user overrides are saved
    in the app config and applied on top of any theme.
  • Colors are applied only to plain data cells — edited/inserted/deleted rows
    and NULL keep their existing styling.

2. Editing improvements

Save with Cmd/Ctrl+S

  • New save_grid_changes shortcut commits the active tab's pending changes,
    like TablePlus. It's rebindable and listed under Settings → Keyboard
    Shortcuts
    .

Editable single-table SELECT results

  • Editing query results is now validated against the table's real columns
    before building the UPDATE.
  • Editing an aliased/computed column shows a clear message instead of failing
    with a cryptic 1054 Unknown column error.
  • If the primary key is missing from the result set, editing is blocked with
    guidance to include it (needed for a safe WHERE clause).
  • Unsafe-to-edit queries (JOIN, DISTINCT, aggregates, UNION, subqueries,
    views) remain read-only, as before.

);
return;
}
if (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: PK check is nested inside the columnMetadata conditional

The primary-key presence check is inside the if (columnMetadata && columnMetadata.length > 0) block. When columnMetadata is unavailable (e.g., some drivers don't provide result metadata), this check is skipped entirely. Users experience the old silent-failure behavior instead of the helpful alert added by this PR.

The PK check depends only on pkColumn and columns, both of which are always available. Move it outside the columnMetadata block so it runs consistently for all existing rows.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread src/utils/dataGrid.ts Outdated
const t = columnType.toLowerCase();
if (/bool|^bit/.test(t)) return "boolean";
if (/date|time|timestamp|year/.test(t)) return "date";
if (/int|serial|float|double|decimal|numeric|real|money|number|fixed/.test(t))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Number type regex matches non-numeric types

The regex /int|serial|float|double|decimal|numeric|real|money|number|fixed/ matches any substring, so PostgreSQL types like interval and inet are incorrectly colored as numbers.

Use a stricter pattern with word boundaries to avoid matching substrings:

Suggested change
if (/int|serial|float|double|decimal|numeric|real|money|number|fixed/.test(t))
if (/\bint(?:eger)?(?:\d+)?\b|serial|float|double|decimal|numeric|real|money|number|fixed/.test(t))

Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread src/i18n/locales/en.json Outdated
"date": "Date / Time",
"boolean": "Boolean",
"reset": "Reset to theme",
"custom": "Custom",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Unused i18n key

The "custom" key is not referenced anywhere in ResultColorsSection.tsx. Consider removing it to keep translations clean.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread src/i18n/locales/en.json Outdated
"boolean": "Boolean",
"reset": "Reset to theme",
"custom": "Custom",
"previewLabel": "Preview",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Unused i18n key

The "previewLabel" key is not referenced anywhere in ResultColorsSection.tsx. Consider removing it to keep translations clean.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

);
return;
}
if (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: PK check is nested inside the columnMetadata conditional

The primary-key presence check is inside the if (columnMetadata && columnMetadata.length > 0) block. When columnMetadata is unavailable (e.g., some drivers don't provide result metadata), this check is skipped entirely. Users experience the old silent-failure behavior instead of the helpful alert added by this PR.

The PK check depends only on pkColumn and columns, both of which are always available. Move it outside the columnMetadata block so it runs consistently for all existing rows.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread src/utils/dataGrid.ts Outdated
Comment thread src/i18n/locales/en.json Outdated
"date": "Date / Time",
"boolean": "Boolean",
"reset": "Reset to theme",
"custom": "Custom",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Unused i18n key

The "custom" key is not referenced anywhere in ResultColorsSection.tsx. Consider removing it to keep translations clean.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread src/i18n/locales/en.json Outdated
"boolean": "Boolean",
"reset": "Reset to theme",
"custom": "Custom",
"previewLabel": "Preview",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Unused i18n key

The "previewLabel" key is not referenced anywhere in ResultColorsSection.tsx. Consider removing it to keep translations clean.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

All issues from the previous review have been resolved in the latest commits:

  • DataGrid.tsx — PK check now runs independently of columnMetadata, fixing the silent no-op when drivers omit result metadata.
  • dataGrid.ts — Number type regex now uses \b word boundaries for integer types, correctly preventing interval and inet from matching.
  • en.json — Unused translation keys (custom, previewLabel) removed.
Files Reviewed (3 incremental + 14 unchanged)

Changed (all issues fixed):

  • src/components/ui/DataGrid.tsx
  • src/utils/dataGrid.ts
  • src/i18n/locales/en.json

Unchanged (no issues):

  • src-tauri/src/config.rs
  • src/App.tsx
  • src/components/settings/AppearanceTab.tsx
  • src/components/settings/ResultColorsSection.tsx
  • src/components/ui/DataGridRow.tsx
  • src/config/shortcuts.json
  • src/contexts/SettingsContext.ts
  • src/hooks/useResultTypeColors.ts
  • src/index.css
  • src/pages/Editor.tsx
  • src/utils/dataGridCell.tsx
Previous Review Summary (commit f664cd8)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit f664cd8)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
src/components/ui/DataGrid.tsx 510 PK check is nested inside columnMetadata conditional — skipped when metadata is unavailable
src/utils/dataGrid.ts 103 Number type regex matches substrings, misclassifying interval and inet as numbers

SUGGESTION

File Line Issue
src/i18n/locales/en.json 335 Unused i18n key "custom" — not referenced in ResultColorsSection.tsx
src/i18n/locales/en.json 336 Unused i18n key "previewLabel" — not referenced in ResultColorsSection.tsx
Files Reviewed (14 files)
  • src-tauri/src/config.rs — config fields merged correctly, no issues
  • src/App.tsx — hook usage correct, no issues
  • src/components/settings/AppearanceTab.tsx — integration correct, no issues
  • src/components/settings/ResultColorsSection.tsx — new component, no issues
  • src/components/ui/DataGrid.tsx — 1 issue (PK check nesting)
  • src/components/ui/DataGridRow.tsx — color class fallback logic correct, no issues
  • src/config/shortcuts.json — new shortcut definition correct, no issues
  • src/contexts/SettingsContext.ts — new settings fields correct, no issues
  • src/hooks/useResultTypeColors.ts — CSS variable management correct, no issues
  • src/i18n/locales/en.json — 2 issues (unused translation keys)
  • src/index.css — new utility classes correct, no issues
  • src/pages/Editor.tsx — keyboard shortcut handler correct, no issues
  • src/utils/dataGrid.ts — 1 issue (type classification regex)
  • src/utils/dataGridCell.tsx — wrapper logic correct, no issues

Fix these issues in Kilo Cloud


Reviewed by kimi-k2.6-20260420 · Input: 46.6K · Output: 6.5K · Cached: 111.1K

@kilo-code-bot

kilo-code-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
src/components/ui/DataGrid.tsx 510 PK check is nested inside columnMetadata conditional — skipped when metadata is unavailable
src/utils/dataGrid.ts 103 Number type regex matches substrings, misclassifying interval and inet as numbers

SUGGESTION

File Line Issue
src/i18n/locales/en.json 335 Unused i18n key "custom" — not referenced in ResultColorsSection.tsx
src/i18n/locales/en.json 336 Unused i18n key "previewLabel" — not referenced in ResultColorsSection.tsx
Files Reviewed (14 files)
  • src-tauri/src/config.rs — config fields merged correctly, no issues
  • src/App.tsx — hook usage correct, no issues
  • src/components/settings/AppearanceTab.tsx — integration correct, no issues
  • src/components/settings/ResultColorsSection.tsx — new component, no issues
  • src/components/ui/DataGrid.tsx — 1 issue (PK check nesting)
  • src/components/ui/DataGridRow.tsx — color class fallback logic correct, no issues
  • src/config/shortcuts.json — new shortcut definition correct, no issues
  • src/contexts/SettingsContext.ts — new settings fields correct, no issues
  • src/hooks/useResultTypeColors.ts — CSS variable management correct, no issues
  • src/i18n/locales/en.json — 2 issues (unused translation keys)
  • src/index.css — new utility classes correct, no issues
  • src/pages/Editor.tsx — keyboard shortcut handler correct, no issues
  • src/utils/dataGrid.ts — 1 issue (type classification regex)
  • src/utils/dataGridCell.tsx — wrapper logic correct, no issues

Fix these issues in Kilo Cloud

GabrielMalava and others added 3 commits June 22, 2026 15:42
Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant