fix(ui): отделить измерения цепочек от модели
This commit is contained in:
1 parent
9404bd5136
commit
255f272fab
7 files changed
+82
-13
No files matched your search
@@ -43,7 +43,21 @@ export interface ExitNode {
|
||||
ip: string
|
||||
}
|
||||
|
||||
export interface OptimizerObservedMetrics {
|
||||
probeId: string | null
|
||||
pingMs: number | null
|
||||
lossPct: number | null
|
||||
dlMbps: number | null
|
||||
ulMbps: number | null
|
||||
pingAt: string | null
|
||||
}
|
||||
|
||||
export function readOptimizerObservedMetrics(probe?: RouteOptimizerSpeedProbe): OptimizerObservedMetrics {
|
||||
return {probeId:probe?.id ?? null,pingMs:probe?.lastPingRttMs ?? null,lossPct:probe?.lastPingLossPct ?? null,dlMbps:probe?.lastTxAvgMbps ?? null,ulMbps:probe?.lastRxAvgMbps ?? null,pingAt:probe?.lastPingAt ?? null}
|
||||
}
|
||||
|
||||
export interface WanJhLeg {
|
||||
observed?: OptimizerObservedMetrics
|
||||
wanId: string
|
||||
jhId: string
|
||||
pingMs: number
|
||||
@@ -54,6 +68,7 @@ export interface WanJhLeg {
|
||||
}
|
||||
|
||||
export interface JhExLeg {
|
||||
observed?: OptimizerObservedMetrics
|
||||
jhId: string
|
||||
exitId: string
|
||||
pingMs: number
|
||||
@@ -464,6 +479,7 @@ export function buildLiveOptimizerData(
|
||||
? Math.max(0, Math.min(100, Math.round(probe.lastPingLossPct)))
|
||||
: (!homeOnline || !jhOnline ? 100 : 0)
|
||||
wanJhLegs.push({
|
||||
observed: readOptimizerObservedMetrics(probe),
|
||||
wanId: wan.id,
|
||||
jhId: jh.id,
|
||||
pingMs: ping,
|
||||
@@ -494,6 +510,7 @@ export function buildLiveOptimizerData(
|
||||
? Math.max(1, Math.round(probe.lastRxAvgMbps))
|
||||
: modelBw.ul
|
||||
jhExMap.set(`${jh.id}::${ex.id}`, {
|
||||
observed: readOptimizerObservedMetrics(probe),
|
||||
jhId: jh.id,
|
||||
exitId: ex.id,
|
||||
pingMs: ping,
|
||||
|
||||
Reference in new issue
Block a user