[PR #6959] feat(xray): drag to reorder DNS servers #6541

Open
opened 2026-11-02 04:09:31 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6959
Author: @eric15342335
Created: 10/26/2026
Status: 🔄 Open

Base: main ← Head: claude/dns-draggable-ordering-da6918


📝 Commits (1)

  • f9d355b feat(xray): drag to reorder DNS servers

📊 Changes

3 files changed (+161 additions, -14 deletions)

View changed files

📝 frontend/src/pages/xray/dns/DnsTab.tsx (+54 -10)
📝 frontend/src/pages/xray/dns/useDnsColumns.tsx (+41 -2)
📝 frontend/src/test/dns-tab.test.tsx (+66 -2)

📄 Description

Summary

DNS servers on Xray Configs → DNS can now be reordered by dragging a row's grab handle, the same way as the Routing rules table. Each row's menu also gets Move up and Move down.

image

Why

Xray queries DNS servers in list order, but the DNS table only had Edit and Delete, so changing a server's priority meant deleting and re-adding servers.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

  • New tests in frontend/src/test/dns-tab.test.tsx:
    • Dragging a server down and up. Each test checks the drop line on the target row during the drag, then the saved dns.servers order after the drop, with an object server's fields kept intact.
    • The row menu: Move up is disabled on the first row, and Move down reorders.
    • All of these failed before the change.
  • npm run typecheck, npm run lint and npm run format:check pass. The Vitest unit and components projects pass: 186 files, 1922 tests.
  • I built the Docker image from this branch, opened Xray Configs → DNS in Chromium and checked:
    • A mouse drag moves a server into the target slot.
    • The drop line shows on the correct side while dragging.
    • Move up and Move down work.
    • Cancelling mid-drag leaves the order unchanged.
  • The drag code is the existing usePointerRowReorder hook, and the styles are Routing's .drag-handle / drop-* classes. XrayPage loads RoutingTab.css together with DnsTab, so the DNS table gets those styles. The translation keys already exist, so no locale files changed.

Screenshots / recordings

Breaking changes

None.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally. (No Go files changed. The Go binary compiled in the Docker build, but I didn't run the Go tests because there's no Go toolchain on this machine.)
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed. (Not needed: the Routing table's drag reorder isn't documented either.)
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6959 **Author:** [@eric15342335](https://github.com/eric15342335) **Created:** 10/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `claude/dns-draggable-ordering-da6918` --- ### 📝 Commits (1) - [`f9d355b`](https://github.com/MHSanaei/3x-ui/commit/f9d355b104e61350a4d3fde605e7ecc2ad15eef1) feat(xray): drag to reorder DNS servers ### 📊 Changes **3 files changed** (+161 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/pages/xray/dns/DnsTab.tsx` (+54 -10) 📝 `frontend/src/pages/xray/dns/useDnsColumns.tsx` (+41 -2) 📝 `frontend/src/test/dns-tab.test.tsx` (+66 -2) </details> ### 📄 Description ## Summary DNS servers on Xray Configs → DNS can now be reordered by dragging a row's grab handle, the same way as the Routing rules table. Each row's menu also gets Move up and Move down. <img width="706" height="280" alt="image" src="https://github.com/user-attachments/assets/d03a617e-67fd-4702-b60d-7c3cb872a071" /> ## Why Xray queries DNS servers in list order, but the DNS table only had Edit and Delete, so changing a server's priority meant deleting and re-adding servers. ## Type of change - [ ] Bug fix - [x] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [ ] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? - New tests in `frontend/src/test/dns-tab.test.tsx`: - Dragging a server down and up. Each test checks the drop line on the target row during the drag, then the saved `dns.servers` order after the drop, with an object server's fields kept intact. - The row menu: Move up is disabled on the first row, and Move down reorders. - All of these failed before the change. - `npm run typecheck`, `npm run lint` and `npm run format:check` pass. The Vitest unit and components projects pass: 186 files, 1922 tests. - I built the Docker image from this branch, opened Xray Configs → DNS in Chromium and checked: - A mouse drag moves a server into the target slot. - The drop line shows on the correct side while dragging. - Move up and Move down work. - Cancelling mid-drag leaves the order unchanged. - The drag code is the existing `usePointerRowReorder` hook, and the styles are Routing's `.drag-handle` / `drop-*` classes. `XrayPage` loads `RoutingTab.css` together with `DnsTab`, so the DNS table gets those styles. The translation keys already exist, so no locale files changed. ## Screenshots / recordings <!-- add screenshots --> ## Breaking changes None. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [ ] `go build ./...` and the test suite pass locally. (No Go files changed. The Go binary compiled in the Docker build, but I didn't run the Go tests because there's no Go toolchain on this machine.) - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. - [ ] I updated the Wiki / README / API docs if user-facing behavior changed. (Not needed: the Routing table's drag reorder isn't documented either.) - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6541
No description provided.