diff --git a/frontend/package.json b/frontend/package.json index 06985059..58a454ce 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "next dev --hostname 127.0.0.1", "build": "next build && next export -o build", "start": "next start", "lint": "eslint ./ --ext js,jsx,ts,tsx --fix", diff --git a/frontend/pages/status/index.js b/frontend/pages/status/index.js index c0c41882..179364ee 100644 --- a/frontend/pages/status/index.js +++ b/frontend/pages/status/index.js @@ -14,14 +14,43 @@ const Status = () => { }; const { - apiServerStatusCache, - ethereumClusterServerStatusCache, - gethStatusCache, + serverListStatusCache, crawlersStatusCache, dbServerStatusCache, latestBlockDBStatusCache, } = useStatus(); + const moonstreamapiStatus = serverListStatusCache?.data?.filter( + (i) => i.status.name === "moonstreamapi" + )[0]; + const moonstreamCrawlersStatus = serverListStatusCache?.data?.filter( + (i) => i.status.name === "moonstream_crawlers" + )[0]; + const nodeEthereumAStatus = serverListStatusCache?.data?.filter( + (i) => i.status.name === "node_ethereum_a" + )[0]; + const nodeEthereumAGeth = serverListStatusCache?.data?.filter( + (i) => i.status.name === "node_ethereum_a_geth" + )[0]; + const nodeEthereumBStatus = serverListStatusCache?.data?.filter( + (i) => i.status.name === "node_ethereum_b" + )[0]; + const nodeEthereumBGeth = serverListStatusCache?.data?.filter( + (i) => i.status.name === "node_ethereum_b_geth" + )[0]; + const nodePolygonAStatus = serverListStatusCache?.data?.filter( + (i) => i.status.name === "node_polygon_a" + )[0]; + const nodePolygonAGeth = serverListStatusCache?.data?.filter( + (i) => i.status.name === "node_polygon_a_geth" + )[0]; + const nodePolygonBStatus = serverListStatusCache?.data?.filter( + (i) => i.status.name === "node_polygon_b" + )[0]; + const nodePolygonBGeth = serverListStatusCache?.data?.filter( + (i) => i.status.name === "node_polygon_b_geth" + )[0]; + const StatusRow = (props) => { console.log(props.cache.data); return ( @@ -46,43 +75,22 @@ const Status = () => { {`Status page`} - + - {apiServerStatusCache?.data?.status == "ok" + {moonstreamapiStatus?.status.body.status == "ok" ? healthyStatusText : downStatusText} +
- - - {ethereumClusterServerStatusCache?.data - ? healthyStatusText - : downStatusText} - - - - - {gethStatusCache?.data?.current_block - ? gethStatusCache.data.current_block - : 0} - - + {crawlersStatusCache?.data?.ethereum_txpool_timestamp @@ -106,6 +114,93 @@ const Status = () => {
+ + + + {nodeEthereumAStatus?.status.body.status == "ok" + ? healthyStatusText + : downStatusText} + + + + + {nodeEthereumAGeth?.status.body.current_block + ? nodeEthereumAGeth.status.body.current_block + : 0} + + +
+ + + {nodeEthereumBStatus?.status.body.status == "ok" + ? healthyStatusText + : downStatusText} + + + + + {nodeEthereumBGeth?.status.body.current_block + ? nodeEthereumBGeth.status.body.current_block + : 0} + + +
+ + + {nodePolygonAStatus?.status.body.status == "ok" + ? healthyStatusText + : downStatusText} + + + + + {nodePolygonAGeth?.status.body.current_block + ? nodePolygonAGeth.status.body.current_block + : 0} + + +
+ + + {nodePolygonBStatus?.status.body.status == "ok" + ? healthyStatusText + : downStatusText} + + + + + {nodePolygonBGeth?.status.body.current_block + ? nodePolygonBGeth.status.body.current_block + : 0} + + + +
+ { - const getAPIServerStatus = async () => { - const response = await StatusService.apiServerStatus(); - return response.data; - }; - const getEthereumClusterServerStatus = async () => { - const response = await StatusService.ethereumClusterServerStatus(); - return response.data; - }; - const getGethStatus = async () => { - const response = await StatusService.gethStatus(); + const getServerListStatus = async () => { + const response = await StatusService.serverListStatus(); return response.data; }; const getCrawlersStatus = async () => { @@ -28,22 +20,14 @@ const useStatus = () => { return response.data; }; - const apiServerStatusCache = useQuery("apiServer", getAPIServerStatus, { - ...queryCacheProps, - retry: 0, - }); - const ethereumClusterServerStatusCache = useQuery( - "ethereumClusterServer", - getEthereumClusterServerStatus, + const serverListStatusCache = useQuery( + "serverListStatus", + getServerListStatus, { ...queryCacheProps, retry: 0, } ); - const gethStatusCache = useQuery("geth", getGethStatus, { - ...queryCacheProps, - retry: 0, - }); const crawlersStatusCache = useQuery("crawlers", getCrawlersStatus, { ...queryCacheProps, retry: 0, @@ -62,9 +46,7 @@ const useStatus = () => { ); return { - apiServerStatusCache, - ethereumClusterServerStatusCache, - gethStatusCache, + serverListStatusCache, crawlersStatusCache, dbServerStatusCache, latestBlockDBStatusCache, diff --git a/frontend/src/core/services/status.service.js b/frontend/src/core/services/status.service.js index 8666ccd7..9dff55ca 100644 --- a/frontend/src/core/services/status.service.js +++ b/frontend/src/core/services/status.service.js @@ -1,28 +1,13 @@ import { http } from "../utils"; +const BUGOUT_STATUS_URL = process.env.NEXT_PUBLIC_BUGOUT_STATUS_URL; const API_URL = process.env.NEXT_PUBLIC_MOONSTREAM_API_URL; const DB_URL = process.env.NEXT_PUBLIC_MOONSTREAM_DB_URL; -const ETHEREUM_CLUSTER_URL = - process.env.NEXT_PUBLIC_MOONSTREAM_ETHEREUM_CLUSTER_URL; -export const apiServerStatus = () => { +export const serverListStatus = () => { return http({ method: "GET", - url: `${API_URL}/ping`, - }); -}; - -export const ethereumClusterServerStatus = () => { - return http({ - method: "GET", - url: `${ETHEREUM_CLUSTER_URL}/ping`, - }); -}; - -export const gethStatus = () => { - return http({ - method: "GET", - url: `${ETHEREUM_CLUSTER_URL}/status`, + url: `${BUGOUT_STATUS_URL}`, }); };