Skip to content

Add duplicate row and insert current time via context menu#159

Merged
debba merged 2 commits intoTabularisDB:mainfrom
thomaswasle:feature/improved-inserts-context-menu
May 4, 2026
Merged

Add duplicate row and insert current time via context menu#159
debba merged 2 commits intoTabularisDB:mainfrom
thomaswasle:feature/improved-inserts-context-menu

Conversation

@thomaswasle
Copy link
Copy Markdown
Contributor

Summary

  • Add Duplicate Row to the table context menu: right-clicking any row and selecting
    "Duplicate Row" creates a new pending insertion pre-filled with all values from the source row.
    Auto-increment / serial columns are cleared so the database generates a fresh key on commit.
  • Add Insert Current Timestamp to the cell context menu: right-clicking a DATE, TIME,
    DATETIME, TIMESTAMP (or equivalent) column shows a new "Insert Current Timestamp" option that
    fetches the current date/time from the database server (not the client) and writes it into
    the cell, formatted to match the column type.

Changes

Backend

  • New Tauri command get_server_now(connection_id) in commands.rs — executes SELECT NOW()
    for MySQL/PostgreSQL and SELECT datetime('now', 'localtime') for SQLite, returning the raw
    timestamp string.
  • Command registered in lib.rs.

Frontend

  • DataGrid.tsx: duplicateSelectedRow callback copies row data (existing or pending insertion)
    and calls the new onDuplicateRow prop. setCellServerNow callback invokes get_server_now,
    parses the result with parseDateTime, and formats it via formatDateTime to match the column's
    date mode before writing through onPendingChange / onPendingInsertionChange. The "Insert
    Current Timestamp" menu item is only shown when the right-clicked column resolves to a date/time
    type.
  • Editor.tsx: handleDuplicateRow creates a new pending insertion from the provided row data
    (auto-increment columns nulled out). Prop wired into <DataGrid>.
  • All new menu items translated into all five supported locales (en, de, fr, es, zh).

thomaswasle and others added 2 commits May 3, 2026 07:26
Resolve conflicts in src/components/ui/DataGrid.tsx and src/pages/Editor.tsx
by combining the duplicate-row / insert-server-now context menu items from
this branch with the multi-row deletion support added on main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@debba debba merged commit cd5c05c into TabularisDB:main May 4, 2026
1 check passed
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.

2 participants