diff --git a/frontend/src/views/admin/ops/OpsDashboard.vue b/frontend/src/views/admin/ops/OpsDashboard.vue index 8bb42f3b62..cd5c672963 100644 --- a/frontend/src/views/admin/ops/OpsDashboard.vue +++ b/frontend/src/views/admin/ops/OpsDashboard.vue @@ -114,6 +114,8 @@ = { page: page.value, page_size: pageSize.value, - time_range: props.timeRange, view: viewMode.value, sort_by: sortBy.value, sort_order: sortOrder.value } + Object.assign(params, buildOpsErrorTimeParams(props.timeRange, props.customStartTime, props.customEndTime)) const platform = String(props.platform || '').trim() if (platform) params.platform = platform @@ -160,7 +163,7 @@ watch( ) watch( - () => [props.timeRange, props.platform, props.groupId] as const, + () => [props.timeRange, props.customStartTime, props.customEndTime, props.platform, props.groupId] as const, () => { if (!props.show) return page.value = 1 diff --git a/frontend/src/views/admin/ops/utils/__tests__/opsErrorParams.spec.ts b/frontend/src/views/admin/ops/utils/__tests__/opsErrorParams.spec.ts new file mode 100644 index 0000000000..d4b8c296c0 --- /dev/null +++ b/frontend/src/views/admin/ops/utils/__tests__/opsErrorParams.spec.ts @@ -0,0 +1,16 @@ +import { describe, expect, it } from 'vitest' +import { buildOpsErrorTimeParams } from '../opsErrorParams' + +describe('buildOpsErrorTimeParams', () => { + it('uses explicit timestamps for a complete custom range', () => { + expect(buildOpsErrorTimeParams('custom', '2026-08-01T00:00:00Z', '2026-08-02T00:00:00Z')).toEqual({ + start_time: '2026-08-01T00:00:00Z', + end_time: '2026-08-02T00:00:00Z' + }) + }) + + it('preserves predefined ranges and falls back for incomplete custom ranges', () => { + expect(buildOpsErrorTimeParams('24h')).toEqual({ time_range: '24h' }) + expect(buildOpsErrorTimeParams('custom', null, null)).toEqual({ time_range: '1h' }) + }) +}) diff --git a/frontend/src/views/admin/ops/utils/opsErrorParams.ts b/frontend/src/views/admin/ops/utils/opsErrorParams.ts new file mode 100644 index 0000000000..d994b229fc --- /dev/null +++ b/frontend/src/views/admin/ops/utils/opsErrorParams.ts @@ -0,0 +1,11 @@ +export function buildOpsErrorTimeParams( + timeRange: string, + customStartTime?: string | null, + customEndTime?: string | null +): Record { + if (timeRange === 'custom' && customStartTime && customEndTime) { + return { start_time: customStartTime, end_time: customEndTime } + } + + return { time_range: timeRange === 'custom' ? '1h' : timeRange } +}