[PR #6271] [MERGED] feat(routing): add client picker to user rules #6207

Closed
opened 2026-11-02 04:07:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6271
Author: @ZaneL1u
Created: 8/20/2026
Status: ✅ Merged
Merged: 8/22/2026
Merged by: @MHSanaei

Base: main ← Head: feat/routing-user-picker


📝 Commits (4)

  • 5760d39 feat(routing): add client picker to user rules
  • 994200e feat(routing): polish user picker states
  • 75fdc6a Merge branch 'main' into feat/routing-user-picker
  • 39359cc fix(routing): keep custom user identifiers

📊 Changes

16 files changed (+206 additions, -4 deletions)

View changed files

➕ frontend/src/api/queries/useClientOptions.ts (+33 -0)
📝 frontend/src/pages/xray/routing/RuleFormModal.tsx (+36 -1)
📝 frontend/src/test/rule-form-preserve-fields.test.tsx (+98 -3)
📝 internal/web/translation/ar-EG.json (+3 -0)
📝 internal/web/translation/en-US.json (+3 -0)
📝 internal/web/translation/es-ES.json (+3 -0)
📝 internal/web/translation/fa-IR.json (+3 -0)
📝 internal/web/translation/id-ID.json (+3 -0)
📝 internal/web/translation/ja-JP.json (+3 -0)
📝 internal/web/translation/pt-BR.json (+3 -0)
📝 internal/web/translation/ru-RU.json (+3 -0)
📝 internal/web/translation/tr-TR.json (+3 -0)
📝 internal/web/translation/uk-UA.json (+3 -0)
📝 internal/web/translation/vi-VN.json (+3 -0)
📝 internal/web/translation/zh-CN.json (+3 -0)
📝 internal/web/translation/zh-TW.json (+3 -0)

📄 Description

Summary

  • Replaces the free-text routing user criterion with a searchable tag-style multi-select.
  • Matches the neighboring inbound-tag interaction with direct selection, search, and clear behavior while still accepting custom user identifiers.
  • Loads existing panel client emails only while the routing-rule modal is open.
  • Preserves saved user values that are no longer present in the client list, so editing existing rules remains lossless.
  • Covers loading, empty, and error states with localized copy in all 13 supported languages.

Why

Typing client identifiers by hand is error-prone and inconsistent with the neighboring inbound-tag picker. This change gives user-based routing rules the same direct-selection workflow while reusing the existing clients endpoint, without removing support for HTTP/Mixed or raw-template users that are not client records.

This PR intentionally covers only client/user selection. It does not add client-group routing support.

Refs #6237

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactor / code cleanup

Areas affected

  • Backend (Go)
  • Frontend (React/TypeScript)
  • Database / migrations
  • CI/CD / workflows
  • Documentation

How was this tested?

  • Added component regression tests that select multiple existing clients, accept a comma-separated custom identifier, verify the serialized routing user array, and preserve pre-existing values absent from the current client list.
  • Verified the interaction in a running Chinese-language panel: open the picker, search by email, select multiple users, and clear the selection.
  • Ran GOFLAGS=-p=1 make verify successfully, including:
    • all Go tests
    • 119 frontend test files / 1165 tests
    • frontend lint, formatting, and type checking
    • production and Storybook builds

Screenshots / recordings

N/A — this changes the existing field interaction without changing the surrounding layout; the selection and serialization behavior is covered by the component regression test.

Breaking changes

None.

Checklist

  • My code follows the project's style guidelines.
  • I have performed a self-review of my code.
  • I have added tests that prove the change works.
  • New and existing tests pass locally.
  • No Wiki or API documentation changes are required; the existing clients endpoint is reused.

🔄 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/6271 **Author:** [@ZaneL1u](https://github.com/ZaneL1u) **Created:** 8/20/2026 **Status:** ✅ Merged **Merged:** 8/22/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/routing-user-picker` --- ### 📝 Commits (4) - [`5760d39`](https://github.com/MHSanaei/3x-ui/commit/5760d3910c71aec786cb2fcd6f0c28050fff6d9c) feat(routing): add client picker to user rules - [`994200e`](https://github.com/MHSanaei/3x-ui/commit/994200ea640cd87c1403b09d4221a408ee78b7c9) feat(routing): polish user picker states - [`75fdc6a`](https://github.com/MHSanaei/3x-ui/commit/75fdc6a129833da7c3e01404006ef28c07cc1f3e) Merge branch 'main' into feat/routing-user-picker - [`39359cc`](https://github.com/MHSanaei/3x-ui/commit/39359cc87b1bccfd19e435c018fab17e3a8ab658) fix(routing): keep custom user identifiers ### 📊 Changes **16 files changed** (+206 additions, -4 deletions) <details> <summary>View changed files</summary> ➕ `frontend/src/api/queries/useClientOptions.ts` (+33 -0) 📝 `frontend/src/pages/xray/routing/RuleFormModal.tsx` (+36 -1) 📝 `frontend/src/test/rule-form-preserve-fields.test.tsx` (+98 -3) 📝 `internal/web/translation/ar-EG.json` (+3 -0) 📝 `internal/web/translation/en-US.json` (+3 -0) 📝 `internal/web/translation/es-ES.json` (+3 -0) 📝 `internal/web/translation/fa-IR.json` (+3 -0) 📝 `internal/web/translation/id-ID.json` (+3 -0) 📝 `internal/web/translation/ja-JP.json` (+3 -0) 📝 `internal/web/translation/pt-BR.json` (+3 -0) 📝 `internal/web/translation/ru-RU.json` (+3 -0) 📝 `internal/web/translation/tr-TR.json` (+3 -0) 📝 `internal/web/translation/uk-UA.json` (+3 -0) 📝 `internal/web/translation/vi-VN.json` (+3 -0) 📝 `internal/web/translation/zh-CN.json` (+3 -0) 📝 `internal/web/translation/zh-TW.json` (+3 -0) </details> ### 📄 Description ## Summary - Replaces the free-text routing `user` criterion with a searchable tag-style multi-select. - Matches the neighboring inbound-tag interaction with direct selection, search, and clear behavior while still accepting custom user identifiers. - Loads existing panel client emails only while the routing-rule modal is open. - Preserves saved user values that are no longer present in the client list, so editing existing rules remains lossless. - Covers loading, empty, and error states with localized copy in all 13 supported languages. ## Why Typing client identifiers by hand is error-prone and inconsistent with the neighboring inbound-tag picker. This change gives user-based routing rules the same direct-selection workflow while reusing the existing clients endpoint, without removing support for HTTP/Mixed or raw-template users that are not client records. This PR intentionally covers only client/user selection. It does not add client-group routing support. Refs #6237 ## Type of change - [ ] Bug fix - [x] New feature - [ ] Breaking change - [ ] Documentation update - [ ] Refactor / code cleanup ## Areas affected - [ ] Backend (Go) - [x] Frontend (React/TypeScript) - [ ] Database / migrations - [ ] CI/CD / workflows - [ ] Documentation ## How was this tested? - Added component regression tests that select multiple existing clients, accept a comma-separated custom identifier, verify the serialized routing `user` array, and preserve pre-existing values absent from the current client list. - Verified the interaction in a running Chinese-language panel: open the picker, search by email, select multiple users, and clear the selection. - Ran `GOFLAGS=-p=1 make verify` successfully, including: - all Go tests - 119 frontend test files / 1165 tests - frontend lint, formatting, and type checking - production and Storybook builds ## Screenshots / recordings N/A — this changes the existing field interaction without changing the surrounding layout; the selection and serialization behavior is covered by the component regression test. ## Breaking changes None. ## Checklist - [x] My code follows the project's style guidelines. - [x] I have performed a self-review of my code. - [x] I have added tests that prove the change works. - [x] New and existing tests pass locally. - [x] No Wiki or API documentation changes are required; the existing clients endpoint is reused. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:07:06 +07:00
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#6207
No description provided.