@@ -42,16 +42,19 @@ export default function ObservabilityPage() {
4242 const [ page , setPage ] = useState ( 1 )
4343 const [ perPage , setPerPage ] = useState ( 20 )
4444 const [ nameFilter , setNameFilter ] = useState ( "" )
45- const [ spanTypeFilter , setSpanTypeFilter ] = useState < string > ( "" )
46- const [ entityTypeFilter , setEntityTypeFilter ] = useState < string > ( "" )
45+ const [ spanTypeFilter , setSpanTypeFilter ] = useState < string > ( "all " )
46+ const [ entityTypeFilter , setEntityTypeFilter ] = useState < string > ( "all " )
4747
4848 const { data : traces , loading, error, refetch } = useAITraces ( {
4949 page,
5050 perPage,
5151 filters : {
5252 name : nameFilter || undefined ,
53- spanType : spanTypeFilter || undefined ,
54- entityType : ( entityTypeFilter || undefined ) as "agent" | "workflow" | undefined ,
53+ spanType : spanTypeFilter === "all" ? undefined : spanTypeFilter ,
54+ entityType : ( entityTypeFilter === "all" ? undefined : entityTypeFilter ) as
55+ | "agent"
56+ | "workflow"
57+ | undefined ,
5558 } ,
5659 } )
5760
@@ -86,7 +89,7 @@ export default function ObservabilityPage() {
8689 < SelectValue placeholder = "Span Type" />
8790 </ SelectTrigger >
8891 < SelectContent >
89- < SelectItem value = "" > All Types</ SelectItem >
92+ < SelectItem value = "all " > All Types</ SelectItem >
9093 < SelectItem value = "agent" > Agent</ SelectItem >
9194 < SelectItem value = "tool" > Tool</ SelectItem >
9295 < SelectItem value = "workflow" > Workflow</ SelectItem >
@@ -98,7 +101,7 @@ export default function ObservabilityPage() {
98101 < SelectValue placeholder = "Entity Type" />
99102 </ SelectTrigger >
100103 < SelectContent >
101- < SelectItem value = "" > All Entities</ SelectItem >
104+ < SelectItem value = "all " > All Entities</ SelectItem >
102105 < SelectItem value = "agent" > Agent</ SelectItem >
103106 < SelectItem value = "tool" > Tool</ SelectItem >
104107 < SelectItem value = "workflow" > Workflow</ SelectItem >
@@ -132,27 +135,27 @@ export default function ObservabilityPage() {
132135 < div className = "flex items-start gap-3" >
133136 < Activity className = "h-5 w-5 mt-0.5 text-muted-foreground" />
134137 < div className = "flex-1 min-w-0" >
135- < div className = "font-medium truncate" > { span . name || span . traceId } </ div >
138+ < div className = "font-medium truncate" > { span . name ?? span . traceId } </ div >
136139 < div className = "flex items-center gap-2 mt-1" >
137140 < Badge variant = "secondary" className = "text-xs" >
138- { span . spanType || "unknown" }
141+ { span . spanType ?? "unknown" }
139142 </ Badge >
140- { span . duration && (
143+ { ( Boolean ( span . duration ) ) && (
141144 < span className = "text-xs text-muted-foreground flex items-center gap-1" >
142145 < Clock className = "h-3 w-3" />
143146 { span . duration } ms
144147 </ span >
145148 ) }
146149 </ div >
147150 < div className = "text-xs text-muted-foreground mt-1" >
148- { span . startTime ? new Date ( span . startTime ) . toLocaleString ( ) : "No timestamp" }
151+ { ( span . startTime ) ? new Date ( span . startTime ) . toLocaleString ( ) : "No timestamp" }
149152 </ div >
150153 </ div >
151154 < ChevronRight className = "h-4 w-4 text-muted-foreground shrink-0" />
152155 </ div >
153156 </ button >
154157 ) ) }
155- { ( ! traces || ! ( traces as any ) ?. spans ?. length ) && (
158+ { ( ! traces || ! ( ( traces as any ) ?. spans ?. length ) ) && (
156159 < div className = "p-4 text-center text-sm text-muted-foreground" >
157160 No traces found
158161 </ div >
@@ -191,7 +194,7 @@ export default function ObservabilityPage() {
191194
192195 { /* Trace Details */ }
193196 < div className = "flex-1 overflow-auto" >
194- { selectedTraceId ? (
197+ { ( selectedTraceId ) ? (
195198 < TraceDetails traceId = { selectedTraceId } />
196199 ) : (
197200 < div className = "flex h-full items-center justify-center text-muted-foreground" >
@@ -250,7 +253,7 @@ function TraceDetails({ traceId }: { traceId: string }) {
250253 { /* Header */ }
251254 < div className = "flex items-start justify-between" >
252255 < div >
253- < h1 className = "text-2xl font-bold" > { traceData ?. name || traceId } </ h1 >
256+ < h1 className = "text-2xl font-bold" > { traceData ?. name ?? traceId } </ h1 >
254257 < p className = "text-muted-foreground mt-1" >
255258 Trace ID: < code className = "text-xs bg-muted px-1 py-0.5 rounded" > { traceId } </ code >
256259 </ p >
@@ -279,7 +282,7 @@ function TraceDetails({ traceId }: { traceId: string }) {
279282 className = "mt-1"
280283 />
281284 </ div >
282- { scoreResult && (
285+ { ( Boolean ( scoreResult ) ) && (
283286 < div className = "space-y-2" >
284287 < Label > Result</ Label >
285288 < pre className = "text-sm bg-muted p-3 rounded-md overflow-auto max-h-48" >
@@ -312,7 +315,7 @@ function TraceDetails({ traceId }: { traceId: string }) {
312315 </ CardHeader >
313316 < CardContent >
314317 < div className = "text-2xl font-bold" >
315- { traceData ?. duration ? `${ traceData . duration } ms` : "N/A" }
318+ { ( traceData ?. duration ) ? `${ traceData . duration } ms` : "N/A" }
316319 </ div >
317320 </ CardContent >
318321 </ Card >
@@ -338,7 +341,7 @@ function TraceDetails({ traceId }: { traceId: string }) {
338341 </ CardHeader >
339342 < CardContent >
340343 < Badge variant = "secondary" >
341- { traceData ?. spanType || "Unknown" }
344+ { traceData ?. spanType ?? "Unknown" }
342345 </ Badge >
343346 </ CardContent >
344347 </ Card >
@@ -353,7 +356,7 @@ function TraceDetails({ traceId }: { traceId: string }) {
353356 < Badge
354357 variant = { traceData ?. status === "ok" || traceData ?. status === "success" ? "default" : "destructive" }
355358 >
356- { traceData ?. status || "Unknown" }
359+ { traceData ?. status ?? "Unknown" }
357360 </ Badge >
358361 </ CardContent >
359362 </ Card >
@@ -381,29 +384,29 @@ function TraceDetails({ traceId }: { traceId: string }) {
381384 < div className = "space-y-2" >
382385 { traceData . spans . map ( ( span : any , index : number ) => (
383386 < div
384- key = { span . spanId || index }
387+ key = { span . spanId ?? index }
385388 className = "p-4 bg-muted rounded-md"
386- style = { { marginLeft : `${ ( span . depth || 0 ) * 20 } px` } }
389+ style = { { marginLeft : `${ ( span . depth ?? 0 ) * 20 } px` } }
387390 >
388391 < div className = "flex items-start justify-between" >
389392 < div >
390- < div className = "font-medium" > { span . name || `Span ${ index + 1 } ` } </ div >
393+ < div className = "font-medium" > { span . name ?? `Span ${ index + 1 } ` } </ div >
391394 < div className = "text-sm text-muted-foreground" >
392395 { span . spanId }
393396 </ div >
394397 </ div >
395398 < div className = "flex items-center gap-2" >
396- { span . duration && (
399+ { ( Boolean ( span . duration ) ) && (
397400 < span className = "text-xs text-muted-foreground" >
398401 { span . duration } ms
399402 </ span >
400403 ) }
401404 < Badge variant = "outline" className = "text-xs" >
402- { span . spanType || span . kind || "unknown" }
405+ { ( span . spanType ?? span . kind ) ?? "unknown" }
403406 </ Badge >
404407 </ div >
405408 </ div >
406- { span . attributes && Object . keys ( span . attributes ) . length > 0 && (
409+ { ( Boolean ( span . attributes ) ) && Object . keys ( span . attributes ) . length > 0 && (
407410 < details className = "mt-2" >
408411 < summary className = "text-xs text-muted-foreground cursor-pointer" >
409412 Attributes
@@ -433,7 +436,7 @@ function TraceDetails({ traceId }: { traceId: string }) {
433436 </ CardDescription >
434437 </ CardHeader >
435438 < CardContent >
436- { traceData ?. attributes ? (
439+ { ( traceData ?. attributes ) ? (
437440 < pre className = "whitespace-pre-wrap text-sm bg-muted p-4 rounded-md overflow-auto max-h-96" >
438441 { JSON . stringify ( traceData . attributes , null , 2 ) }
439442 </ pre >
0 commit comments