feat: add Copy as JSON for selected rows#331
Merged
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis pull request introduces a new feature enabling users to copy selected database rows as JSON format. It adds a JSON conversion utility, integrates it into both the application menu and row context menu, and includes comprehensive test coverage for the conversion logic. Changes
Sequence DiagramsequenceDiagram
actor User
participant Menu as Menu/Context Menu
participant Actions as MainContentCommandActions
participant Coordinator as MainContentCoordinator
participant GridCoord as TableViewCoordinator
participant Converter as JsonRowConverter
participant Clipboard as Clipboard
User->>Menu: Click "Copy as JSON"
Menu->>Actions: copySelectedRowsAsJson()
Actions->>Coordinator: copySelectedRowsAsJson(indices)
alt Main Content View
Coordinator->>Coordinator: Validate tab & indices
Coordinator->>Coordinator: Build row dictionaries
Coordinator->>Converter: init(columns, columnTypes)
Coordinator->>Converter: generateJson(rows)
Converter->>Converter: Format values by type
Converter->>Converter: Escape strings & validate JSON
Converter-->>Coordinator: JSON string
Coordinator->>Clipboard: Write JSON
else Results Grid View
User->>Menu: Click context menu
Menu->>GridCoord: copyRowsAsJson(indices)
GridCoord->>Converter: init(columns, columnTypes)
GridCoord->>Converter: generateJson(rows)
Converter-->>GridCoord: JSON string
GridCoord->>Clipboard: Write JSON
end
Clipboard-->>User: JSON copied
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
true/false, nulls asnull, valid JSON columns embedded verbatim, blobs as base64Closes #325
Test plan
nullin JSONtrue/falseJsonRowConverterTests→ all 20 tests passSummary by CodeRabbit
Release Notes
New Features
Tests