Skip to content

feat(datagrid): add Add button to status bar to insert a new row#1705

Merged
datlechin merged 2 commits into
TableProApp:mainfrom
desperadoxhy:feature/insert-record-button
Jun 17, 2026
Merged

feat(datagrid): add Add button to status bar to insert a new row#1705
datlechin merged 2 commits into
TableProApp:mainfrom
desperadoxhy:feature/insert-record-button

Conversation

@desperadoxhy

Copy link
Copy Markdown
Contributor

Summary

Adds an Add button to the table status bar, to the left of the Columns button. Clicking it appends a new empty row at the end of the grid and starts inline editing the first cell. Matches the Navicat-style insert-in-place interaction.

Why

Today you can only add a row via the Edit menu (Cmd+Shift+N), double-clicking the grid's empty area, or the empty-space right-click menu. None of those are discoverable from the status bar, which is where users look for grid actions. A dedicated button makes the most common data-entry action obvious.

What changed

  • MainStatusBarView: a plus + "Add" button, shown only in Data view mode when the current table is editable (not a view, not read-only, not write-blocked by safe mode, has a table name). Hover shows Add Row (Cmd+Shift+N).
  • MainEditorContentView: wires the button to the existing onAddRow closure via currentTabAllowsAddRow.
  • CHANGELOG.md: one line under [Unreleased] > Added.

How it works

The button calls coordinator.addNewRow(), which is the same path as the menu item and the existing shortcuts. No new core logic:

  • RowOperationsManager.addNewRow builds the row (DEFAULT sentinel for columns with defaults, NULL otherwise), appends it, and records the change.
  • beginEditing(displayRow:column:0) moves focus into the first cell.
  • On save, type mismatches (e.g. text in an integer column) are reported by the database via the existing inline error banner and alert sheet, and the transaction rolls back. This reuses the existing feedback path, consistent with delete/duplicate.

The change is purely SwiftUI wiring. The underlying add-row logic is unchanged and already covered by RowOperationsManagerTests and the change-tracking tests.

Verification

  • xcodebuild ... build -skipPackagePluginValidation with CODE_SIGNING_ALLOWED=NO passes (** BUILD SUCCEEDED **).
  • Manually verified against a SQLite table: the Add button appears in Data view left of Columns; clicking it appends a row at the end and enters edit on the first cell; filling invalid data in a typed column and saving shows the database error and rolls back. The button is absent in Structure/JSON mode and for read-only tables.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Before we can merge this PR, you need to sign our Contributor License Agreement.

To sign, please comment below with:

I have read the CLA Document and I hereby sign the CLA.


I have read the CLA Document and I hereby sign the CLA.


xuhengyu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@desperadoxhy

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA.

@datlechin datlechin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you.

@datlechin datlechin merged commit f2384b2 into TableProApp:main Jun 17, 2026
2 of 3 checks 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