Carry over rolling preset id to popout tabs and add range controls to standalone Metrics/Dashboards
Popped-out tabs now carry the active TimeRangePresetId (e.g. "5m") via a `preset` query param instead of only resolved absolute startMs/endMs, so a rolling preset keeps independently sliding in the new tab on its own polling cadence rather than freezing to the source tab's window at open time. A fixed/dragged range is still carried over as absolute bounds. StandaloneRanged (metrics/dashboards standalone pages) now owns its own preset/range state and renders LogTimeline for its own preset buttons and drag-to-select UI, instead of only ever showing a frozen, uncontrollable range. log and params standalone pages are unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
e6e5bc8f50
commit
7463050357
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import type { TimeRange } from './LogTimeline'
|
||||
import type { TimeRange, TimeRangePresetId } from './LogTimeline'
|
||||
import {
|
||||
ApiError,
|
||||
declareMetric,
|
||||
@@ -69,7 +69,7 @@ function sparkline(values: BucketValue[], range: TimeRange | null): string {
|
||||
return slots.map((count) => SPARK_CHARS[Math.round((count / max) * (SPARK_CHARS.length - 1))]).join('')
|
||||
}
|
||||
|
||||
export function Metrics({ range }: { range: TimeRange | null }) {
|
||||
export function Metrics({ range, activePreset }: { range: TimeRange | null; activePreset?: TimeRangePresetId | null }) {
|
||||
const [metrics, setMetrics] = useState<MetricDeclaration[]>([])
|
||||
const [selected, setSelected] = useState<string | null>(null)
|
||||
const [bucketValues, setBucketValues] = useState<BucketValue[]>([])
|
||||
@@ -158,7 +158,7 @@ export function Metrics({ range }: { range: TimeRange | null }) {
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<CollapseToggle collapsed={collapsed} onToggle={() => setCollapsed(!collapsed)} />
|
||||
<PopOutButton section="metrics" range={range} />
|
||||
<PopOutButton section="metrics" range={range} activePreset={activePreset} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-4 p-3" hidden={collapsed}>
|
||||
|
||||
Reference in New Issue
Block a user