mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-07-09 16:00:59 +00:00
history(drawer): restore sub-day ranges to the metrics history select
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:
parent
db842cb6b5
commit
9068f3bc6c
3 changed files with 18 additions and 3 deletions
|
|
@ -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':
|
||||
|
|
|
|||
|
|
@ -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', () => {
|
||||
|
|
|
|||
|
|
@ -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)}%`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue