From fc1a8cb0a072855896c4c308c5fb0d2148294aa2 Mon Sep 17 00:00:00 2001 From: matmertz25 <40722304+matmertz25@users.noreply.github.com> Date: Thu, 1 Apr 2021 05:53:32 -0700 Subject: [PATCH] feat: split api status checks (#37) * chore: split node and debug api status checks * chore: update final status check * chore: resolved compilation issues Co-authored-by: Vojtech Simetka --- src/pages/status/NodeSetupWorkflow.tsx | 23 ++++-- .../SetupSteps/DebugConnectionCheck.tsx | 76 +++++++++++++++++++ .../status/SetupSteps/NodeConnectionCheck.tsx | 64 +--------------- 3 files changed, 93 insertions(+), 70 deletions(-) create mode 100644 src/pages/status/SetupSteps/DebugConnectionCheck.tsx diff --git a/src/pages/status/NodeSetupWorkflow.tsx b/src/pages/status/NodeSetupWorkflow.tsx index bc340f7..7f612c6 100644 --- a/src/pages/status/NodeSetupWorkflow.tsx +++ b/src/pages/status/NodeSetupWorkflow.tsx @@ -3,6 +3,7 @@ import { makeStyles, Theme, createStyles } from '@material-ui/core/styles'; import { Typography, Paper, Button, Step, StepLabel, StepContent, Stepper, StepButton } from '@material-ui/core/'; import { CheckCircle, Error, Sync, ExpandLessSharp, ExpandMoreSharp } from '@material-ui/icons/'; +import DebugConnectionCheck from './SetupSteps/DebugConnectionCheck'; import NodeConnectionCheck from './SetupSteps/NodeConnectionCheck'; import VersionCheck from './SetupSteps/VersionCheck'; import EthereumConnectionCheck from './SetupSteps/EthereumConnectionCheck'; @@ -30,10 +31,11 @@ const useStyles = makeStyles((theme: Theme) => function getSteps() { return [ - 'Node Connection Check', + 'Debug Connection Check', 'Version Check', 'Connect to Ethereum Blockchain', 'Deploy and Fund Chequebook', + 'Node Connection Check', 'Connect to Peers', ]; } @@ -42,13 +44,15 @@ function getStepContent(step: number, props: any) { switch (step) { case 0: - return ; + return ; case 1: return ; case 2: return ; case 3: return ; + case 4: + return ; default: return ; } @@ -69,7 +73,7 @@ export default function NodeSetupWorkflow(props: any) { }; const evaluateNodeStatus = () => { - if (nodeHealth?.status === 'ok' && nodeApiHealth) { + if (nodeHealth?.status === 'ok') { handleComplete(0) setActiveStep(1) } @@ -89,10 +93,15 @@ export default function NodeSetupWorkflow(props: any) { setActiveStep(4) } - if (nodeTopology.connected && nodeTopology.connected > 0) { + if (nodeApiHealth) { handleComplete(4) setActiveStep(5) } + + if (nodeTopology.connected && nodeTopology.connected > 0) { + handleComplete(5) + setActiveStep(6) + } } evaluateNodeStatus() }, [nodeHealth, nodeApiHealth, nodeAddresses, chequebookAddress, beeRelease, chequebookBalance, nodeTopology, completed]) @@ -121,7 +130,7 @@ export default function NodeSetupWorkflow(props: any) { {steps.map((label, index) => ( setActiveStep(index === activeStep ? 5 : index)} + onClick={() => setActiveStep(index === activeStep ? 6 : index)} StepIconComponent={() => { if(completed[index]) return @@ -130,7 +139,7 @@ export default function NodeSetupWorkflow(props: any) { } }} > - setActiveStep(index === activeStep ? 5 : index)} style={{justifyContent:'space-between'}}> + setActiveStep(index === activeStep ? 6 : index)} style={{justifyContent:'space-between'}}>
{label}
{index === activeStep ? : }
@@ -162,7 +171,7 @@ export default function NodeSetupWorkflow(props: any) { ))} - {Object.values(completed).filter(value => value).length === 5 ? ( + {Object.values(completed).filter(value => value).length === 6 ? ( Bee setup complete! Welcome to the swarm and the internet of decentralized storage
+ ) +} \ No newline at end of file diff --git a/src/pages/status/SetupSteps/NodeConnectionCheck.tsx b/src/pages/status/SetupSteps/NodeConnectionCheck.tsx index aac3809..19cf127 100644 --- a/src/pages/status/SetupSteps/NodeConnectionCheck.tsx +++ b/src/pages/status/SetupSteps/NodeConnectionCheck.tsx @@ -1,6 +1,5 @@ import React from 'react' import { Typography, Accordion, AccordionSummary, AccordionDetails } from '@material-ui/core/'; -import MuiAlert from '@material-ui/lab/Alert'; import { CheckCircle, Error, ExpandMoreSharp } from '@material-ui/icons/'; import ConnectToHost from '../../../components/ConnectToHost'; @@ -9,7 +8,7 @@ import CodeBlockTabs from '../../../components/CodeBlockTabs' export default function NodeConnectionCheck(props: any) { return (
-

Connect to Bee Node APIs

+

Connect to Bee Node API

{ props.nodeApiHealth ? @@ -60,67 +59,6 @@ export default function NodeConnectionCheck(props: any) { : null}
-
-
- { props.nodeHealth?.status === 'ok' ? - - : - - } - Debug API ({props.debugApiHost}) - -
-
- { props.nodeHealth?.status !== 'ok' ? - - We cannot connect to your nodes debug API at {props.debugApiHost}. Please check the following to troubleshoot your issue. - - } - aria-controls="panel1a-content" - id="panel1a-header" - > - Troubleshoot - - - -
    -
  1. Check the status of your node by running the below command to see if your node is running.
  2. - -
  3. If your node is running, check your firewall settings to make sure that port 1635 (or your custom specified port) is bound to localhost. If your node is not running try executing the below command to start your bee node
  4. - - Your debug node API should never be completely open to the internet. If you want to connect remotely, make sure your firewall settings are set to only allow specific trusted IP addresses and block all other ports. A simple google search for "what is my ip" will show you your computers public IP address to allow. - - -
  5. Run the commands to validate your node is running and see the log output.
  6. - -
  7. Lastly, check your nodes configuration settings to validate the debug API is enabled and the Cross Origin Resource Sharing (CORS) setting is configured to allow your host. Config parameter debug-api-enable must be set to true and cors-allowed-origins must be set to your host domain or IP. If edits are made to the configuration run the restart command below for changes to take effect.
  8. - -
-
-
-
-
- : - null} -
-
) }