[GH-ISSUE #5371] [Feature]: Batch Edit Selected Clients — Modify Common Parameters Across Multiple Clients at Once #3757

Open
opened 2026-10-31 20:34:45 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @jshir700 on GitHub (Jun 16, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5371

The client management page already has a mature bulk operations system — row selection with checkboxes, a toolbar with dedicated buttons for attach/detach/group/delete, and a "More" dropdown with adjust, sub-links, and bulk add. For an operator managing hundreds of clients, this is a solid foundation.

But there's a significant gap. The only batch operation that modifies client settings is Adjust (ClientBulkAdjustModal), and it only supports additive/incremental changes — add days to expiry, add traffic to balance. You cannot set client properties to specific values in bulk.

Consider these common scenarios that have no batch solution today:

Task Current effort (for 50 clients)
Disable 50 expired clients without deleting them Open each → uncheck enable → save × 50
Set limitIp from 0 to 3 on all bronze-tier clients Edit each × 50
Update comment or group field across a client batch Per-client form × N
Set specific totalGB (not add, but set to) on a batch Not possible — existing bulk adjust only does additive
Set specific expiryTime (not +days, but a fixed date) Not possible — existing bulk adjust only does +days
Change flow from none to xtls-rprx-vision on VLESS clients Edit each × N

The client form (ClientFormModal.tsx) exposes ~19 user-facing parameters across 3 tabs (Basics, Credentials, Links). The batch adjust modal covers exactly 2 of them (addDays, addGB), and those are the additive variant, not set-to-value.

Meanwhile, the toolbar infrastructure is already there — the selected-count tag, the button group, the modal-based workflow. What's missing is a batch edit modal that lets you pick which fields to change and set them to specific values, leaving everything else untouched.

Describe the solution you'd like

The core idea mirrors the inbound batch edit: select multiple clients → click "Batch Edit" → pick the fields to change → apply once.

The same design principles apply:

  • Three-state controls — each field starts as "Don't change" (null/indeterminate). Only fields the user explicitly touches are applied.
  • Current value preview — each control shows the current value of that field for every selected client, so you see what you're about to overwrite.
  • Surgical, not wholesale — the modal sends only the fields the user changed. Everything else stays as-is per client.

Backend — new API endpoint

POST /panel/api/clients/bulkUpdate

Request body:

{
  "emails": ["user1@example.com", "user2@example.com", "user3@example.com"],
  "fields": {
    "enable": true,
    "totalGB": 51234123456,
    "expiryTime": 1798790400000,
    "limitIp": 3,
    "comment": "Migrated to new server",
    "group": "silver",
    "tgId": 123456789,
    "reset": 30
  },
  "credentials": {
    "flow": "xtls-rprx-vision",
    "security": "auto"
  },
  "inboundChanges": {
    "attach": [5, 6, 7],
    "detach": [1, 2]
  }
}

Semantics:

  • "fields" — only non-null keys are applied. Omitted/null keys are left untouched per client.
  • "credentials" — protocol-gated fields (flow, security). Applied only to clients whose inbounds support those settings.
  • "inboundChanges" — optional array of inbound IDs to attach and/or detach across all selected clients. Both are optional — omit to leave inbound membership untouched.

Response:

{
  "success": true,
  "updated": 48,
  "skipped": [
    { "email": "bad@example.com", "reason": "client not found" }
  ]
}

Each client is updated independently via the existing UpdateByEmail service method so validation (email uniqueness, inbound existence) works identically to the single-edit path. Partial success is reported — the operator only needs to re-check the skipped ones.

Frontend — new ClientBatchEditModal component

File: frontend/src/pages/clients/ClientBatchEditModal.tsx

A modal with 3 tab pages that mirror the existing ClientFormModal layout, keeping the mental model consistent:

Tab Controls Visibility guard
Basics enable (three-state Switch), totalGB (InputNumber), expiryTime (DateTimePicker), limitIp (InputNumber), comment (Input), group (Select/AutoComplete), tgId (InputNumber, shown only when tgBot enabled), reset (InputNumber), inboundChanges (Select multi for attach/detach) tgId only shown when tgBot enabled
Credentials flow (Select: none/vision/vision-udp443), security (Select: auto/aes-128-gcm/chacha20-poly1305/none/zero) flow shown only when selected clients have TLS-flow-capable inbounds; security only for VMESS inbounds
Links externalLinks — add new link/subscription entries (append-only; doesn't touch existing links) Always visible

Three-state controls:

All fields start in a neutral state. The user explicitly sets a field to change it. Boolean fields (enable) use a three-state Switch:

Switch appearance Meaning
Dimmed / indeterminate bar Don't change enable status
Blue (on) Set to true
Gray (off) Set to false

For numeric and text fields, a checkbox or toggle beside each control lets the user "activate" it — when inactive, the field's value is not included in the request.

Current value preview:

Below each active control, a compact preview shows the current value of that field for each selected client, so the operator can verify the change is safe before applying:

Flow: xtls-rprx-vision
  ─────────────────────────────
  user1@example.com: xtls-rprx-vision
  user2@example.com: (none)           ← this one will change
  user3@example.com: xtls-rprx-vision

How the user gets there

  1. Select ≥2 clients via the existing checkboxes.
  2. The toolbar shows the selected-count tag alongside the existing Attach/Detach/Group/Delete buttons.
  3. A new "Batch Edit" button appears in the toolbar.
  4. Clicking it opens the ClientBatchEditModal.
  5. Fill in only the fields you want to change → click Apply.
  6. A single API call updates all selected clients; success/error count is shown.

Integration points (files to modify)

File Change
frontend/src/pages/clients/ClientsPage.tsx Import ClientBatchEditModal; add batchEditOpen + batchEditClients state; add "Batch Edit" button in toolbar when rows selected; wire to open modal; render <ClientBatchEditModal>
frontend/src/pages/clients/ClientBatchEditModal.tsx New file — 3-tab modal component
internal/web/controller/client.go Add ClientBulkUpdateRequest struct + bulkUpdate handler that iterates emails + applies partial fields
internal/web/service/client.go Add UpdateClientPartial method that updates only non-null fields, reuses existing UpdateByEmail for runtime sync
internal/web/web.go Register POST /panel/api/clients/bulkUpdate
internal/web/translation/*.json Add ~25 new i18n keys

How this differs from the existing ClientBulkAdjustModal

The existing ClientBulkAdjustModal serves a different purpose. It's an incremental tool: "add X days to all these clients' expiry dates" or "add Y GB to all these clients' traffic balances." This is useful for extending service, but it's the only bulk edit the panel offers.

The proposed ClientBatchEditModal is a set-to-value tool: "set all these clients' totalGB to 100GB" or "set all these clients' limitIp to 3" or "disable all these clients." These are fundamentally different operations that require different UI (three-state controls, current-value preview) and different API semantics (partial update, not additive).

Both modals should coexist — they target different use cases:

Scenario Which modal
"Extend all bronze clients by 30 days" ClientBulkAdjustModal (incremental)
"Set all bronze clients to expire on Dec 31" ClientBatchEditModal (set-to-value)
"Add 10GB to everyone's balance" ClientBulkAdjustModal (incremental)
"Set everyone's totalGB to exactly 200GB" ClientBatchEditModal (set-to-value)

Alternatives you've considered

Run the existing bulkAdjust N times to approximate a set. You can't. bulkAdjust is additive — it only supports addDays and addBytes. There is no way to "subtract" to reach a specific value, and even if you could, you'd need to know each client's current values, which varies per client.

Single-edit modal for each client. The status quo. For 50+ clients this is prohibitive. The risk of parameter drift (slightly different values entered per client) is high, and the time cost scales linearly.

Script the REST API. Possible for a power user, but requires API-token auth, familiarity with the client JSON payload (which varies by protocol — VMESS uses id, Trojan uses password, SS uses email), and manual error handling. Most panel operators are not developers.

Extend ClientBulkAdjustModal to support set-to-value mode. The existing modal is built for two specific additive fields. Adding set-to-value semantics (with three-state controls, current-value preview, and non-additive field dispatch) would completely change its character. It's cleaner to have a dedicated modal with a unified pattern, just like the single-edit ClientFormModal already has a different shape from ClientBulkAdjustModal.

Concrete use cases

Use case 1: Bulk disable stale clients. You run a monthly cleanup where ~200 clients with expired subscriptions should be disabled (not deleted — they might re-subscribe and need their history). Currently you must open each one and uncheck "enable." With batch edit: filter by "expiry before date" → select all → Batch Edit → Basics → set Enable to Off → Apply. 10 seconds instead of 30+ minutes.

Use case 2: Tier migration. You decide to increase the limitIp on all "premium" clients from 3 to 5. You have 85 premium clients. Without batch edit: you open each form and change limitIp, one by one. With batch edit: filter by group "premium" → select all → Batch Edit → set limitIp → Apply. 5 seconds.

Use case 3: Bulk protocol migration. You migrate from VMESS to VLESS and need to update the flow control on 60 VLESS clients from "none" to xtls-rprx-vision. Without batch edit: 60 individual edits. With batch edit: select the 60 → Batch Edit → Credentials → set Flow → Apply. 5 seconds.

Use case 4: Server migration comment. You're migrating 120 clients from server A to server B. You want to set their comment field to "Migrated to server B — June 2026" so support staff know where they are. Without batch edit: not achievable in bulk — you'd have to script the API or do 120 manual edits. With batch edit: select the 120 → Batch Edit → set comment → Apply.

Use case 5: Uniform traffic cap. A promotional campaign gives 50 new clients a 500GB traffic cap. After the campaign ends, you need to set (not add) their totalGB to exactly 100GB. The existing bulkAdjust only adds traffic — you can't reduce. With batch edit: select the 50 → Batch Edit → set totalGB → Apply. 5 seconds.


Appendix: i18n keys

Key English
pages.clients.batchEditClients Batch Edit Clients
pages.clients.batchEditTabBasics Basics
pages.clients.batchEditTabCredentials Credentials
pages.clients.batchEditTabLinks Links
pages.clients.batchEditKeepOriginal Keep original
pages.clients.batchEditApply Apply
pages.clients.batchEditSaved Clients updated
pages.clients.batchEditPartialError Some clients failed to update
pages.clients.batchEditAttachInbounds Attach to inbounds
pages.clients.batchEditDetachInbounds Detach from inbounds
pages.clients.batchEditNoMatchingClients No matching clients
pages.clients.batchEditAndMore and {count} more
pages.clients.batchEditShowCurrent Show current values

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

Backend (API endpoints, login, settings)

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @jshir700 on GitHub (Jun 16, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5371 ### Is your feature request related to a problem? The client management page already has a mature bulk operations system — row selection with checkboxes, a toolbar with dedicated buttons for attach/detach/group/delete, and a "More" dropdown with adjust, sub-links, and bulk add. For an operator managing hundreds of clients, this is a solid foundation. But there's a significant gap. The only batch operation that **modifies client settings** is **Adjust** (`ClientBulkAdjustModal`), and it only supports **additive/incremental** changes — add days to expiry, add traffic to balance. You cannot **set** client properties to specific values in bulk. Consider these common scenarios that have no batch solution today: | Task | Current effort (for 50 clients) | |---|---| | Disable 50 expired clients without deleting them | Open each → uncheck enable → save × 50 | | Set `limitIp` from 0 to 3 on all bronze-tier clients | Edit each × 50 | | Update `comment` or `group` field across a client batch | Per-client form × N | | Set specific `totalGB` (not add, but **set to**) on a batch | Not possible — existing bulk adjust only does additive | | Set specific `expiryTime` (not +days, but a fixed date) | Not possible — existing bulk adjust only does +days | | Change `flow` from none to `xtls-rprx-vision` on VLESS clients | Edit each × N | The client form (`ClientFormModal.tsx`) exposes ~19 user-facing parameters across 3 tabs (Basics, Credentials, Links). The batch adjust modal covers exactly **2 of them** (addDays, addGB), and those are the additive variant, not set-to-value. Meanwhile, the toolbar infrastructure is already there — the selected-count tag, the button group, the modal-based workflow. What's missing is a **batch edit modal** that lets you pick which fields to change and set them to specific values, leaving everything else untouched. ### Describe the solution you'd like The core idea mirrors the inbound batch edit: select multiple clients → click "Batch Edit" → pick the fields to change → apply once. The same design principles apply: - **Three-state controls** — each field starts as "Don't change" (null/indeterminate). Only fields the user explicitly touches are applied. - **Current value preview** — each control shows the current value of that field for every selected client, so you see what you're about to overwrite. - **Surgical, not wholesale** — the modal sends only the fields the user changed. Everything else stays as-is per client. #### Backend — new API endpoint **`POST /panel/api/clients/bulkUpdate`** Request body: ```json { "emails": ["user1@example.com", "user2@example.com", "user3@example.com"], "fields": { "enable": true, "totalGB": 51234123456, "expiryTime": 1798790400000, "limitIp": 3, "comment": "Migrated to new server", "group": "silver", "tgId": 123456789, "reset": 30 }, "credentials": { "flow": "xtls-rprx-vision", "security": "auto" }, "inboundChanges": { "attach": [5, 6, 7], "detach": [1, 2] } } ``` **Semantics:** - `"fields"` — only non-null keys are applied. Omitted/null keys are left untouched per client. - `"credentials"` — protocol-gated fields (flow, security). Applied only to clients whose inbounds support those settings. - `"inboundChanges"` — optional array of inbound IDs to attach and/or detach across all selected clients. Both are optional — omit to leave inbound membership untouched. **Response:** ```json { "success": true, "updated": 48, "skipped": [ { "email": "bad@example.com", "reason": "client not found" } ] } ``` Each client is updated independently via the existing `UpdateByEmail` service method so validation (email uniqueness, inbound existence) works identically to the single-edit path. Partial success is reported — the operator only needs to re-check the skipped ones. #### Frontend — new `ClientBatchEditModal` component **File:** `frontend/src/pages/clients/ClientBatchEditModal.tsx` A modal with **3 tab pages** that mirror the existing `ClientFormModal` layout, keeping the mental model consistent: | Tab | Controls | Visibility guard | |---|---|---| | **Basics** | `enable` (three-state Switch), `totalGB` (InputNumber), `expiryTime` (DateTimePicker), `limitIp` (InputNumber), `comment` (Input), `group` (Select/AutoComplete), `tgId` (InputNumber, shown only when tgBot enabled), `reset` (InputNumber), `inboundChanges` (Select multi for attach/detach) | `tgId` only shown when tgBot enabled | | **Credentials** | `flow` (Select: none/vision/vision-udp443), `security` (Select: auto/aes-128-gcm/chacha20-poly1305/none/zero) | `flow` shown only when selected clients have TLS-flow-capable inbounds; `security` only for VMESS inbounds | | **Links** | `externalLinks` — add new link/subscription entries (append-only; doesn't touch existing links) | Always visible | **Three-state controls:** All fields start in a neutral state. The user explicitly sets a field to change it. Boolean fields (`enable`) use a three-state Switch: | Switch appearance | Meaning | |---|---| | Dimmed / indeterminate bar | Don't change enable status | | Blue (on) | Set to true | | Gray (off) | Set to false | For numeric and text fields, a checkbox or toggle beside each control lets the user "activate" it — when inactive, the field's value is not included in the request. **Current value preview:** Below each active control, a compact preview shows the current value of that field for each selected client, so the operator can verify the change is safe before applying: ``` Flow: xtls-rprx-vision ───────────────────────────── user1@example.com: xtls-rprx-vision user2@example.com: (none) ← this one will change user3@example.com: xtls-rprx-vision ``` #### How the user gets there 1. Select ≥2 clients via the existing checkboxes. 2. The toolbar shows the selected-count tag alongside the existing Attach/Detach/Group/Delete buttons. 3. A new **"Batch Edit"** button appears in the toolbar. 4. Clicking it opens the `ClientBatchEditModal`. 5. Fill in only the fields you want to change → click **Apply**. 6. A single API call updates all selected clients; success/error count is shown. #### Integration points (files to modify) | File | Change | |---|---| | `frontend/src/pages/clients/ClientsPage.tsx` | Import `ClientBatchEditModal`; add `batchEditOpen` + `batchEditClients` state; add "Batch Edit" button in toolbar when rows selected; wire to open modal; render `<ClientBatchEditModal>` | | `frontend/src/pages/clients/ClientBatchEditModal.tsx` | **New file** — 3-tab modal component | | `internal/web/controller/client.go` | Add `ClientBulkUpdateRequest` struct + `bulkUpdate` handler that iterates emails + applies partial fields | | `internal/web/service/client.go` | Add `UpdateClientPartial` method that updates only non-null fields, reuses existing `UpdateByEmail` for runtime sync | | `internal/web/web.go` | Register `POST /panel/api/clients/bulkUpdate` | | `internal/web/translation/*.json` | Add ~25 new i18n keys | --- ### How this differs from the existing `ClientBulkAdjustModal` The existing `ClientBulkAdjustModal` serves a **different purpose**. It's an **incremental** tool: "add X days to all these clients' expiry dates" or "add Y GB to all these clients' traffic balances." This is useful for extending service, but it's the only bulk edit the panel offers. The proposed `ClientBatchEditModal` is a **set-to-value** tool: "set all these clients' totalGB to 100GB" or "set all these clients' limitIp to 3" or "disable all these clients." These are fundamentally different operations that require different UI (three-state controls, current-value preview) and different API semantics (partial update, not additive). Both modals should coexist — they target different use cases: | Scenario | Which modal | |---|---| | "Extend all bronze clients by 30 days" | `ClientBulkAdjustModal` (incremental) | | "Set all bronze clients to expire on Dec 31" | `ClientBatchEditModal` (set-to-value) | | "Add 10GB to everyone's balance" | `ClientBulkAdjustModal` (incremental) | | "Set everyone's totalGB to exactly 200GB" | `ClientBatchEditModal` (set-to-value) | ### Alternatives you've considered **Run the existing `bulkAdjust` N times to approximate a set.** You can't. `bulkAdjust` is additive — it only supports `addDays` and `addBytes`. There is no way to "subtract" to reach a specific value, and even if you could, you'd need to know each client's current values, which varies per client. **Single-edit modal for each client.** The status quo. For 50+ clients this is prohibitive. The risk of parameter drift (slightly different values entered per client) is high, and the time cost scales linearly. **Script the REST API.** Possible for a power user, but requires API-token auth, familiarity with the client JSON payload (which varies by protocol — VMESS uses `id`, Trojan uses `password`, SS uses `email`), and manual error handling. Most panel operators are not developers. **Extend `ClientBulkAdjustModal` to support set-to-value mode.** The existing modal is built for two specific additive fields. Adding set-to-value semantics (with three-state controls, current-value preview, and non-additive field dispatch) would completely change its character. It's cleaner to have a dedicated modal with a unified pattern, just like the single-edit `ClientFormModal` already has a different shape from `ClientBulkAdjustModal`. ### Concrete use cases **Use case 1: Bulk disable stale clients.** You run a monthly cleanup where ~200 clients with expired subscriptions should be disabled (not deleted — they might re-subscribe and need their history). Currently you must open each one and uncheck "enable." With batch edit: filter by "expiry before date" → select all → Batch Edit → Basics → set Enable to Off → Apply. 10 seconds instead of 30+ minutes. **Use case 2: Tier migration.** You decide to increase the `limitIp` on all "premium" clients from 3 to 5. You have 85 premium clients. Without batch edit: you open each form and change limitIp, one by one. With batch edit: filter by group "premium" → select all → Batch Edit → set limitIp → Apply. 5 seconds. **Use case 3: Bulk protocol migration.** You migrate from VMESS to VLESS and need to update the flow control on 60 VLESS clients from "none" to `xtls-rprx-vision`. Without batch edit: 60 individual edits. With batch edit: select the 60 → Batch Edit → Credentials → set Flow → Apply. 5 seconds. **Use case 4: Server migration comment.** You're migrating 120 clients from server A to server B. You want to set their `comment` field to "Migrated to server B — June 2026" so support staff know where they are. Without batch edit: not achievable in bulk — you'd have to script the API or do 120 manual edits. With batch edit: select the 120 → Batch Edit → set comment → Apply. **Use case 5: Uniform traffic cap.** A promotional campaign gives 50 new clients a 500GB traffic cap. After the campaign ends, you need to **set** (not add) their `totalGB` to exactly 100GB. The existing bulkAdjust only adds traffic — you can't reduce. With batch edit: select the 50 → Batch Edit → set totalGB → Apply. 5 seconds. --- ### Appendix: i18n keys | Key | English | |---|---| | `pages.clients.batchEditClients` | Batch Edit Clients | | `pages.clients.batchEditTabBasics` | Basics | | `pages.clients.batchEditTabCredentials` | Credentials | | `pages.clients.batchEditTabLinks` | Links | | `pages.clients.batchEditKeepOriginal` | Keep original | | `pages.clients.batchEditApply` | Apply | | `pages.clients.batchEditSaved` | Clients updated | | `pages.clients.batchEditPartialError` | Some clients failed to update | | `pages.clients.batchEditAttachInbounds` | Attach to inbounds | | `pages.clients.batchEditDetachInbounds` | Detach from inbounds | | `pages.clients.batchEditNoMatchingClients` | No matching clients | | `pages.clients.batchEditAndMore` | and {count} more | | `pages.clients.batchEditShowCurrent` | Show current values | ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? Backend (API endpoints, login, settings) ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Jun 16, 2026):

The gap you describe is confirmed in the source. The existing POST /panel/api/clients/bulkAdjust endpoint (registered in internal/web/controller/client.go:62) accepts only emails, addDays, and addBytes — strictly additive adjustments. The corresponding ClientBulkAdjustModal.tsx reflects exactly this: two InputNumber fields and no set-to-value semantics. There is no bulkUpdate (set-to-value) endpoint or modal anywhere in the codebase.

What already exists that a PR could build on:

  • The per-client update path is POST /panel/api/clients/update/:email, handled by (ClientController).update in internal/web/controller/client.go:153, which calls (ClientService).UpdateByEmail in internal/web/service/client_crud.go:569. That method does a full replacement of the model.Client fields inside each inbound's settings JSON and propagates to the Xray runtime and any attached nodes.
  • Existing bulk operations (BulkDelete, BulkAdjust, BulkAttach, BulkDetach) in internal/web/service/client_bulk.go all follow the same pattern: deduplicate emails → group by inbound → one read-modify-write per inbound → single DB transaction per inbound → broadcast notifyClientsChanged(). A new BulkUpdate service method would follow the same structure.
  • The toolbar infrastructure in frontend/src/pages/clients/ClientsPage.tsx already wires up selectedRowKeys, the selection count tag, and lazy-loaded modals (ClientBulkAdjustModal, BulkAttachInboundsModal, BulkDetachInboundsModal, BulkAddToGroupModal) — adding a new button and a new lazy-imported modal fits the existing pattern directly.

Design considerations for an implementation:

  • A BulkUpdate service method should not reuse UpdateByEmail in a loop; doing so would re-read and re-write each inbound's settings JSON once per email, which is the same O(emails × inbounds) pattern the existing bulk methods deliberately avoid. The inbound-grouping pattern from bulkAdjustInboundClients / bulkDelInboundClients is the right model.
  • UpdateByEmail in client_crud.go takes a full model.Client value — partial/set-to-value semantics would require either a separate struct with pointer/nullable fields or a map[string]any patch approach, similar to how bulkAdjustInboundClients applies fields selectively to the inbound settings JSON (map[string]any).
  • Protocol-gated fields (flow, VMess security) require reading the inbound's protocol before deciding whether to write the field, so the per-inbound grouping naturally accommodates this.
  • The enable field lives only in the inbound settings JSON client entry; totalGB and expiryTime are mirrored in both the inbound JSON and the client_traffics table (as total and expiry_time). A correct implementation must update both locations, as bulkAdjustInboundClients does at lines 401–414 of client_bulk.go.

A PR implementing this would touch: internal/web/service/client_bulk.go (new BulkUpdate method), internal/web/controller/client.go (new handler + struct), the route group in initRouter, and the frontend (ClientBatchEditModal.tsx + wiring in ClientsPage.tsx + i18n keys).

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4714464525 --> @github-actions[bot] commented on GitHub (Jun 16, 2026): The gap you describe is confirmed in the source. The existing `POST /panel/api/clients/bulkAdjust` endpoint (registered in `internal/web/controller/client.go:62`) accepts only `emails`, `addDays`, and `addBytes` — strictly additive adjustments. The corresponding `ClientBulkAdjustModal.tsx` reflects exactly this: two `InputNumber` fields and no set-to-value semantics. There is no `bulkUpdate` (set-to-value) endpoint or modal anywhere in the codebase. **What already exists that a PR could build on:** - The per-client update path is `POST /panel/api/clients/update/:email`, handled by `(ClientController).update` in `internal/web/controller/client.go:153`, which calls `(ClientService).UpdateByEmail` in `internal/web/service/client_crud.go:569`. That method does a full replacement of the `model.Client` fields inside each inbound's settings JSON and propagates to the Xray runtime and any attached nodes. - Existing bulk operations (`BulkDelete`, `BulkAdjust`, `BulkAttach`, `BulkDetach`) in `internal/web/service/client_bulk.go` all follow the same pattern: deduplicate emails → group by inbound → one read-modify-write per inbound → single DB transaction per inbound → broadcast `notifyClientsChanged()`. A new `BulkUpdate` service method would follow the same structure. - The toolbar infrastructure in `frontend/src/pages/clients/ClientsPage.tsx` already wires up `selectedRowKeys`, the selection count tag, and lazy-loaded modals (`ClientBulkAdjustModal`, `BulkAttachInboundsModal`, `BulkDetachInboundsModal`, `BulkAddToGroupModal`) — adding a new button and a new lazy-imported modal fits the existing pattern directly. **Design considerations for an implementation:** - A `BulkUpdate` service method should not reuse `UpdateByEmail` in a loop; doing so would re-read and re-write each inbound's settings JSON once per email, which is the same O(emails × inbounds) pattern the existing bulk methods deliberately avoid. The inbound-grouping pattern from `bulkAdjustInboundClients` / `bulkDelInboundClients` is the right model. - `UpdateByEmail` in `client_crud.go` takes a full `model.Client` value — partial/set-to-value semantics would require either a separate struct with pointer/nullable fields or a `map[string]any` patch approach, similar to how `bulkAdjustInboundClients` applies fields selectively to the inbound settings JSON (`map[string]any`). - Protocol-gated fields (`flow`, VMess `security`) require reading the inbound's protocol before deciding whether to write the field, so the per-inbound grouping naturally accommodates this. - The `enable` field lives only in the inbound settings JSON client entry; `totalGB` and `expiryTime` are mirrored in both the inbound JSON and the `client_traffics` table (as `total` and `expiry_time`). A correct implementation must update both locations, as `bulkAdjustInboundClients` does at lines 401–414 of `client_bulk.go`. A PR implementing this would touch: `internal/web/service/client_bulk.go` (new `BulkUpdate` method), `internal/web/controller/client.go` (new handler + struct), the route group in `initRouter`, and the frontend (`ClientBatchEditModal.tsx` + wiring in `ClientsPage.tsx` + i18n keys). *This reply was generated automatically; a maintainer may follow up.*
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#3757
No description provided.