Dashboard Utilities
Dashboard data utilities and helpers
Utilities for dashboard data processing.
Package
@tetherto/mdk-ui-foundation
Utilities
buildHashrateTailLogParams
Hashrate tail-log params — per-miner 1-minute aggregate, summed across the t-miner tag.
Function
(range: DashboardQueryRange) => TailLogParamsbuildMinerpoolStatsHistoryExtDataParams
Ext-data params for type=minerpool, key=stats-history — per-pool hashrate snapshots over time. Pair with extDataQuery to feed the multi-series Hash Rate chart (Mining OS + Aggr Pool + per-pool lines).
Function
(range: MinerpoolStatsHistoryRange = {}) => ExtDataParamsbuildSiteConsumptionTailLogParams
Site-level consumption tail-log params — reads the dedicated powermeter's site_power_w aggregate (Mining OS's type=powermeter, tag=t-powermeter, aggrFields={site_power_w:1} query). Returns the same series the header's `useSitePowerMete…
Function
(range: DashboardQueryRange) => TailLogParamsDEFAULT_TIMELINE_OPTIONS
Canonical short-form intervals exposed by MDK UI Shell. The keys map onto the key=stat-<value> query parameter expected by GET /auth/tail-log.
Constant
readonly TimelineOption[]getTimelineOptions
Default options for the dashboard timeline selector. Mirrors Mining OS's timelineRadioButtons (5m / 30m / 3h / 1D) — the production dashboard doesn't expose stat-1m because the backend typically only emits 5-minute and longer aggregate…
Function
(opts: { includeOneMinute?: boolean } = {}) => TimelineOption[]normalizeAlertSeverity
Narrow an arbitrary backend severity string to the AlertSeverity literal union expected by the ActiveIncidentsCard row component. Unknown values fall back to 'medium' so the row still renders rather than crashing on an unexpected pay…
Function
(raw: string | null | undefined) => AlertSeverityreadHashrateMhs
Reads the hashrate aggregate from a tail-log entry. Mining OS emits hashrate_mhs_1m_sum_aggr across every stat-* bucket, so a single field check covers all timelines; the _5m_ legacy fallback is retained as a defensive secondary in c…
Function
(entry: { hashrate_mhs_1m_sum_aggr?: unknown hashrate_mhs_5m_sum_aggr?: unknown }) => number | undefinedSEVERITY_WEIGHT
Severity level → numeric weight. Higher is more urgent. Used for sorting the active-incidents list (most-severe first).
Constant
Record<AlertSeverity, number>