refactor: debug api health to use bee-js and removed node readiness (#41)

This commit is contained in:
Vojtech Simetka
2021-04-02 15:20:51 +02:00
committed by GitHub
parent decdd87bb7
commit c88027cc38
4 changed files with 24 additions and 67 deletions
+5 -17
View File
@@ -5,6 +5,7 @@ import { Theme, createStyles, makeStyles } from '@material-ui/core/styles';
import { Card, CardContent, Typography, Chip, Button } from '@material-ui/core/';
import { CheckCircle, Error, ArrowRight, ArrowDropUp } from '@material-ui/icons/';
import { Skeleton } from '@material-ui/lab';
import { Health } from '@ethersphere/bee-js';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
@@ -25,18 +26,7 @@ const useStyles = makeStyles((theme: Theme) =>
backgroundColor: '#e1effe',
}
}),
);
interface NodeHealth {
status?: string,
version?: string
}
interface NodeReadiness {
status?: string,
version?: string
}
);
interface NodeAddresses {
overlay: string,
@@ -58,10 +48,8 @@ interface NodeTopology {
interface IProps{
nodeHealth: NodeHealth,
nodeHealth: Health,
loadingNodeHealth: boolean,
nodeReadiness: NodeReadiness | null,
loadingNodeReadiness: boolean,
beeRelease: any,
loadingBeeRelease: boolean,
nodeAddresses: NodeAddresses,
@@ -108,8 +96,8 @@ function StatusCard(props: IProps) {
<Typography component="div" variant="subtitle2" gutterBottom>
<span>AGENT: </span>
<a href='https://github.com/ethersphere/bee' rel='noreferrer' target='_blank'>Bee</a>
<span>{props.nodeReadiness?.version ? ` v${props.nodeReadiness.version}` : '-'}</span>
{props.beeRelease && props.beeRelease.name === `v${props.nodeReadiness?.version?.split('-')[0]}` ?
<span>{props.nodeHealth?.version ? ` v${props.nodeHealth.version}` : '-'}</span>
{props.beeRelease && props.beeRelease.name === `v${props.nodeHealth?.version?.split('-')[0]}` ?
<Chip
style={{ marginLeft: '7px', color: '#2145a0' }}
size="small"
+4 -10
View File
@@ -5,7 +5,7 @@ import { Container, CircularProgress } from '@material-ui/core';
import NodeSetupWorkflow from './NodeSetupWorkflow';
import StatusCard from './StatusCard';
import EthereumAddressCard from '../../components/EthereumAddressCard';
import { useApiHealth, useDebugApiHealth, useApiReadiness, useApiNodeAddresses, useApiChequebookAddress, useApiNodeTopology, useApiChequebookBalance } from '../../hooks/apiHooks';
import { useApiHealth, useDebugApiHealth, useApiNodeAddresses, useApiChequebookAddress, useApiNodeTopology, useApiChequebookBalance } from '../../hooks/apiHooks';
export default function Status() {
const [beeRelease, setBeeRelease] = useState({ name: ''});
@@ -18,7 +18,6 @@ export default function Status() {
const { health, isLoadingHealth } = useApiHealth()
const { nodeHealth, isLoadingNodeHealth } = useDebugApiHealth()
const { nodeReadiness, isLoadingNodeReadiness } = useApiReadiness()
const { nodeAddresses, isLoadingNodeAddresses } = useApiNodeAddresses()
const { chequebookAddress, isLoadingChequebookAddress } = useApiChequebookAddress()
const { nodeTopology, isLoadingNodeTopology } = useApiNodeTopology()
@@ -80,9 +79,7 @@ export default function Status() {
<div>
<StatusCard
nodeHealth={nodeHealth}
loadingNodeHealth={isLoadingNodeHealth}
nodeReadiness={nodeReadiness}
loadingNodeReadiness={isLoadingNodeReadiness}
loadingNodeHealth={isLoadingNodeHealth}
beeRelease={beeRelease}
loadingBeeRelease={isLoadingBeeRelease}
nodeAddresses={nodeAddresses}
@@ -98,7 +95,7 @@ export default function Status() {
/>
</div>
:
( isLoadingNodeHealth || isLoadingHealth || isLoadingNodeReadiness || isLoadingChequebookAddress ||
( isLoadingNodeHealth || isLoadingHealth || isLoadingChequebookAddress ||
isLoadingNodeTopology || isLoadingBeeRelease || isLoadingNodeAddresses || isLoadingBeeRelease || isLoadingChequebookBalance
)
?
@@ -111,10 +108,7 @@ export default function Status() {
isLoadingBeeRelease={isLoadingBeeRelease}
nodeHealth={nodeHealth}
isLoadingNodeHealth={isLoadingNodeHealth}
nodeReadiness={nodeReadiness}
isLoadingNodeReadiness={isLoadingNodeReadiness}
isLoadingNodeHealth={isLoadingNodeHealth}
nodeAddresses={nodeAddresses}
isLoadingNodeAddresses={isLoadingNodeAddresses}