Compare commits

...

4 Commits

Author SHA1 Message Date
bee-worker e780b971d9 chore(master): release 0.22.0 (#604) 2023-01-19 12:17:25 +01:00
Cafe137 90f9f91ddb feat: add node connecting status (#603) 2023-01-19 12:05:24 +01:00
bee-worker 01838dccd1 chore(master): release 0.21.1 (#600) 2022-12-21 14:49:34 +01:00
Cafe137 42b7f080b0 fix: do not require chequebook funding (#599)
* fix: do not require chequebook funding

* chore: revert import sorting
2022-12-21 14:36:24 +01:00
9 changed files with 72 additions and 29 deletions
+14
View File
@@ -1,5 +1,19 @@
# Changelog # Changelog
## [0.22.0](https://github.com/ethersphere/bee-dashboard/compare/v0.21.1...v0.22.0) (2023-01-19)
### Features
* add node connecting status ([#603](https://github.com/ethersphere/bee-dashboard/issues/603)) ([90f9f91](https://github.com/ethersphere/bee-dashboard/commit/90f9f91ddbefb47b40c7e567125972b800d81972))
## [0.21.1](https://github.com/ethersphere/bee-dashboard/compare/v0.21.0...v0.21.1) (2022-12-21)
### Bug Fixes
* do not require chequebook funding ([#599](https://github.com/ethersphere/bee-dashboard/issues/599)) ([42b7f08](https://github.com/ethersphere/bee-dashboard/commit/42b7f080b00a94f068d2fad4779d02ddcf58e27d))
## [0.21.0](https://github.com/ethersphere/bee-dashboard/compare/v0.20.2...v0.21.0) (2022-12-01) ## [0.21.0](https://github.com/ethersphere/bee-dashboard/compare/v0.20.2...v0.21.0) (2022-12-01)
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "@ethersphere/bee-dashboard", "name": "@ethersphere/bee-dashboard",
"version": "0.21.0", "version": "0.22.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@ethersphere/bee-dashboard", "name": "@ethersphere/bee-dashboard",
"version": "0.21.0", "version": "0.22.0",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"dependencies": { "dependencies": {
"@ethersphere/bee-js": "^5.1.0", "@ethersphere/bee-js": "^5.1.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@ethersphere/bee-dashboard", "name": "@ethersphere/bee-dashboard",
"version": "0.21.0", "version": "0.22.0",
"description": "An app which helps users to setup their Bee node and do actions like cash out cheques", "description": "An app which helps users to setup their Bee node and do actions like cash out cheques",
"keywords": [ "keywords": [
"bee", "bee",
+4 -1
View File
@@ -2,6 +2,7 @@ import { createStyles, makeStyles, Theme, Typography } from '@material-ui/core'
import { ReactElement } from 'react' import { ReactElement } from 'react'
import Check from 'remixicon-react/CheckLineIcon' import Check from 'remixicon-react/CheckLineIcon'
import AlertCircle from 'remixicon-react/ErrorWarningFillIcon' import AlertCircle from 'remixicon-react/ErrorWarningFillIcon'
import Connecting from 'remixicon-react/LinksLineIcon'
import RefreshLine from 'remixicon-react/RefreshLineIcon' import RefreshLine from 'remixicon-react/RefreshLineIcon'
import { SwarmButton, SwarmButtonProps } from './SwarmButton' import { SwarmButton, SwarmButtonProps } from './SwarmButton'
@@ -10,7 +11,7 @@ interface Props {
title: string title: string
subtitle: string subtitle: string
buttonProps: SwarmButtonProps buttonProps: SwarmButtonProps
status: 'ok' | 'error' | 'loading' status: 'ok' | 'error' | 'loading' | 'connecting'
} }
const useStyles = (backgroundColor: string) => const useStyles = (backgroundColor: string) =>
@@ -65,6 +66,8 @@ export default function Card({ buttonProps, icon, title, subtitle, status }: Pro
statusIcon = <AlertCircle size="13" color="#f44336" /> statusIcon = <AlertCircle size="13" color="#f44336" />
} else if (status === 'loading') { } else if (status === 'loading') {
statusIcon = <RefreshLine size="13" color="orange" /> statusIcon = <RefreshLine size="13" color="orange" />
} else if (status === 'connecting') {
statusIcon = <Connecting size="13" color="#0074D9" />
} }
return ( return (
+4 -3
View File
@@ -1,9 +1,9 @@
import { ReactElement, useContext } from 'react' import { ReactElement, useContext } from 'react'
import { useLocation, matchPath } from 'react-router-dom' import { matchPath, useLocation } from 'react-router-dom'
import ArrowRight from 'remixicon-react/ArrowRightLineIcon' import ArrowRight from 'remixicon-react/ArrowRightLineIcon'
import { createStyles, Theme, makeStyles } from '@material-ui/core/styles' import { ListItem, ListItemIcon, ListItemText, Typography } from '@material-ui/core'
import { ListItemText, ListItemIcon, ListItem, Typography } from '@material-ui/core' import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'
import { Context } from '../providers/Bee' import { Context } from '../providers/Bee'
import StatusIcon from './StatusIcon' import StatusIcon from './StatusIcon'
@@ -44,6 +44,7 @@ const useStyles = makeStyles((theme: Theme) =>
}, },
smallerText: { smallerText: {
fontSize: '0.9rem', fontSize: '0.9rem',
whiteSpace: 'nowrap',
}, },
}), }),
) )
+4 -1
View File
@@ -1,5 +1,5 @@
import type { ReactElement } from 'react'
import { CircularProgress } from '@material-ui/core' import { CircularProgress } from '@material-ui/core'
import type { ReactElement } from 'react'
import { CheckState } from '../providers/Bee' import { CheckState } from '../providers/Bee'
interface Props { interface Props {
@@ -28,6 +28,9 @@ export default function StatusIcon({ checkState, size, className, isLoading }: P
case CheckState.STARTING: case CheckState.STARTING:
backgroundColor = 'orange' backgroundColor = 'orange'
break break
case CheckState.CONNECTING:
backgroundColor = '#0074D9'
break
default: default:
// Default is error // Default is error
backgroundColor = '#ff3a52' backgroundColor = '#ff3a52'
+12
View File
@@ -12,6 +12,18 @@ export default function NodeInfoCard(): ReactElement {
const { status } = useContext(BeeContext) const { status } = useContext(BeeContext)
const navigate = useNavigate() const navigate = useNavigate()
if (status.all === CheckState.CONNECTING) {
return (
<Card
buttonProps={{ iconType: Settings, children: 'Open node setup', onClick: () => navigate(ROUTES.STATUS) }}
icon={<Globe />}
title="Connecting..."
subtitle="Attempting to establish connection to your Bee node."
status="connecting"
/>
)
}
if (status.all === CheckState.STARTING) { if (status.all === CheckState.STARTING) {
return ( return (
<Card <Card
@@ -19,16 +19,13 @@ const ChequebookDeployFund = (): ReactElement | null => {
switch (checkState) { switch (checkState) {
case CheckState.OK: case CheckState.OK:
text = 'Your chequebook is deployed and funded'
break
case CheckState.WARNING:
text = ( text = (
<> <>
Your chequebook is not funded. Please deposit some xBZZ to your chequebook address. You may need to aquire BZZ Your chequebook is deployed. You may deposit some xBZZ to your chequebook to afford more traffic. You can
(e.g. <a href="https://bzz.exchange/">bzz.exchange</a>) and bridge it to the Gnosis Chain network through the{' '} acquire BZZ (e.g. <a href="https://bzz.exchange/">bzz.exchange</a>) and bridge it to the Gnosis Chain network
<a href="https://omni.gnosischain.com/bridge">omni bridge</a>. To pay the transaction fees, you will also need through the <a href="https://omni.gnosischain.com/bridge">omni bridge</a>. To pay the transaction fees, you
xDAI token. You can purchase DAI on the Ethereum mainnet network and bridge it to Gnosis Chain network through will also need xDAI token. You can purchase DAI on the Ethereum mainnet network and bridge it to Gnosis Chain
the <a href="https://bridge.gnosischain.com">xDai Bridge</a>. See the{' '} network through the <a href="https://bridge.gnosischain.com">xDai Bridge</a>. See the{' '}
<a href="https://www.gnosischain.com">official Gnosis Chain website</a> for more information. <a href="https://www.gnosischain.com">official Gnosis Chain website</a> for more information.
</> </>
) )
+26 -13
View File
@@ -17,11 +17,13 @@ import { Token } from '../models/Token'
import type { Balance, ChequebookBalance, Settlements } from '../types' import type { Balance, ChequebookBalance, Settlements } from '../types'
import { Context as SettingsContext } from './Settings' import { Context as SettingsContext } from './Settings'
const LAUNCH_GRACE_PERIOD = 15_000
const REFRESH_WHEN_OK = 30_000 const REFRESH_WHEN_OK = 30_000
const REFRESH_WHEN_ERROR = 5_000 const REFRESH_WHEN_ERROR = 5_000
const TIMEOUT = 3_000 const TIMEOUT = 3_000
export enum CheckState { export enum CheckState {
CONNECTING = 'Connecting',
OK = 'OK', OK = 'OK',
WARNING = 'Warning', WARNING = 'Warning',
ERROR = 'Error', ERROR = 'Error',
@@ -128,6 +130,7 @@ function getStatus(
chequebookBalance: ChequebookBalance | null, chequebookBalance: ChequebookBalance | null,
error: Error | null, error: Error | null,
isDesktop: boolean, isDesktop: boolean,
startedAt: number,
): Status { ): Status {
const status: Status = { ...initialValues.status } const status: Status = { ...initialValues.status }
@@ -163,29 +166,37 @@ function getStatus(
if (error || (nodeInfo && [BeeModes.FULL, BeeModes.LIGHT].includes(nodeInfo.beeMode))) { if (error || (nodeInfo && [BeeModes.FULL, BeeModes.LIGHT].includes(nodeInfo.beeMode))) {
status.chequebook.isEnabled = true status.chequebook.isEnabled = true
if ( if (chequebookAddress?.chequebookAddress && chequebookBalance !== null) {
chequebookAddress?.chequebookAddress &&
chequebookBalance !== null &&
chequebookBalance?.totalBalance.toBigNumber.isGreaterThan(0)
) {
status.chequebook.checkState = CheckState.OK status.chequebook.checkState = CheckState.OK
} else if (chequebookAddress?.chequebookAddress) status.chequebook.checkState = CheckState.WARNING } else status.chequebook.checkState = CheckState.OK
else status.chequebook.checkState = CheckState.OK
} }
status.all = determineOverallStatus(debugApiHealth, debugApiReadiness, status) status.all = determineOverallStatus(debugApiHealth, debugApiReadiness, status, startedAt)
return status return status
} }
function determineOverallStatus(debugApiHealth: Health | null, debugApiReadiness: boolean, status: Status): CheckState { function determineOverallStatus(
debugApiHealth: Health | null,
debugApiReadiness: boolean,
status: Status,
startedAt: number,
): CheckState {
const hasErrors = Object.values(status).some(
({ isEnabled, checkState }) => isEnabled && checkState === CheckState.ERROR,
)
const hasWarnings = Object.values(status).some(
({ isEnabled, checkState }) => isEnabled && checkState === CheckState.WARNING,
)
const isInGracePeriod = Date.now() - startedAt < LAUNCH_GRACE_PERIOD
if (debugApiHealth?.status === 'ok' && !debugApiReadiness) { if (debugApiHealth?.status === 'ok' && !debugApiReadiness) {
return CheckState.STARTING return CheckState.STARTING
} else if (Object.values(status).some(({ isEnabled, checkState }) => isEnabled && checkState === CheckState.ERROR)) { } else if (hasErrors && isInGracePeriod) {
return CheckState.CONNECTING
} else if (hasErrors) {
return CheckState.ERROR return CheckState.ERROR
} else if ( } else if (hasWarnings) {
Object.values(status).some(({ isEnabled, checkState }) => isEnabled && checkState === CheckState.WARNING)
) {
return CheckState.WARNING return CheckState.WARNING
} else { } else {
return CheckState.OK return CheckState.OK
@@ -219,6 +230,7 @@ export function Provider({ children, isDesktop }: Props): ReactElement {
const [settlements, setSettlements] = useState<Settlements | null>(null) const [settlements, setSettlements] = useState<Settlements | null>(null)
const [chainState, setChainState] = useState<ChainState | null>(null) const [chainState, setChainState] = useState<ChainState | null>(null)
const [chainId, setChainId] = useState<number | null>(null) const [chainId, setChainId] = useState<number | null>(null)
const [startedAt] = useState(Date.now())
const { latestBeeRelease } = useLatestBeeRelease() const { latestBeeRelease } = useLatestBeeRelease()
@@ -413,6 +425,7 @@ export function Provider({ children, isDesktop }: Props): ReactElement {
chequebookBalance, chequebookBalance,
error, error,
Boolean(isDesktop), Boolean(isDesktop),
startedAt,
) )
useEffect(() => { useEffect(() => {