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]>
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import type { StatisticsPivotDim } from "@mmapp/contracts/statistics"
|
|
import type { StatisticsSliceKind } from "@/components/data-grids/statistics-breakdown-data-grid"
|
|
|
|
export const STATISTICS_DIMS: {
|
|
id: StatisticsSliceKind
|
|
pivot: StatisticsPivotDim
|
|
label: string
|
|
}[] = [
|
|
{ id: "users", pivot: "user", label: "Пользователи" },
|
|
{ id: "servers", pivot: "server", label: "Серверы" },
|
|
{ id: "interfaces", pivot: "iface", label: "Интерфейсы" },
|
|
{ id: "countries", pivot: "country", label: "Страны" },
|
|
{ id: "services", pivot: "service", label: "Сервисы" },
|
|
{ id: "asns", pivot: "asn", label: "ASN" },
|
|
]
|
|
|
|
export function isStatisticsSliceKind(v: string): v is StatisticsSliceKind {
|
|
return STATISTICS_DIMS.some((d) => d.id === v)
|
|
}
|
|
|
|
export function isStatisticsPivotDim(v: string): v is StatisticsPivotDim {
|
|
return STATISTICS_DIMS.some((d) => d.pivot === v)
|
|
}
|
|
|
|
export function sliceKindToPivot(kind: StatisticsSliceKind): StatisticsPivotDim {
|
|
return STATISTICS_DIMS.find((d) => d.id === kind)?.pivot ?? "user"
|
|
}
|
|
|
|
export function pivotToSliceKind(dim: StatisticsPivotDim): StatisticsSliceKind {
|
|
return STATISTICS_DIMS.find((d) => d.pivot === dim)?.id ?? "users"
|
|
}
|