diff --git a/webapp/src/components/EndpointsTable/index.js b/webapp/src/components/EndpointsTable/index.js index 7275258d..7c2327ef 100644 --- a/webapp/src/components/EndpointsTable/index.js +++ b/webapp/src/components/EndpointsTable/index.js @@ -13,7 +13,7 @@ import { Tooltip as MUITooltip } from '@mui/material' import ListAltIcon from '@mui/icons-material/ListAlt' import { Link as RouterLink } from 'react-router-dom' import Link from '@mui/material/Link' -import QueryStatsIcon from '@mui/icons-material/QueryStats'; +import QueryStatsIcon from '@mui/icons-material/QueryStats' import HealthCheck from '../HealthCheck' import HealthCheckInfo from 'components/HealthCheck/HealthCheckInfo' @@ -42,24 +42,24 @@ const EndpointsTable = ({ producers }) => { const syncToleranceInterval = eosConfig.syncToleranceInterval - const getStatus = (endpoint) => { - if (endpoint.response.status === undefined) return - + const isSynchronized = endpoint => { const diffBlockTimems = new Date(endpoint.updated_at) - new Date(endpoint.head_block_time) - if (diffBlockTimems <= syncToleranceInterval) { - return 'greenLight' - } else { - switch (Math.floor(endpoint.response?.status / 100)) { - case 2: - return 'timerOff' - case 4: - case 5: - return 'yellowLight' - default: - return 'redLight' - } + return diffBlockTimems <= syncToleranceInterval + } + + const getStatus = endpoint => { + if (endpoint.response.status === undefined) return + + switch (Math.floor(endpoint.response?.status / 100)) { + case 2: + return isSynchronized(endpoint) ? 'greenLight' : 'timerOff' + case 4: + case 5: + return 'yellowLight' + default: + return 'redLight' } } @@ -144,19 +144,19 @@ const EndpointsTable = ({ producers }) => {
- {producer.name} - {!!producer.endpoints.api.length + - producer.endpoints.ssl.length && ( - - - - )} -
+ {producer.name} + {!!producer.endpoints.api.length + + producer.endpoints.ssl.length && ( + + + + )} +