Skip to content

Feat/host drag drop reorder#70

Open
BungeeDEV wants to merge 3 commits into
macnev2013:mainfrom
BungeeDEV:feat/host-drag-drop-reorder
Open

Feat/host drag drop reorder#70
BungeeDEV wants to merge 3 commits into
macnev2013:mainfrom
BungeeDEV:feat/host-drag-drop-reorder

Conversation

@BungeeDEV

Copy link
Copy Markdown
Contributor

This pull request adds support for manual drag-and-drop reordering of hosts and groups on the dashboard. It introduces new backend commands and database schema changes to persist the custom order, and updates the frontend to provide visual feedback for draggable cards. Additionally, it adds the necessary drag-and-drop dependencies to the project.

Manual ordering support:

  • Added new backend commands reorder_hosts and reorder_groups in src-tauri/src/db/commands.rs to persist manual ordering of hosts and groups, respectively. These commands update a new sort_order column and ensure atomicity and consistency. [1] [2] [3]
  • Updated the database schema in src-tauri/src/db/mod.rs to add a sort_order column to saved_hosts and to use this column (falling back to label/name) when listing hosts and groups. Added migration logic to ensure backward compatibility. [1] [2] [3] [4] [5]

Frontend drag-and-drop readiness:

  • Updated HostCard and GroupCard components to use cursor-grab and cursor-grabbing styles, providing users with visual feedback that cards are draggable. [1] [2]

Dependency management:

  • Added @dnd-kit/core, @dnd-kit/sortable, and @dnd-kit/utilities to package.json and pnpm-lock.yaml to enable frontend drag-and-drop functionality. Also added tslib as a dependency for these libraries. [1] [2] [3] [4] [5] [6]

Other package updates:

  • Updated platform-specific package configurations in pnpm-lock.yaml to specify the correct libc for various native dependencies, improving cross-platform compatibility. [1] [2] [3] [4]

BungeeDEV and others added 3 commits June 9, 2026 02:22
Let users manually reorder host cards on the dashboard via drag and drop;
the custom order is persisted in SQLite and survives app restarts.

- DB: add saved_hosts.sort_order (migration 13→14) and a reorder_hosts
  command that bulk-updates sort_order in a transaction; list_hosts now
  orders by sort_order ASC, label ASC.
- Frontend: wrap the host grid in @dnd-kit DndContext/SortableContext. The
  whole card is the drag surface (MouseSensor 5px / TouchSensor 250ms), so a
  plain click still connects.
- Store: reorderHosts applies the new order optimistically and reverts on
  persist failure, with a Vitest unit test covering the action.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Let users reorder the group cards via drag and drop, alongside the existing
within-grid host reordering. The custom order is persisted in SQLite and
survives app restarts.

- DB: add a reorder_groups command that bulk-updates host_groups.sort_order in
  a transaction. The sort_order column and the ordered list_groups query
  already existed, so no migration is needed.
- Frontend: the Groups grid gets its own DndContext/SortableContext, separate
  from the per-host DnD layer so the two never interfere. The whole group card
  is the drag surface (shared MouseSensor 5px / TouchSensor 250ms sensors), so
  a plain click still filters by group.
- Store: reorderGroups applies the new order optimistically and reverts on
  persist failure, with a Vitest unit test covering the action.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add E2E coverage for drag-and-drop reordering and polish the interaction.

- E2E: 63-host-reorder.spec.ts drags a host card and a group card to a new
  position via a real pointer gesture, confirms the order persisted to the
  backend, then relaunches the app and verifies the new order reloads from
  SQLite. New reorder.ts helper drives the gesture (W3C performActions) and
  reads DOM + persisted order; __e2eHostOrder / __e2eGroupOrder store hooks
  let the spec await the async DB write before relaunch.
- UX: grab/grabbing cursors on host and group cards so the drag affordance is
  clear; a plain click still selects/connects (drag needs a 5px move first).
- Add TODO markers above both DndContext blocks for future keyboard reordering.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@BungeeDEV BungeeDEV marked this pull request as ready for review June 9, 2026 00:41
@BungeeDEV

Copy link
Copy Markdown
Contributor Author

Should cover #41 in general

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.

1 participant