Skip to content

feat: connection groups with multi-selection and hierarchical management#140

Open
imhuytq wants to merge 19 commits intodatlechin:mainfrom
imhuytq:feat/connection-groups
Open

feat: connection groups with multi-selection and hierarchical management#140
imhuytq wants to merge 19 commits intodatlechin:mainfrom
imhuytq:feat/connection-groups

Conversation

@imhuytq
Copy link
Contributor

@imhuytq imhuytq commented Mar 2, 2026

Summary

Adds a hierarchical connection groups system to the welcome window, letting users organize database connections into named, color-coded folders with arbitrary nesting depth.

Core features

  • Hierarchical groups: create nested folders with color-coded icons to organize connections
  • NSOutlineView: replaces SwiftUI List with NSOutlineView for native tree view, expand/collapse, and drag-and-drop
  • Multi-selection: select multiple connections for bulk delete, bulk move to group, and multi-drag into groups
  • Drag-and-drop: reorder connections and groups within/across groups, move connections between groups (single and multi), with position-aware drop
  • Keyboard shortcuts: Backspace to delete selected items, Return to connect/toggle
  • 2-step delete confirmation: deleting a group with connections requires two confirmations to prevent accidental data loss
  • Expand/collapse persistence: group expanded state persists across app launches
  • Context menus: full context menu support for groups (new subgroup, edit, delete) and connections (connect, edit, duplicate, copy URL, move to group, delete)

Data model changes

  • ConnectionGroup: new model with parentGroupId for nesting, sortOrder, and color
  • DatabaseConnection.sortOrder: new field for stable ordering within groups
  • GroupStorage: CRUD, hierarchy helpers, expanded state persistence, descendant deletion with connection cleanup
  • Legacy migration: auto-assigns sequential sortOrder when upgrading from older versions without ordering

Storage behavior

  • Deleting a group deletes all connections inside (not ungroup)
  • ConnectionStorage.duplicateConnection preserves all fields and inserts right after the original
  • ConnectionFormView preserves sortOrder when editing existing connections

UI/UX details

  • Selection managed natively by NSOutlineView (no SwiftUI state overhead)
  • Scroll position and expanded state preserved across data reloads
  • Multi-group drag disabled (moving parent already moves children)
  • Empty state overlay allows context menu on empty list
  • Group form sheet loads groups once on appear (not on every recompute)

@chatgpt-codex-connector
Copy link

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.

@imhuytq imhuytq force-pushed the feat/connection-groups branch from c3497e9 to e00e14e Compare March 2, 2026 11:34
@datlechin
Copy link
Owner

Run bị lỗi rồi anh ơi

/Users/ngoquocdat/Projects/TablePro/TablePro/Models/DatabaseConnection.swift
/Users/ngoquocdat/Projects/TablePro/TablePro/Models/DatabaseConnection.swift:239:8 Type 'DatabaseConnection' does not conform to protocol 'Hashable'

/Users/ngoquocdat/Projects/TablePro/TablePro/Models/DatabaseConnection.swift:239:8 Type 'DatabaseConnection' does not conform to protocol 'Equatable'

/Users/ngoquocdat/Projects/TablePro/TablePro/Models/DatabaseConnection.swift:256:9 Invalid redeclaration of 'groupId'

/Users/ngoquocdat/Projects/TablePro/TablePro/Models/DatabaseConnection.swift:276:9 Invalid redeclaration of 'groupId'

/Users/ngoquocdat/Projects/TablePro/TablePro/Models/DatabaseConnection.swift:313:1 Type 'DatabaseConnection' does not conform to protocol 'Decodable'

/Users/ngoquocdat/Projects/TablePro/TablePro/Models/DatabaseConnection.swift:313:1 Type 'DatabaseConnection' does not conform to protocol 'Encodable'

@imhuytq
Copy link
Contributor Author

imhuytq commented Mar 4, 2026

@datlechin please review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a hierarchical “connection groups” feature to the welcome window, enabling nested folders for organizing database connections with expand/collapse persistence and drag-and-drop reordering.

Changes:

  • Replaces the SwiftUI List connection list with an NSOutlineView-backed tree view that supports nesting, drag/drop, and context menus.
  • Introduces a reusable group create/edit sheet and updates group pickers to support nested group selection.
  • Extends storage/models to support group hierarchy (parentGroupId), ordering (sortOrder), and persisted expanded state.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
TablePro/Views/WelcomeWindowView.swift Integrates group CRUD + expand state and swaps in the outline-based connection list.
TablePro/Views/WelcomeWindow/ConnectionOutlineView.swift New NSOutlineView wrapper implementing hierarchy rendering, drag/drop reorder, and context menus.
TablePro/Views/Connection/ConnectionGroupPicker.swift Updates the connection-form group picker to render nested groups and adds group management actions.
TablePro/Views/Connection/ConnectionGroupFormSheet.swift New create/edit group sheet with color and parent-group selection (cycle prevention).
TablePro/Views/Connection/ConnectionFormView.swift Minor update to reflect group support in form state (comment only in this diff).
TablePro/Resources/Localizable.xcstrings Adds/removes localization keys used by new group UI.
TablePro/Models/DatabaseConnection.swift Adds sortOrder to support stable ordering/reordering.
TablePro/Models/ConnectionGroup.swift Adds hierarchy + ordering fields and migration-aware decoding.
TablePro/Core/Storage/GroupStorage.swift Adds hierarchy helpers, expanded-state persistence, and descendant deletion behavior.
TablePro/Core/Storage/ConnectionStorage.swift Persists sortOrder with migration fallback for pre-existing connections.
CHANGELOG.md Documents the new “Connection groups” feature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@datlechin
Copy link
Owner

@imhuytq fix conflict lun nha a :d

@imhuytq
Copy link
Contributor Author

imhuytq commented Mar 6, 2026

@datlechin review giúp với

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 10 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

datlechin and others added 2 commits March 6, 2026 13:28
- GroupStorage.addGroup returns Bool; duplicate check scoped to siblings
- ConnectionGroupPicker delete now requires confirmation dialog
- acceptGroupDrop adjusts childIndex for mixed group/connection children
- isDragging set only after validation passes in drag source
- totalConnectionCount guards against circular parentGroupId cycles
- duplicateConnection returns placed copy with correct sortOrder
- 2-step delete step2 only shown for group-resident connections
- Remove duplicated collectDescendantIds; reuse GroupStorage method
- Remove unnecessary comments in WelcomeWindowView
@imhuytq imhuytq changed the title feat: add connection groups feat: connection groups with multi-selection and hierarchical management Mar 6, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@datlechin datlechin force-pushed the feat/connection-groups branch from 5620545 to 864f32a Compare March 6, 2026 08:14
@datlechin
Copy link
Owner

Screenshot 2026-03-06 at 19 45 01 Em chạy lên thấy màu active hình như bị nhạt hơn so với bình thường

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.

3 participants