mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-25 20:15:01 +03:00
feat(clients): show a client's usage and change history in the editor (#7031)
The client editor gets a "Usage & change history" button: lifetime traffic (every closed cycle plus the open one), usage per node since the last reset, the past cycles, and a log of what changed on the client and from where. A cycle is archived in one place, whenever a traffic reset or an auto-renewal zeroes a client's counters. Both tables are bounded per client: the newest 100 cycles are kept and older ones fold into a single "earlier" row, so the lifetime total does not change; the change log keeps the newest 200 rows and is taken from the stored record before and after an operation (editor save, bulk adjust, bulk enable/disable, bot setters, auto-renewal). A rename moves the history to the new email. The history belongs to the client. Nothing is archived on delete; ReapSyncOrphansJob drops the history of emails no client holds, every five minutes. It lists them outside the traffic writer by walking the email index (about 10 ms on SQLite for 10k clients with 3M history rows) and enters the writer only to delete. Known limit: a client re-created under a deleted client's email before that job runs keeps the old client's history. Edits through an API token are logged with the source "panel".
This commit is contained in:
committed by
GitHub
parent
a36858f36c
commit
ee760de2c8
@@ -114,6 +114,16 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: PostgreSQL client usage history
|
||||
run: |
|
||||
set -o pipefail
|
||||
go test ./internal/web/service -run '^TestClientUsageHistoryPostgres$' -count=1 -v | tee /tmp/postgres-usage-history.log
|
||||
passed=$(grep -c -- '^--- PASS' /tmp/postgres-usage-history.log || true)
|
||||
if [ "$passed" -ne 1 ]; then
|
||||
echo "expected 1 passing PostgreSQL client usage history test, got $passed" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: PostgreSQL depletion query regressions
|
||||
run: |
|
||||
set -o pipefail
|
||||
|
||||
Reference in New Issue
Block a user