Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Name history ranges the same way in every range picker

rcourtman5f046de046d3
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index b08240ab53..ee7417f984 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -5474,7 +5474,11 @@ behind it spans every bucket's own lowest and highest reading
(`buildGuestDrawerHistoryBandPath`): a short spike stays visible after
downsampling. While a time is inspected the readout names that bucket's peak
when it rises at least a tenth of the plot above the average, and the
-accessible value states each reading's average and range. Any
+accessible value states each reading's average and range. Every history range
+picker (these drawers, storage disk and pool details) names its options through
+`formatHistoryRangeOptionLabel` in `historyChartModel.ts` ("1 hour", "24 hours",
+"7 days"), so one range is never shown as "24h", "24 hours" and "Last 24 hours"
+in three places. Any
warning- or danger-toned detail row
is lifted into a "Worth checking" section in front, whichever section owns it,
so demotion never hides a reason a reading cannot be trusted. Guest
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 8a3f81c6f9..650e679ffa 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -4018,7 +4018,9 @@ Numeric gridline labels are computed from the scale the panel already holds;
the compact "Worth checking" list reuses rows already derived, and an alert's
dashed trigger line reuses the alert the drawer already holds. The min-max band
reads the `min`/`max` each stored bucket already carries: one extra path per
-series with any spread (none for flat data). None adds a read or timer.
+series with any spread (none for flat data). Range picker option labels come
+from one lookup table (`formatHistoryRangeOptionLabel`). None adds a read or
+timer.
The default stored-history legend resolves one latest timestamp from that
same bounded, normalized panel index, then looks up each configured series at
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 1b3537c78b..55ffbee399 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -2878,7 +2878,9 @@ canonical pre-handler authorization proof covering both transfer routes.
picker, then configuration, topology and devices; a disk detail shows its
health verdict and SMART facts, then its History charts with the range
picker beside their heading, then live I/O. With only one view left, these
- details render no `Subtabs` strip. The range picker keeps the shared
+ details render no `Subtabs` strip. Both pickers label their options with
+ the shared `formatHistoryRangeOptionLabel` ("24 hours", "7 days"), the
+ same names the resource drawers use. The range picker keeps the shared
filter-select presentation; storage must not restore the retired
storage-local range-selector classes and inline SVG select decoration.
Storage-page pool growth readouts belong to that same contract: the table
diff --git a/frontend-modern/browser-verification/93d562febbfee7a9.json b/frontend-modern/browser-verification/93d562febbfee7a9.json
new file mode 100644
index 0000000000..0082d61b5c
--- /dev/null
+++ b/frontend-modern/browser-verification/93d562febbfee7a9.json
@@ -0,0 +1,43 @@
+{
+ "version": 1,
+ "base_sha": "f0108e4930d44c9658c07ae62ca27e2bcd97f84f",
+ "verified_at": "2026-10-13T22:55:00Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx",
+ "frontend-modern/src/components/shared/historyChartModel.ts",
+ "frontend-modern/src/features/storageBackups/diskDetailPresentation.ts",
+ "frontend-modern/src/features/storageBackups/storagePoolDetailPresentation.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx": "3e0f85039b2be039ec8468b372c8adddef47f5ab1208d50859918e7f19af734f",
+ "frontend-modern/src/components/shared/historyChartModel.ts": "371473b262149f0fde298859a6d01d52c51f833f0e7755cbad8ea86db6970be6",
+ "frontend-modern/src/features/storageBackups/diskDetailPresentation.ts": "65f193c01c2e5b5f8a6f4869de701dfe8a44c9abb15f4a4d45476e878cd16c6d",
+ "frontend-modern/src/features/storageBackups/storagePoolDetailPresentation.ts": "8b7ee924acbb6e4a341c3ea02c5c03b0cf19383ad33b5d864e4462409bd30830"
+ },
+ "routes": [
+ "/proxmox/overview",
+ "/proxmox/storage",
+ "/proxmox/storage?tab=disks"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "final built bytes of this tree (origin/main plus PRs 2918/2920 and this change) embedded in a darwin binary, mock mode, read in the in-app browser (DOM option text) at the pane width and confirmed by screenshot of the disk History heading",
+ "guest drawer range picker options read: 1 hour, 6 hours, 12 hours, 24 hours, 7 days, 14 days, 30 days, 90 days",
+ "pool Capacity Trend picker options read: 24 hours, 7 days (the instance plan keeps 7 days, so longer pool ranges are withheld as before)",
+ "physical disk History picker options read: 1 hour, 6 hours, 12 hours, 24 hours, 7 days, selected 24 hours",
+ "the 390px width was covered by the earlier storage pass on the same layout; option text does not change with width"
+ ],
+ "interactions": [
+ "expanded the first guest row, a service pool row and the first physical disk row and read each picker's option list"
+ ]
+}
diff --git a/frontend-modern/src/components/Storage/__tests__/DiskDetail.test.tsx b/frontend-modern/src/components/Storage/__tests__/DiskDetail.test.tsx
index 26fc8d7c87..ccd04f7f21 100644
--- a/frontend-modern/src/components/Storage/__tests__/DiskDetail.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/DiskDetail.test.tsx
@@ -68,6 +68,14 @@ describe('DiskDetail', () => {
'24h',
'7d',
]);
+ // The same option names as every other history range picker.
+ expect(Array.from(rangeSelector.options).map((option) => option.textContent)).toEqual([
+ '1 hour',
+ '6 hours',
+ '12 hours',
+ '24 hours',
+ '7 days',
+ ]);
expect(Array.from(rangeSelector.options).map((option) => option.value)).not.toContain('14d');
expect(Array.from(rangeSelector.options).map((option) => option.value)).not.toContain('90d');
expect(screen.getAllByTestId('history-chart-hover-group')).toHaveLength(2);
diff --git a/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx b/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx
index 15fbd6d413..a47a3a8ed7 100644
--- a/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx
+++ b/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx
@@ -19,6 +19,7 @@ import { LoadingSpinner } from '@/components/shared/LoadingSpinner';
import {
HISTORY_CHART_RANGES,
formatHistoryChartTooltipValue,
+ formatHistoryRangeOptionLabel,
formatHistoryChartTimeLabel,
} from '@/components/shared/historyChartModel';
import { isRangeLocked, loadRuntimeCapabilities, maxHistoryDays } from '@/stores/license';
@@ -88,29 +89,6 @@ const GUEST_DRAWER_HISTORY_PLOT_RIGHT = 8;
const GUEST_DRAWER_HISTORY_PLOT_TOP = 8;
const GUEST_DRAWER_HISTORY_PLOT_BOTTOM = 18;
-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':
- return '7 days';
- case '14d':
- return '14 days';
- case '30d':
- return '30 days';
- case '90d':
- return '90 days';
- default:
- return range;
- }
-};
-
// A guest and a node drawer can be open together, so each picker owns its id.
export const GuestDrawerHistoryRangeSelect: Component<GuestDrawerHistoryRangeSelectProps> = (
props,
@@ -130,7 +108,7 @@ export const GuestDrawerHistoryRangeSelect: Component<GuestDrawerHistoryRangeSel
onChange={(event) => props.onRangeChange(event.currentTarget.value as HistoryTimeRange)}
>
<For each={HISTORY_CHART_RANGES}>
- {(option) => <option value={option}>{formatRangeLabel(option)}</option>}
+ {(option) => <option value={option}>{formatHistoryRangeOptionLabel(option)}</option>}
</For>
</FormSelect>
);
@@ -918,8 +896,8 @@ export const GuestDrawerHistory: Component<GuestDrawerHistoryProps> = (props) =>
when={!locked()}
fallback={
<div class="rounded-xs border border-border bg-surface p-5 text-sm text-muted">
- {formatRangeLabel(props.range)} history requires a higher license plan. This
- instance's plan retains {maxHistoryDays()} days.
+ {formatHistoryRangeOptionLabel(props.range)} history requires a higher license plan.
+ This instance's plan retains {maxHistoryDays()} days.
</div>
}
>
diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.inspection.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.inspection.test.tsx
index ad3e24771a..853e320d4b 100644
--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.inspection.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.inspection.test.tsx
@@ -390,3 +390,21 @@ describe('buildGuestDrawerHistoryBandPath', () => {
expect(path).toBe('M34.00,8.00 L352.00,8.00 L352.00,74.00 L34.00,74.00 Z');
});
});
+
+describe('drawer History range picker', () => {
+ it('names its options the same way as every history range picker', async () => {
+ vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(response());
+ render(() => <GuestDrawerHistory target={target} range="24h" onRangeChange={() => {}} />);
+ const picker = (await screen.findByTestId('guest-history-range-control')) as HTMLSelectElement;
+ expect(Array.from(picker.options).map((option) => option.textContent)).toEqual([
+ '1 hour',
+ '6 hours',
+ '12 hours',
+ '24 hours',
+ '7 days',
+ '14 days',
+ '30 days',
+ '90 days',
+ ]);
+ });
+});
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 99c5827744..92dac51ef7 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -1319,6 +1319,9 @@ describe('shared primitive guardrails', () => {
expect(source).not.toContain("value: 'history', label: 'History'");
}
expect(resourceDetailDrawerSource).not.toContain("activeTab() === 'history'");
+ // Range pickers name their options from one table, never a local list.
+ expect(guestDrawerHistorySource).toContain('formatHistoryRangeOptionLabel(option)');
+ expect(guestDrawerHistorySource).not.toContain('const formatRangeLabel');
expect(resourceDetailDrawerSource).toContain('@/components/shared/Subtabs');
expect(resourceDetailDrawerSource).toContain('tabs={drawer.tabs().map');
diff --git a/frontend-modern/src/components/shared/__tests__/historyChartModel.branchcov2.test.ts b/frontend-modern/src/components/shared/__tests__/historyChartModel.branchcov2.test.ts
index fb517d9ae6..a2f9595624 100644
--- a/frontend-modern/src/components/shared/__tests__/historyChartModel.branchcov2.test.ts
+++ b/frontend-modern/src/components/shared/__tests__/historyChartModel.branchcov2.test.ts
@@ -5,6 +5,7 @@ import {
findHistoryChartClosestPoint,
formatHistoryChartTimeLabel,
formatHistoryChartTooltipValue,
+ formatHistoryRangeOptionLabel,
getHistoryChartAccessibleDescription,
getHistoryChartAccessibleLabel,
getHistoryChartDataMax,
@@ -595,3 +596,21 @@ describe('getHistoryChartTooltipLayout', () => {
expect(layout.y + layout.height).toBe(172);
});
});
+
+describe('formatHistoryRangeOptionLabel', () => {
+ it('names every range one way across drawer, disk and pool pickers', async () => {
+ const { DISK_DETAIL_HISTORY_RANGE_OPTIONS } =
+ await import('@/features/storageBackups/diskDetailPresentation');
+ const { STORAGE_POOL_DETAIL_HISTORY_RANGE_OPTIONS } =
+ await import('@/features/storageBackups/storagePoolDetailPresentation');
+ expect(formatHistoryRangeOptionLabel('1h')).toBe('1 hour');
+ expect(formatHistoryRangeOptionLabel('24h')).toBe('24 hours');
+ expect(formatHistoryRangeOptionLabel('7d')).toBe('7 days');
+ for (const option of [
+ ...DISK_DETAIL_HISTORY_RANGE_OPTIONS,
+ ...STORAGE_POOL_DETAIL_HISTORY_RANGE_OPTIONS,
+ ]) {
+ expect(option.label).toBe(formatHistoryRangeOptionLabel(option.value));
+ }
+ });
+});
diff --git a/frontend-modern/src/components/shared/historyChartModel.ts b/frontend-modern/src/components/shared/historyChartModel.ts
index fbf3e3f578..103bff018a 100644
--- a/frontend-modern/src/components/shared/historyChartModel.ts
+++ b/frontend-modern/src/components/shared/historyChartModel.ts
@@ -44,6 +44,23 @@ export const HISTORY_CHART_RANGES: HistoryTimeRange[] = [
export const HISTORY_CHART_MIN_LEFT_INSET = 40;
+// The one label every history range picker shows for an option, so a drawer,
+// a disk and a pool never name the same range three ways.
+const HISTORY_RANGE_OPTION_LABELS: Record<HistoryTimeRange, string> = {
+ '30m': '30 minutes',
+ '1h': '1 hour',
+ '6h': '6 hours',
+ '12h': '12 hours',
+ '24h': '24 hours',
+ '7d': '7 days',
+ '14d': '14 days',
+ '30d': '30 days',
+ '90d': '90 days',
+};
+
+export const formatHistoryRangeOptionLabel = (range: HistoryTimeRange): string =>
+ HISTORY_RANGE_OPTION_LABELS[range] ?? range;
+
const HISTORY_CHART_RANGE_LABELS: Record<HistoryTimeRange, string> = {
'30m': '30-minute',
'1h': '1-hour',
diff --git a/frontend-modern/src/features/storageBackups/diskDetailPresentation.ts b/frontend-modern/src/features/storageBackups/diskDetailPresentation.ts
index 4e58c0f28f..474110e99b 100644
--- a/frontend-modern/src/features/storageBackups/diskDetailPresentation.ts
+++ b/frontend-modern/src/features/storageBackups/diskDetailPresentation.ts
@@ -8,6 +8,7 @@ import type { HistoryTimeRange } from '@/api/charts';
import { formatPowerOnHours } from '@/utils/format';
import { getMetricSeverity, type MetricDisplayThresholds } from '@/utils/metricThresholds';
import type { StatusIndicatorVariant } from '@/utils/status';
+import { formatHistoryRangeOptionLabel } from '@/components/shared/historyChartModel';
export function getDiskAttributeValueTextClass(ok: boolean): string {
return ok ? 'text-green-600 dark:text-green-400' : 'text-red-600 dark:text-red-400';
@@ -67,16 +68,9 @@ export type DiskDetailHistoryChartConfig = {
color: string;
};
-export const DISK_DETAIL_HISTORY_RANGE_OPTIONS: readonly DiskDetailChartOption[] = [
- { value: '1h', label: 'Last 1 hour' },
- { value: '6h', label: 'Last 6 hours' },
- { value: '12h', label: 'Last 12 hours' },
- { value: '24h', label: 'Last 24 hours' },
- { value: '7d', label: 'Last 7 days' },
- { value: '14d', label: 'Last 14 days' },
- { value: '30d', label: 'Last 30 days' },
- { value: '90d', label: 'Last 90 days' },
-] as const;
+export const DISK_DETAIL_HISTORY_RANGE_OPTIONS: readonly DiskDetailChartOption[] = (
+ ['1h', '6h', '12h', '24h', '7d', '14d', '30d', '90d'] as const
+).map((value) => ({ value, label: formatHistoryRangeOptionLabel(value) }));
export const DISK_DETAIL_LIVE_CHARTS: readonly DiskDetailLiveChartConfig[] = [
{ label: 'Read', unit: 'B/s', metric: 'disk', series: 'read' },
diff --git a/frontend-modern/src/features/storageBackups/storagePoolDetailPresentation.ts b/frontend-modern/src/features/storageBackups/storagePoolDetailPresentation.ts
index 560a98d001..4833273546 100644
--- a/frontend-modern/src/features/storageBackups/storagePoolDetailPresentation.ts
+++ b/frontend-modern/src/features/storageBackups/storagePoolDetailPresentation.ts
@@ -16,6 +16,7 @@ import {
import { resolveStorageRecordMetricResourceId } from '@/features/storageBackups/storageMetricsIdentity';
import type { Resource } from '@/types/resource';
import { formatBytes, formatPercent } from '@/utils/format';
+import { formatHistoryRangeOptionLabel } from '@/components/shared/historyChartModel';
export type StoragePoolDetailConfigRow = {
label: string;
@@ -77,13 +78,10 @@ export type StoragePoolDetailZfsSummary = {
export const STORAGE_POOL_DETAIL_HISTORY_RANGE_OPTIONS: readonly {
value: HistoryTimeRange;
label: string;
-}[] = [
- { value: '24h', label: '24h' },
- { value: '7d', label: '7d' },
- { value: '14d', label: '14d' },
- { value: '30d', label: '30d' },
- { value: '90d', label: '90d' },
-] as const;
+}[] = (['24h', '7d', '14d', '30d', '90d'] as const).map((value) => ({
+ value,
+ label: formatHistoryRangeOptionLabel(value),
+}));
export function getZfsScanTextClass(): string {
return 'text-yellow-600 dark:text-yellow-400 italic';