3x-ui/frontend/src
Sentiago 142dab9ee8
feat(balancer): add balancer-to-balancer fallback support (#5586)
* feat(balancer): add balancer-to-balancer fallback support

Xray does not natively support using a balancer as fallbackTag for
another balancer. This feature automates the loopback workaround:
when a user selects a balancer as fallback, the panel generates a
loopback outbound + routing rule in the template.

How it works:
- User picks fallback balancer from dropdown
- Panel creates loopback outbound _bl_{target} + routing rule
- Balancer fallbackTag set to _bl_{target}
- Traffic: Balancer A → loopback _bl_B → routing rule → Balancer B

Key features:
- Dedup: multiple balancers sharing same fallback reuse one loopback
- DFS cycle detection at edit time and on save
- Self-reference guard (cannot select own balancer)
- Delete protection (blocks if used as fallback by others)
- Cleans up routing rules referencing deleted balancers
- Override resolves balancer tags through loopback mechanism
- All live status tags resolved for display
- Internal _bl_ objects filtered from Outbounds/Routing UI
- Backward-compatible with old _bl_ naming format
- Translations for all 13 locales

* fix(review): override regression, save payload sync, i18n completeness

- OverrideBalancer: only resolve to loopback when resolution succeeds,
  pass original target through for plain outbound tags
- onSaveAll: serialize cleaned template before save to ensure the
  healed/cleaned config is what gets persisted
- Add reservedPrefix translation key to all 12 non-English locales
- Restore trailing newlines in all 13 translation JSON files

* fix(test): update balancer form modal tests after cycle-detection guard

The okButtonProps disabled guard (added in 56d5825c) prevents the modal
from firing onOk when the form is invalid. The old tests clicked the
button expecting validation errors to appear, but antd Modal never calls
onOk on a disabled button — causing false failures.

Rewrite to test the actual guard behavior:
- Button starts disabled (empty form)
- Stays disabled with tag only (selector still empty)
- Stays disabled for duplicate tag
- Disabled button does not trigger onConfirm

---------

Co-authored-by: MHSanaei <ho3ein.sanaei@gmail.com>
2026-07-09 01:59:51 +02:00
..
api feat(hosts): bulk-add multiple hosts to multiple inbounds (#5677) 2026-07-08 23:35:20 +02:00
components Frontend dev tooling (Husky, lint-staged, MSW, Storybook) + full React Hook Form migration (#5859) 2026-07-08 13:28:37 +02:00
entries refactor(frontend): replace axios with the native Fetch API 2026-07-08 01:09:18 +02:00
generated feat(hosts): bulk-add multiple hosts to multiple inbounds (#5677) 2026-07-08 23:35:20 +02:00
hooks feat(outbound): add real-delay connection test mode 2026-07-06 08:35:48 +02:00
i18n refactor: focused service files, leaf subpackages, and an internal/ layout (#5167) 2026-06-10 15:19:22 +02:00
layouts feat(a11y): screen-reader & keyboard accessibility across the panel (#5486) (#5652) 2026-06-29 12:51:29 +02:00
lib Frontend dev tooling (Husky, lint-staged, MSW, Storybook) + full React Hook Form migration (#5859) 2026-07-08 13:28:37 +02:00
models feat(settings): let users clear stored secrets from the UI 2026-07-02 13:57:34 +02:00
pages feat(balancer): add balancer-to-balancer fallback support (#5586) 2026-07-09 01:59:51 +02:00
schemas feat(balancer): add balancer-to-balancer fallback support (#5586) 2026-07-09 01:59:51 +02:00
styles feat(hosts): managed Hosts for per-host subscription link overrides (#5409) 2026-06-17 12:06:55 +02:00
test feat(balancer): add balancer-to-balancer fallback support (#5586) 2026-07-09 01:59:51 +02:00
utils Frontend dev tooling (Husky, lint-staged, MSW, Storybook) + full React Hook Form migration (#5859) 2026-07-08 13:28:37 +02:00
env.d.ts refactor(frontend): replace axios with the native Fetch API 2026-07-08 01:09:18 +02:00
main.tsx refactor(frontend): replace axios with the native Fetch API 2026-07-08 01:09:18 +02:00
queryClient.ts feat(frontend): TanStack Query + React Router migration & in-panel API docs (#4541) 2026-05-24 21:34:52 +02:00
routes.tsx feat(sidebar): move Routing/Outbounds to top-level items with clean URLs 2026-06-22 22:20:26 +02:00