@@ -42,6 +42,7 @@ import {
4242} from '@/components/ui/select' ;
4343import { Skeleton } from '@/components/ui/skeleton' ;
4444import { cn } from '@/lib/utils' ;
45+ import { rollingHealthInterval } from './health-interval' ;
4546import { getOperationalFailureStats } from './health-summary' ;
4647import {
4748 DEFAULT_HEALTH_PERIOD ,
@@ -70,11 +71,11 @@ type RangeOption = {
7071} ;
7172
7273const RANGE_OPTIONS = [
73- { value : '1h' , label : 'Last complete hour' , durationMs : 60 * 60 * 1000 , bucket : 'hour' } ,
74- { value : '3h' , label : 'Last 3 complete hours' , durationMs : 3 * 60 * 60 * 1000 , bucket : 'hour' } ,
74+ { value : '1h' , label : 'Last hour' , durationMs : 60 * 60 * 1000 , bucket : 'hour' } ,
75+ { value : '3h' , label : 'Last 3 hours' , durationMs : 3 * 60 * 60 * 1000 , bucket : 'hour' } ,
7576 {
7677 value : '24h' ,
77- label : 'Last 24 complete hours' ,
78+ label : 'Last 24 hours' ,
7879 durationMs : 24 * 60 * 60 * 1000 ,
7980 bucket : 'hour' ,
8081 } ,
@@ -131,13 +132,8 @@ function intervalForRange(
131132) : CloudAgentNextHealthFilters {
132133 const selectedRange = RANGE_OPTIONS . find ( option => option . value === range ) ?? RANGE_OPTIONS [ 3 ] ;
133134 const createdOnPlatform = createdOnPlatformForSelection ( platformSelection ) ;
134- const end = new Date ( ) ;
135- if ( selectedRange . bucket === 'day' ) end . setUTCHours ( 0 , 0 , 0 , 0 ) ;
136- else end . setUTCMinutes ( 0 , 0 , 0 ) ;
137135 return {
138- startDate : new Date ( end . getTime ( ) - selectedRange . durationMs ) . toISOString ( ) ,
139- endDate : end . toISOString ( ) ,
140- bucket : selectedRange . bucket ,
136+ ...rollingHealthInterval ( selectedRange ) ,
141137 ...( createdOnPlatform === undefined ? { } : { createdOnPlatform } ) ,
142138 } ;
143139}
@@ -206,22 +202,16 @@ function DashboardSkeleton() {
206202 ) ;
207203}
208204
209- function HealthSummary ( {
210- summary,
211- bucket,
212- } : {
213- summary : HealthData [ 'summary' ] ;
214- bucket : HealthBucket ;
215- } ) {
205+ function HealthSummary ( { summary } : { summary : HealthData [ 'summary' ] } ) {
216206 const operationalFailures = getOperationalFailureStats ( summary ) ;
217207 const failureRate = operationalFailures . failureRatePercent ;
218208 return (
219209 < Card >
220210 < CardHeader >
221211 < CardTitle > Observed health</ CardTitle >
222212 < CardDescription >
223- Events observed during complete UTC { bucket === 'day' ? 'days' : 'hours' } in the selected
224- period. Interruptions are excluded from failure rate.
213+ Events observed in the selected rolling period. Interruptions are excluded from failure
214+ rate.
225215 </ CardDescription >
226216 </ CardHeader >
227217 < CardContent className = "grid gap-3 sm:grid-cols-2 xl:grid-cols-5" >
@@ -304,8 +294,8 @@ function OutcomeTrendChart({
304294 < CardHeader >
305295 < CardTitle > { label } outcomes</ CardTitle >
306296 < CardDescription >
307- Completed, failed, setup-failed, and interrupted events in complete UTC-
308- { bucket === 'day' ? 'day' : 'hour' } buckets.
297+ Completed, failed, setup-failed, and interrupted events in UTC-
298+ { bucket === 'day' ? 'day' : 'hour' } buckets. Edge buckets may be partial.
309299 </ CardDescription >
310300 </ CardHeader >
311301 < CardContent >
@@ -646,8 +636,8 @@ export default function CloudAgentNextOutcomesPage() {
646636 </ div >
647637 </ div >
648638 < p className = "text-muted-foreground text-xs" >
649- Reporting is best-effort, so totals can undercount execution. Periods use complete UTC
650- { bucket === 'day' ? ' days' : ' hours' } .
639+ Reporting is best-effort, so totals can undercount execution. Periods end at refresh time;
640+ edge UTC { bucket === 'day' ? 'days' : 'hours' } may be partial .
651641 </ p >
652642 { health . error && (
653643 < Alert variant = "destructive" >
@@ -665,7 +655,7 @@ export default function CloudAgentNextOutcomesPage() {
665655 < DashboardSkeleton />
666656 ) : health . data ? (
667657 < >
668- < HealthSummary summary = { health . data . summary } bucket = { bucket } />
658+ < HealthSummary summary = { health . data . summary } />
669659 < OutcomeTrendChart data = { health . data . series } range = { range } bucket = { bucket } />
670660 < TopErrors errors = { health . data . topErrors } interval = { interval } />
671661 </ >
0 commit comments