Skip to content

feat(ui): add drag and drop functionality for connection groups#126

Merged
debba merged 2 commits intodebba:mainfrom
thomaswasle:feature/drag-and-drop-functionality-for-connection-groups
Apr 10, 2026
Merged

feat(ui): add drag and drop functionality for connection groups#126
debba merged 2 commits intodebba:mainfrom
thomaswasle:feature/drag-and-drop-functionality-for-connection-groups

Conversation

@thomaswasle
Copy link
Copy Markdown
Contributor

This PR adds drag and drop functionality to the Database Manager Connections.

Connections now can be dragged into a group and from one group to another. It is also possible to change the order of the groups by drag and drop.

setDraggingGroupId(null);
setDragOverGroupId(null);
if (!targetGroupId || targetGroupId === sourceGroupId) return;
const newOrder = [...sortedGroups];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: Group reordering logic may produce unexpected results when dragging from a higher index to a lower index.

When fromIdx > toIdx, the code removes the group first (shifting indices), then inserts at the original toIdx. This inserts the moved group before the target instead of after it.

Example: Moving group at index 2 to index 0:

  • After splice(2, 1): [A, B, D] (D removed)
  • splice(0, 0, D): [D, A, B] - D is now at index 0, before A

User likely expects: [A, D, B] - D after A (where it was dropped).

Consider using toIdx + (fromIdx < toIdx ? 0 : 1) as the insertion index.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The suggested fix toIdx + (fromIdx < toIdx ? 0 : 1) only differs when fromIdx > toIdx (dragging backwards), inserting at toIdx + 1 instead of toIdx. That would mean dragging D onto A places D after A rather than at A — which is the opposite of what the visual feedback (ring on A) implies.

@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot bot commented Apr 9, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/pages/Connections.tsx 391 Group reordering logic produces unexpected results when dragging from higher to lower index
Files Reviewed (5 files)
  • src/pages/Connections.tsx - 1 issue
  • src/components/connections/ConnectionCard.tsx - no issues
  • src/components/connections/ConnectionListItem.tsx - no issues
  • src/components/connections/GroupHeader.tsx - no issues
  • src-tauri/Cargo.lock - version bump only

Fix these issues in Kilo Cloud


Reviewed by kimi-k2.5-0127 · 167,375 tokens

@debba
Copy link
Copy Markdown
Owner

debba commented Apr 10, 2026

Hey @thomaswasle , thanks for this.
I will check during the day.

@debba
Copy link
Copy Markdown
Owner

debba commented Apr 10, 2026

well done, I will merge it. thanks

@debba debba merged commit 74d9920 into debba:main Apr 10, 2026
2 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