[PR #5627] [MERGED] feat(balancers): tabbed Observatory/Burst Observatory form #5937

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5627
Author: @nima1024m
Created: 6/28/2026
Status: ✅ Merged
Merged: 6/28/2026
Merged by: @MHSanaei

Base: main ← Head: feat/observatory-ui


📝 Commits (2)

  • 6f1a82b feat(balancers): tabbed Observatory/Burst form replacing raw JSON
  • 3e966f0 refactor(balancers): tighten httpMethod typing and align connectivity default

📊 Changes

18 files changed (+807 additions, -86 deletions)

View changed files

📝 frontend/src/pages/xray/balancers/BalancersTab.tsx (+62 -85)
➕ frontend/src/pages/xray/balancers/ObservatorySettingsTab.tsx (+238 -0)
📝 frontend/src/pages/xray/balancers/balancer-helpers.ts (+17 -0)
➕ frontend/src/schemas/observatory.ts (+34 -0)
📝 frontend/src/test/balancer-observatory-sync.test.ts (+66 -1)
📝 internal/web/translation/ar-EG.json (+30 -0)
📝 internal/web/translation/en-US.json (+30 -0)
📝 internal/web/translation/es-ES.json (+30 -0)
📝 internal/web/translation/fa-IR.json (+30 -0)
📝 internal/web/translation/id-ID.json (+30 -0)
📝 internal/web/translation/ja-JP.json (+30 -0)
📝 internal/web/translation/pt-BR.json (+30 -0)
📝 internal/web/translation/ru-RU.json (+30 -0)
📝 internal/web/translation/tr-TR.json (+30 -0)
📝 internal/web/translation/uk-UA.json (+30 -0)
📝 internal/web/translation/vi-VN.json (+30 -0)
📝 internal/web/translation/zh-CN.json (+30 -0)
📝 internal/web/translation/zh-TW.json (+30 -0)

📄 Description

Summary

Replaces the raw-JSON Observatory / Burst Observatory editor in the Balancers page with a proper Ant Design form, organised into two sub-tabs:

  • Balancer Settings — the existing balancer table (unchanged).
  • Observatory — a friendly form for both observer types.

Behaviour

  • Auto-managed, edit-only. Observers are still created/removed automatically by balancer strategy via the existing syncObservatories logic — users can't add or delete them by hand. The form exposes only the tunable probe fields; subjectSelector is shown read-only since it is derived from the balancers.
  • Least Ping → observatory form (probe URL, probe interval, concurrent probing).
  • Least Load (and Random / Round-robin with a fallback) → burstObservatory form (destination, connectivity, interval, timeout, sampling, HTTP method).
  • When both observers exist, a segmented control switches between them.
  • Delete safety. Deleting the last balancer that needs an observer now warns in the confirm dialog that the observer will be torn down too. Overlapping selectors keep an observer alive while any balancer still references it — only the now-unused prefixes are dropped.
  • Adds the previously missing pingConfig.httpMethod field (HEAD / GET).

Scope

Frontend-only + shared i18n. Observatory / Burst are stored as raw JSON inside the xrayTemplateConfig setting and saved through the existing /panel/api/xray/update route — no Go logic, no DB migration, no new routes. New strings translated across all 13 locales.

Tests

  • Extended balancer-observatory-sync.test.ts: asserts the httpMethod: "HEAD" default and the prefix-drop-on-overlap behaviour.
  • New suite for observersRemovedByDeletingBalancer (last-consumer vs. still-needed-by-another-balancer).
  • Full gate green: typecheck, eslint, npm run gen (clean diff), 606 vitest tests, npm run build, and the Go web package build.
  • Manual testing all green.

Screenshots

View Screenshot
Balancer Settings tab {F92C147F-F0B0-4927-AFBE-BD3F883A39F0}
Observatory tab — Burst Observatory form {387211C6-E0AA-40AC-92B1-F20AEE784307}
Observatory tab — both observers (segmented toggle) {93669280-57D3-44B3-8DA2-DEA1CF56668F}
Observatory tab — empty state {A44FBA31-BFDF-42DA-BA0F-796FEC674D50}

🔄 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/5627 **Author:** [@nima1024m](https://github.com/nima1024m) **Created:** 6/28/2026 **Status:** ✅ Merged **Merged:** 6/28/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/observatory-ui` --- ### 📝 Commits (2) - [`6f1a82b`](https://github.com/MHSanaei/3x-ui/commit/6f1a82b9186aef427edea574efd73513893682f5) feat(balancers): tabbed Observatory/Burst form replacing raw JSON - [`3e966f0`](https://github.com/MHSanaei/3x-ui/commit/3e966f001b5b8c71d46f64740cd8d1375839d890) refactor(balancers): tighten httpMethod typing and align connectivity default ### 📊 Changes **18 files changed** (+807 additions, -86 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/pages/xray/balancers/BalancersTab.tsx` (+62 -85) ➕ `frontend/src/pages/xray/balancers/ObservatorySettingsTab.tsx` (+238 -0) 📝 `frontend/src/pages/xray/balancers/balancer-helpers.ts` (+17 -0) ➕ `frontend/src/schemas/observatory.ts` (+34 -0) 📝 `frontend/src/test/balancer-observatory-sync.test.ts` (+66 -1) 📝 `internal/web/translation/ar-EG.json` (+30 -0) 📝 `internal/web/translation/en-US.json` (+30 -0) 📝 `internal/web/translation/es-ES.json` (+30 -0) 📝 `internal/web/translation/fa-IR.json` (+30 -0) 📝 `internal/web/translation/id-ID.json` (+30 -0) 📝 `internal/web/translation/ja-JP.json` (+30 -0) 📝 `internal/web/translation/pt-BR.json` (+30 -0) 📝 `internal/web/translation/ru-RU.json` (+30 -0) 📝 `internal/web/translation/tr-TR.json` (+30 -0) 📝 `internal/web/translation/uk-UA.json` (+30 -0) 📝 `internal/web/translation/vi-VN.json` (+30 -0) 📝 `internal/web/translation/zh-CN.json` (+30 -0) 📝 `internal/web/translation/zh-TW.json` (+30 -0) </details> ### 📄 Description ## Summary Replaces the raw-JSON Observatory / Burst Observatory editor in the **Balancers** page with a proper Ant Design form, organised into two sub-tabs: - **Balancer Settings** — the existing balancer table (unchanged). - **Observatory** — a friendly form for both observer types. ## Behaviour - **Auto-managed, edit-only.** Observers are still created/removed automatically by balancer strategy via the existing `syncObservatories` logic — users can't add or delete them by hand. The form exposes only the tunable probe fields; `subjectSelector` is shown **read-only** since it is derived from the balancers. - **Least Ping** → `observatory` form (probe URL, probe interval, concurrent probing). - **Least Load** (and Random / Round-robin **with a fallback**) → `burstObservatory` form (destination, connectivity, interval, timeout, sampling, **HTTP method**). - When both observers exist, a segmented control switches between them. - **Delete safety.** Deleting the last balancer that needs an observer now warns in the confirm dialog that the observer will be torn down too. Overlapping selectors keep an observer alive while any balancer still references it — only the now-unused prefixes are dropped. - Adds the previously missing `pingConfig.httpMethod` field (HEAD / GET). ## Scope Frontend-only + shared i18n. Observatory / Burst are stored as raw JSON inside the `xrayTemplateConfig` setting and saved through the existing `/panel/api/xray/update` route — **no Go logic, no DB migration, no new routes**. New strings translated across all 13 locales. ## Tests - Extended `balancer-observatory-sync.test.ts`: asserts the `httpMethod: "HEAD"` default and the prefix-drop-on-overlap behaviour. - New suite for `observersRemovedByDeletingBalancer` (last-consumer vs. still-needed-by-another-balancer). - Full gate green: `typecheck`, `eslint`, `npm run gen` (clean diff), 606 vitest tests, `npm run build`, and the Go web package build. - Manual testing all green. ## Screenshots | View | Screenshot | | --- | --- | | Balancer Settings tab | <img width="200" height="100" alt="{F92C147F-F0B0-4927-AFBE-BD3F883A39F0}" src="https://github.com/user-attachments/assets/744f4579-2f29-4d2b-a3b3-10038dc91725" /> | | Observatory tab — Burst Observatory form | <img width="200" height="100" alt="{387211C6-E0AA-40AC-92B1-F20AEE784307}" src="https://github.com/user-attachments/assets/f0e3c0c1-5ce8-4fe8-b71a-c8b75d4af7c8" /> | | Observatory tab — both observers (segmented toggle) | <img width="200" height="100" alt="{93669280-57D3-44B3-8DA2-DEA1CF56668F}" src="https://github.com/user-attachments/assets/9aba3897-e842-4b6b-abb3-5118a24cfe90" /> | | Observatory tab — empty state | <img width="200" height="100" alt="{A44FBA31-BFDF-42DA-BA0F-796FEC674D50}" src="https://github.com/user-attachments/assets/e29a563c-cbed-4aae-af84-687a0562eb85" /> | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:05:10 +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#5937
No description provided.