diff --git a/graphql-schema.json b/graphql-schema.json index ff3de61..97637c9 100644 --- a/graphql-schema.json +++ b/graphql-schema.json @@ -661,22 +661,6 @@ }, "isDeprecated": false, "deprecationReason": null - }, - { - "name": "getAltairUpgradePercentage", - "description": "", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "SCALAR", - "name": "Float", - "ofType": null - } - }, - "isDeprecated": false, - "deprecationReason": null } ], "inputFields": null, diff --git a/src/Components/Modules/SoftwareStats/AltAirPercentage.tsx b/src/Components/Modules/SoftwareStats/AltAirPercentage.tsx deleted file mode 100644 index df82a5c..0000000 --- a/src/Components/Modules/SoftwareStats/AltAirPercentage.tsx +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright 2021 ChainSafe Systems -SPDX-License-Identifier: LGPL-3.0-only -*/ -import React, { useMemo, useState } from "react" -import { createStyles, makeStyles, useTheme } from "@chainsafe/common-theme" -import { ECTheme } from "../../Themes/types" -import { PieChart, Pie, Sector, ResponsiveContainer } from "recharts" -import { useEth2CrawlerApi } from "../../../Contexts/Eth2CrawlerContext" -import { Typography } from "@chainsafe/common-components" - -const useStyles = makeStyles(({ constants, palette }: ECTheme) => { - return createStyles({ - root: { - border: `1px solid ${palette.background.paper}`, - borderRadius: "3px", - padding: constants.generalUnit * 2, - width: "inherit", - height: "inherit", - }, - chartContainer: { - height: `${constants.chartSizes.chartHeight}px`, - }, - title: { - marginBottom: constants.generalUnit * 4, - color: palette.text.primary, - }, - }) -}) - -const renderActiveShape = (props: any, fill: string) => { - const { cx, cy, innerRadius, outerRadius, startAngle, endAngle, payload } = props - - return ( - - - {payload.name} - - - - - ) -} - -const AltAirPercentage: React.FC = () => { - const classes = useStyles() - const theme: ECTheme = useTheme() - const [activeIndex, setActiveIndex] = useState(0) - - const onPieEnter = (_: any, index: number) => { - setActiveIndex(index) - } - - const { altAirPercentage } = useEth2CrawlerApi() - - const data = useMemo(() => { - return altAirPercentage !== undefined - ? [ - { - name: `Nodes ready (${altAirPercentage.toFixed(1)})%`, - value: altAirPercentage, - }, - { - name: `Nodes not ready (${(100 - altAirPercentage).toFixed(1)})%`, - value: 100 - altAirPercentage, - }, - ] - : [] - }, [altAirPercentage]) - - return ( -
- - Nodes ready for Altair upgrade - -
- - - - renderActiveShape(props, theme.constants.chartPrimaryColors.main) - } - data={data} - cx="50%" - cy="50%" - innerRadius={100} - outerRadius={120} - fill={theme.constants.chartPrimaryColors.main} - dataKey="value" - onMouseEnter={onPieEnter} - /> - - -
-
- ) -} - -export default AltAirPercentage diff --git a/src/Components/Pages/HomePage.tsx b/src/Components/Pages/HomePage.tsx index 5bece15..d70289e 100644 --- a/src/Components/Pages/HomePage.tsx +++ b/src/Components/Pages/HomePage.tsx @@ -17,7 +17,6 @@ import NodeStatusOverTime from "../Modules/NodeStats/NodeStatsOverTime" import GridLayoutWrapper from "../Layouts/GridLayout/GridLayoutWrapper" import { Typography } from "@chainsafe/common-components" import CountryStats from "../Modules/CountryStats" -import AltAirPercentage from "../Modules/SoftwareStats/AltAirPercentage" const useStyles = makeStyles(({ constants, breakpoints, palette }: ECTheme) => { return createStyles({ @@ -154,7 +153,6 @@ function HomePage() {
- diff --git a/src/Contexts/Eth2CrawlerContext.tsx b/src/Contexts/Eth2CrawlerContext.tsx index 4f6f8ce..e83b1c0 100644 --- a/src/Contexts/Eth2CrawlerContext.tsx +++ b/src/Contexts/Eth2CrawlerContext.tsx @@ -28,7 +28,6 @@ import { LOAD_NODE_COUNT_OVER_TIME, LOAD_REGIONAL_STATS, LOAD_NODES_BY_COUNTRIES, - LOAD_ALTAIR_UPGRADE_PERCENTAGE, } from "../GraphQL/Queries" import { GetNodeStats, GetNodeStats_getNodeStats } from "../GraphQL/types/GetNodeStats" import { @@ -44,7 +43,6 @@ import { GetNodesByCountries, GetNodesByCountries_aggregateByCountry, } from "../GraphQL/types/GetNodesByCountries" -import { GetAltAirUpgradePercentage } from "../GraphQL/types/GetAltAirUpgradePercentage" type Eth2CrawlerContextProps = { children: React.ReactNode | React.ReactNode[] @@ -60,7 +58,6 @@ interface IEth2CrawlerContext { nodeStatsOverTime: GetNodeStatsOverTime_getNodeStatsOverTime[] nodeRegionalStats: GetRegionalStats_getRegionalStats | undefined nodeCountByCountries: GetNodesByCountries_aggregateByCountry[] - altAirPercentage: number | undefined isLoadingClients: boolean isLoadingOperatingSystems: boolean isLoadingNetworks: boolean @@ -70,7 +67,6 @@ interface IEth2CrawlerContext { isLoadingNodeStatsOverTime: boolean isLoadingNodeRegionalStats: boolean isLoadingNodeCountByCountries: boolean - isLoadingAltAirPercentage: boolean } const Eth2CrawlerContext = React.createContext(undefined) @@ -98,7 +94,6 @@ const Eth2CrawlerProvider = ({ children }: Eth2CrawlerContextProps) => { const [nodeCountByCountries, setNodeCountByCountries] = useState< GetNodesByCountries_aggregateByCountry[] >([]) - const [altAirPercentage, setAltAirPercentage] = useState(undefined) const [isLoadingClients, setIsLoadingClients] = useState(true) const [isLoadingOperatingSystems, setIsLoadingOperatingSystems] = useState(true) @@ -109,7 +104,6 @@ const Eth2CrawlerProvider = ({ children }: Eth2CrawlerContextProps) => { const [isLoadingNodeStatsOverTime, setIsLoadingNodeStatsOverTime] = useState(true) const [isLoadingNodeRegionalStats, setIsLoadingNodeRegionalStats] = useState(true) const [isLoadingNodeCountByCountries, setIsLoadingNodeCountByCountries] = useState(true) - const [isLoadingAltAirPercentage, setIsLoadingAltAirPercentage] = useState(true) const getInitialData = async () => { graphClient @@ -180,13 +174,6 @@ const Eth2CrawlerProvider = ({ children }: Eth2CrawlerContextProps) => { }) .catch(console.error) .finally(() => setIsLoadingNodeCountByCountries(false)) - graphClient - .request(LOAD_ALTAIR_UPGRADE_PERCENTAGE) - .then((result) => { - setAltAirPercentage(result.getAltairUpgradePercentage) - }) - .catch(console.error) - .finally(() => setIsLoadingAltAirPercentage(false)) } useEffect(() => { @@ -205,7 +192,6 @@ const Eth2CrawlerProvider = ({ children }: Eth2CrawlerContextProps) => { heatmap, nodeCountByCountries, clientVersions, - altAirPercentage, isLoadingNodeStats, isLoadingClients, isLoadingOperatingSystems, @@ -215,7 +201,6 @@ const Eth2CrawlerProvider = ({ children }: Eth2CrawlerContextProps) => { isLoadingNodeStatsOverTime, isLoadingNodeRegionalStats, isLoadingNodeCountByCountries, - isLoadingAltAirPercentage, }} > {children} diff --git a/src/GraphQL/Queries.ts b/src/GraphQL/Queries.ts index 8df6540..c967eed 100644 --- a/src/GraphQL/Queries.ts +++ b/src/GraphQL/Queries.ts @@ -95,9 +95,3 @@ export const LOAD_NODES_BY_COUNTRIES = gql` } } ` - -export const LOAD_ALTAIR_UPGRADE_PERCENTAGE = gql` - query GetAltAirUpgradePercentage { - getAltairUpgradePercentage - } -` diff --git a/src/GraphQL/types/GetAltAirUpgradePercentage.ts b/src/GraphQL/types/GetAltAirUpgradePercentage.ts deleted file mode 100644 index bad0460..0000000 --- a/src/GraphQL/types/GetAltAirUpgradePercentage.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* -Copyright 2021 ChainSafe Systems -SPDX-License-Identifier: LGPL-3.0-only -*/ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -// ==================================================== -// GraphQL query operation: GetAltAirUpgradePercentage -// ==================================================== - -export interface GetAltAirUpgradePercentage { - getAltairUpgradePercentage: number; -}