Skip to content

feat: add connection groups#140

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

feat: add connection groups#140
imhuytq wants to merge 8 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.

Data model

  • ConnectionGroup: id, name, color, parentGroupId (nesting), sortOrder (sibling ordering). Codable with migration support for pre-existing data.
  • DatabaseConnection.groupId: optional link to a group.
  • GroupStorage: CRUD, hierarchy helpers (childGroups, nextSortOrder, collectDescendantIds), and persisted expand/collapse state via UserDefaults.

Welcome window (ConnectionOutlineView)

  • NSOutlineView-based tree: root groups → child groups → connections, sorted by sortOrder.
  • Group cells show a color-tinted folder icon and recursive connection count.
  • Expand/collapse: double-click or Return key; state persisted across app launches.
  • Drag & drop: move connections into/out of groups; reorder connections and groups within a parent; move groups to become children of other groups. Circular nesting is prevented at drop validation.
  • Context menus:
    • On group: New Connection, New Subgroup, Edit Group, Delete Group.
    • On connection: Connect, Edit, Duplicate, Move to Group (nested submenu), Delete.
    • On empty space: New Connection, New Group.
  • Search mode flattens the tree to a filtered flat list.

Group form sheet (ConnectionGroupFormSheet)

  • Fields: name, color picker (8 colors), parent group picker.
  • ParentGroupPicker: recursive nested menus; when editing, self and all descendants are excluded to prevent cycles.
  • Newly created groups auto-expand in the outline view.

Connection form (ConnectionGroupEditor)

  • Drop-in menu in the Appearance section showing the current group.
  • Recursive nested submenus for group selection.
  • Inline "Create New Group" and "Manage Groups" (delete) actions.

Deletion behavior

  • Deleting a group also deletes all its descendants.
  • Member connections are ungrouped (not deleted).

Test plan

  • Create a root group and a nested subgroup; verify tree renders correctly
  • Drag a connection into a group, then to a different group, then to root (ungrouped)
  • Drag a group into another group; verify circular nesting is blocked
  • Reorder connections and groups by drag within the same parent
  • Edit a group: change name, color, and parent group
  • Delete a group with nested subgroups; verify all descendants and connections are handled
  • Expand/collapse groups; restart the app and verify state is restored
  • Create a connection and assign a group from the connection form
  • Search for a connection; verify the flat list shows correctly
  • Run GroupStorageTests

@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

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