history(drawer): restore sub-day ranges to the metrics history select
Some checks are pending
Build and Test / Secret Scan (push) Waiting to run
Build and Test / Frontend & Backend (push) Waiting to run

v5 drawers offered 1h/6h/12h history zoom; the v6 shared range list
started at 24 hours, so an operator investigating a spike from the last
hour got a day-wide chart. The backend chart range parser and the
HistoryTimeRange type already support the shorter windows; only the
shared HISTORY_CHART_RANGES list and the drawer labels were missing
them. StoragePoolDetail keeps its own narrower range list and is
unaffected. Flagged by the Machines page v5 parity audit; applies to
every drawer History tab.
This commit is contained in:
rcourtman 2026-06-11 21:50:20 +01:00
parent db842cb6b5
commit 9068f3bc6c
3 changed files with 18 additions and 3 deletions

View file

@ -74,6 +74,12 @@ const EMPTY_HISTORY_RESPONSE: AllMetricsHistoryResponse = {
const formatRangeLabel = (range: HistoryTimeRange): string => {
switch (range) {
case '1h':
return '1 hour';
case '6h':
return '6 hours';
case '12h':
return '12 hours';
case '24h':
return '24 hours';
case '7d':

View file

@ -118,8 +118,8 @@ describe('HistoryChart', () => {
expect(screen.getByText('History')).toBeInTheDocument();
});
it('exposes the Relay history range as a first-class chart option', () => {
expect(HISTORY_CHART_RANGES).toEqual(['24h', '7d', '14d', '30d', '90d']);
it('exposes the sub-day and Relay history ranges as first-class chart options', () => {
expect(HISTORY_CHART_RANGES).toEqual(['1h', '6h', '12h', '24h', '7d', '14d', '30d', '90d']);
});
it('positions the tooltip beside the hovered point when there is chart space', () => {

View file

@ -31,7 +31,16 @@ export interface HistoryChartTooltipLayout {
height: number;
}
export const HISTORY_CHART_RANGES: HistoryTimeRange[] = ['24h', '7d', '14d', '30d', '90d'];
export const HISTORY_CHART_RANGES: HistoryTimeRange[] = [
'1h',
'6h',
'12h',
'24h',
'7d',
'14d',
'30d',
'90d',
];
export function formatHistoryChartTooltipValue(value: number, unit?: string): string {
if (unit === '%') return `${value.toFixed(1)}%`;