feat(statistics): добавить BI-разрез и сводную матрицу
Docker images / prepare-release (push) Successful in 10s
Docker images / backend-test (push) Successful in 2m23s
Docker images / frontend-image (push) Successful in 3m30s
Docker images / updater-image (push) Successful in 52s
Docker images / backend-image (push) Successful in 3m8s
Docker images / notify-webhook (push) Skipped
Docker images / publish-release (push) Successful in 14s

Сопоставить клиентов с ifIndex как на карте трафика, чтобы KPI пользователей не обнулялся. На экране — разрез остальных измерений и сводная матрица.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-09-10 16:07:25 +07:00
co-authored by Cursor
parent b1fd259f10
commit 5bb9066be8
16 changed files with 1119 additions and 199 deletions
+27 -2
View File
@@ -1,7 +1,13 @@
import type { StatisticsDto, StatisticsQuery } from "@mmapp/contracts/statistics"
import type {
StatisticsDto,
StatisticsPivotDto,
StatisticsPivotQuery,
StatisticsQuery,
} from "@mmapp/contracts/statistics"
import { requestJson } from "@/shared/api/http-client"
export type { StatisticsDto, StatisticsQuery }
export type { StatisticsDto, StatisticsQuery, StatisticsPivotDto, StatisticsPivotQuery }
export { STATISTICS_UNBOUND_USER_ID } from "@mmapp/contracts/statistics"
export async function getStatistics(
baseUrl: string,
@@ -18,3 +24,22 @@ export async function getStatistics(
if (query.asn != null) params.set("asn", String(query.asn))
return requestJson<StatisticsDto>(baseUrl, `/api/statistics?${params.toString()}`)
}
export async function getStatisticsPivot(
baseUrl: string,
query: StatisticsPivotQuery,
): Promise<StatisticsPivotDto> {
const params = new URLSearchParams()
params.set("from", query.from)
params.set("to", query.to)
params.set("row", query.row)
params.set("col", query.col)
params.set("metric", query.metric)
if (query.serverId != null) params.set("serverId", String(query.serverId))
if (query.userId) params.set("userId", query.userId)
if (query.iface) params.set("iface", query.iface)
if (query.country) params.set("country", query.country)
if (query.service) params.set("service", query.service)
if (query.asn != null) params.set("asn", String(query.asn))
return requestJson<StatisticsPivotDto>(baseUrl, `/api/statistics/pivot?${params.toString()}`)
}