@@ -5,7 +5,7 @@ import React from 'react';
55import { route } from 'nextjs-routes' ;
66
77import dayjs from 'lib/date/dayjs' ;
8- import { getTEERegistryOverview , TEE_REGISTRY_QUERY_KEY , TEE_REGISTRY_ADDRESS , type TEENodeWithStatus } from 'lib/opengradient/contracts/ teeRegistry' ;
8+ import { getTEERegistryOverview , TEE_REGISTRY_QUERY_KEY , TEE_REGISTRY_ADDRESS , type TEENodeWithStatus } from 'lib/opengradient/teeRegistry' ;
99import { Link } from 'toolkit/chakra/link' ;
1010import { Skeleton } from 'toolkit/chakra/skeleton' ;
1111import { PLACEHOLDER_TEE_REGISTRY_STATS , PLACEHOLDER_TEE_TYPES } from 'ui/opengradient/teeRegistry/placeholders' ;
@@ -138,10 +138,11 @@ const TrustedExecution = () => {
138138 const types = query . data ?. types ?? PLACEHOLDER_TEE_TYPES ;
139139 const nodes = React . useMemo ( ( ) => {
140140 const nodesByType = query . data ?. nodesByType ?? { } ;
141- return Object . values ( nodesByType ) . flat ( ) . sort ( ( a , b ) => Number ( b . lastHeartbeatAt - a . lastHeartbeatAt ) ) ;
141+ return Object . values ( nodesByType ) . flat ( )
142+ . filter ( ( node ) => node . isActive )
143+ . sort ( ( a , b ) => Number ( b . lastHeartbeatAt - a . lastHeartbeatAt ) ) ;
142144 } , [ query . data ?. nodesByType ] ) ;
143- const primaryType = types [ 0 ] ?? PLACEHOLDER_TEE_TYPES [ 0 ] ;
144- const visibleNodes = nodes . slice ( 0 , 3 ) ;
145+ const primaryType = types [ 0 ] ;
145146 const isLoading = query . isPlaceholderData ;
146147
147148 return (
@@ -239,13 +240,13 @@ const TrustedExecution = () => {
239240 < Grid templateColumns = { { base : '1fr' , md : 'repeat(3, minmax(0, 1fr))' } } gap = { 3 } mb = { 4 } >
240241 < RegistryMetric
241242 label = "Active TEEs"
242- value = { ` ${ stats . activeNodes } / ${ stats . enabledNodes } ` }
243+ value = { stats . activeNodes . toLocaleString ( ) }
243244 helper = "Heartbeat-valid operators"
244245 loading = { isLoading }
245246 />
246247 < RegistryMetric
247248 label = "Execution type"
248- value = { primaryType . name }
249+ value = { primaryType ? .name ?? 'Loading' }
249250 helper = "Registered AI workload class"
250251 loading = { isLoading }
251252 />
@@ -270,32 +271,23 @@ const TrustedExecution = () => {
270271 </ Text >
271272 < Skeleton loading = { isLoading } w = "fit-content" >
272273 < Text mt = { 3 } fontFamily = { fonts . sans } fontSize = "18px" fontWeight = { 600 } color = { text . primary } >
273- { primaryType . name }
274+ { primaryType ? .name ?? 'Loading' }
274275 </ Text >
275276 </ Skeleton >
276277 < Grid templateColumns = "repeat(3, minmax(0, 1fr))" gap = { 3 } mt = { 4 } >
277278 < Box >
278279 < Text fontFamily = { fonts . mono } fontSize = "9px" color = { text . muted } textTransform = "uppercase" letterSpacing = "0.08em" > Active</ Text >
279- < Text mt = { 1 } fontFamily = { fonts . mono } fontSize = "14px" color = { text . primary } > { primaryType . activeNodes } / { primaryType . totalNodes } </ Text >
280+ < Text mt = { 1 } fontFamily = { fonts . mono } fontSize = "14px" color = { text . primary } > { primaryType ? .activeNodes . toLocaleString ( ) ?? '0' } </ Text >
280281 </ Box >
281282 < Box >
282283 < Text fontFamily = { fonts . mono } fontSize = "9px" color = { text . muted } textTransform = "uppercase" letterSpacing = "0.08em" > Enabled</ Text >
283- < Text mt = { 1 } fontFamily = { fonts . mono } fontSize = "14px" color = { text . primary } > { primaryType . enabledNodes } </ Text >
284+ < Text mt = { 1 } fontFamily = { fonts . mono } fontSize = "14px" color = { text . primary } > { primaryType ? .enabledNodes . toLocaleString ( ) ?? '0' } </ Text >
284285 </ Box >
285286 < Box >
286287 < Text fontFamily = { fonts . mono } fontSize = "9px" color = { text . muted } textTransform = "uppercase" letterSpacing = "0.08em" > PCRs</ Text >
287- < Text mt = { 1 } fontFamily = { fonts . mono } fontSize = "14px" color = { text . primary } > { primaryType . approvedPCRs } </ Text >
288+ < Text mt = { 1 } fontFamily = { fonts . mono } fontSize = "14px" color = { text . primary } > { primaryType ? .approvedPCRs . toLocaleString ( ) ?? '0' } </ Text >
288289 </ Box >
289290 </ Grid >
290- < Box mt = { 4 } h = "3px" borderRadius = "2px" bg = { { _light : 'rgba(36, 188, 227, 0.12)' , _dark : 'rgba(36, 188, 227, 0.12)' } } overflow = "hidden" >
291- < Box
292- h = "100%"
293- w = { primaryType . totalNodes > 0 ? `${ Math . round ( ( primaryType . activeNodes / primaryType . totalNodes ) * 100 ) } %` : '0' }
294- minW = { primaryType . activeNodes > 0 ? '18px' : '0' }
295- bg = { colors . cyan }
296- borderRadius = "2px"
297- />
298- </ Box >
299291 </ Box >
300292
301293 < Box
@@ -316,7 +308,7 @@ const TrustedExecution = () => {
316308 </ Text >
317309 </ Flex >
318310 < VStack align = "stretch" gap = { 0 } >
319- { visibleNodes . length > 0 ? visibleNodes . map ( ( node ) => (
311+ { nodes . length > 0 ? nodes . map ( ( node ) => (
320312 < NodePreview key = { node . teeId } node = { node } loading = { isLoading } />
321313 ) ) : (
322314 < Text py = { 5 } fontSize = "13px" color = { text . muted } >
0 commit comments