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.

Delete unused timeRange util

rcourtmanecb533a8655d
diff --git a/frontend-modern/src/api/__tests__/charts.test.ts b/frontend-modern/src/api/__tests__/charts.test.ts
index 2abaea4d02..767a6a3e8d 100644
--- a/frontend-modern/src/api/__tests__/charts.test.ts
+++ b/frontend-modern/src/api/__tests__/charts.test.ts
@@ -3,7 +3,6 @@
*/
import { describe, expect, it } from 'vitest';
import type { ChartData, ChartsResponse, TimeRange, MetricPoint, ChartStats } from '@/api/charts';
-import { timeRangeToMs } from '@/utils/timeRange';
// Note: We test the types and interfaces here since the actual API calls
// require a running backend. Integration tests should cover the full flow.
@@ -241,25 +240,3 @@ describe('Charts API Types', () => {
});
});
-describe('Time Range to Milliseconds Conversion', () => {
- const expectedValues: [TimeRange, number][] = [
- ['5m', 300000],
- ['15m', 900000],
- ['30m', 1800000],
- ['1h', 3600000],
- ['4h', 14400000],
- ['12h', 43200000],
- ['24h', 86400000],
- ['7d', 604800000],
- ['30d', 2592000000],
- ];
-
- it.each(expectedValues)('converts %s to %d ms', (range, expectedMs) => {
- expect(timeRangeToMs(range)).toBe(expectedMs);
- });
-
- it('defaults to 1 hour for unknown range', () => {
- // @ts-expect-error - Testing invalid input
- expect(timeRangeToMs('invalid')).toBe(3600000);
- });
-});
diff --git a/frontend-modern/src/utils/__tests__/timeRange.test.ts b/frontend-modern/src/utils/__tests__/timeRange.test.ts
deleted file mode 100644
index fe47a0678b..0000000000
--- a/frontend-modern/src/utils/__tests__/timeRange.test.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { describe, it, expect } from 'vitest';
-import type { TimeRange } from '@/api/charts';
-import { timeRangeToMs } from '@/utils/timeRange';
-
-describe('timeRangeToMs', () => {
- const cases: Array<[TimeRange, number]> = [
- ['5m', 5 * 60_000],
- ['15m', 15 * 60_000],
- ['30m', 30 * 60_000],
- ['1h', 60 * 60_000],
- ['4h', 4 * 60 * 60_000],
- ['12h', 12 * 60 * 60_000],
- ['24h', 24 * 60 * 60_000],
- ['7d', 7 * 24 * 60 * 60_000],
- ['30d', 30 * 24 * 60 * 60_000],
- ];
-
- it.each(cases)('converts %s to %d milliseconds', (range, expectedMs) => {
- expect(timeRangeToMs(range)).toBe(expectedMs);
- });
-});
diff --git a/frontend-modern/src/utils/timeRange.ts b/frontend-modern/src/utils/timeRange.ts
deleted file mode 100644
index c9eff6cdc9..0000000000
--- a/frontend-modern/src/utils/timeRange.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import type { TimeRange } from '@/api/charts';
-
-/**
- * Convert chart time range tokens to milliseconds.
- */
-export function timeRangeToMs(range: TimeRange): number {
- switch (range) {
- case '5m':
- return 5 * 60_000;
- case '15m':
- return 15 * 60_000;
- case '30m':
- return 30 * 60_000;
- case '1h':
- return 60 * 60_000;
- case '4h':
- return 4 * 60 * 60_000;
- case '12h':
- return 12 * 60 * 60_000;
- case '24h':
- return 24 * 60 * 60_000;
- case '7d':
- return 7 * 24 * 60 * 60_000;
- case '30d':
- return 30 * 24 * 60 * 60_000;
- default:
- return 60 * 60_000;
- }
-}