Docker images / prepare-release (push) Successful in 9s
Docker images / backend-image (push) Successful in 1m43s
Docker images / frontend-image (push) Successful in 2m58s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 39s
Docker images / publish-release (push) Successful in 8s
Replaced existing KPI display implementations across multiple pages with the new KpiStatGrid component for a more consistent and visually appealing presentation of statistics. Updated the Backups, BGP, Certificates, Communities, Containers, Dashboard, and Data Collection pages to utilize the KpiStatGrid, improving the overall user experience and maintainability of the codebase. Additionally, added new dependencies in package.json for required libraries.
29 lines
954 B
TypeScript
29 lines
954 B
TypeScript
/** Формат скорости: Кбит/с при < 1 Мбит/с, иначе Мбит/с / Гбит/с. */
|
||
export function fmtRate(v: number): string {
|
||
if (!Number.isFinite(v) || v <= 0) return "0 Кбит/с"
|
||
if (v >= 1000) return `${(v / 1000).toFixed(2)} Гбит/с`
|
||
if (v < 1) return `${Math.round(v * 1000)} Кбит/с`
|
||
if (v < 10) return `${v.toFixed(2)} Мбит/с`
|
||
if (v < 100) return `${v.toFixed(1)} Мбит/с`
|
||
return `${Math.round(v)} Мбит/с`
|
||
}
|
||
|
||
export function fmtGB(v: number): string {
|
||
if (v >= 1000) return `${(v / 1000).toFixed(2)} ТБ`
|
||
return `${v.toFixed(1)} ГБ`
|
||
}
|
||
|
||
export const TRAFFIC_RANGE_MINUTES: Record<string, number> = {
|
||
"5m": 5,
|
||
"15m": 15,
|
||
"1h": 60,
|
||
"4h": 240,
|
||
"24h": 1440,
|
||
}
|
||
|
||
export function formatRangeAgo(minutesAgo: number): string {
|
||
if (minutesAgo <= 0) return "сейчас"
|
||
if (minutesAgo < 60) return `−${minutesAgo}м`
|
||
return `−${Math.round(minutesAgo / 60)}ч`
|
||
}
|