Files
SE-LTD/shared/trend-preferences.mjs
T
jhartworks a8b6cd4061 feat: add modal dialog, paged results, scan status, and trend value table components
- Introduced ModalDialog component for displaying modal dialogs with accessibility features.
- Added PagedResults component to handle pagination of items with customizable rendering.
- Created ScanStatus component to display the status of a scan with elapsed time.
- Implemented TrendValueTable component for displaying trend data in a paginated table format.
- Added measurement utility functions for formatting and validating measurement values.
- Included tests for measurement functions and trend series fetching logic to ensure correctness.
2026-11-25 15:45:49 +01:00

33 lines
1.2 KiB
JavaScript

export const DEFAULT_TREND_PRESET = "1";
export const DEFAULT_MAX_TREND_SERIES = 10;
export const MAX_TREND_SERIES = 100;
export const DEFAULT_TREND_ROWS = 20_000;
export const MIN_TREND_ROWS = 100;
export const MAX_TREND_ROWS = 50_000;
const MAX_TREND_SAMPLES = 250_000;
export function maxTrendRowsForSeries(seriesCount) {
return Math.min(MAX_TREND_ROWS, Math.floor(MAX_TREND_SAMPLES / Math.max(1, seriesCount || 1)));
}
export const TREND_PRESETS = [
{ value: "0.0034722222", label: "5 min" },
{ value: "0.0069444444", label: "10 min" },
{ value: "0.0208333333", label: "30 min" },
{ value: "0.0416666667", label: "1 h" },
{ value: "0.0833333333", label: "2 h" },
{ value: "0.25", label: "6 h" },
{ value: "0.5", label: "12 h" },
{ value: "1", label: "24 h" },
{ value: "2", label: "2 Tage" },
{ value: "3", label: "3 Tage" },
{ value: "7", label: "7 Tage" },
{ value: "14", label: "14 Tage" },
{ value: "30", label: "30 Tage" },
];
export function normalizeMaxTrendSeries(value, fallback = DEFAULT_MAX_TREND_SERIES) {
const count = Number(value);
return Number.isInteger(count) && count >= 1 && count <= MAX_TREND_SERIES ? count : fallback;
}