fix: correct the bee version detection (#645)

* feat: Github repository link to ethersphere/bee-dashboard

* fix: correct the Bee version detection
This commit is contained in:
rolandlor
2024-01-10 10:57:55 +01:00
committed by GitHub
parent 79bb315401
commit b3f521ca20
3 changed files with 20 additions and 2 deletions
+12
View File
@@ -4,6 +4,7 @@ import { ReactElement, useContext } from 'react'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import FilesIcon from 'remixicon-react/ArrowUpDownLineIcon' import FilesIcon from 'remixicon-react/ArrowUpDownLineIcon'
import DocsIcon from 'remixicon-react/BookOpenLineIcon' import DocsIcon from 'remixicon-react/BookOpenLineIcon'
import GithubIcon from 'remixicon-react/GithubFillIcon'
import ExternalLinkIcon from 'remixicon-react/ExternalLinkLineIcon' import ExternalLinkIcon from 'remixicon-react/ExternalLinkLineIcon'
import HomeIcon from 'remixicon-react/Home3LineIcon' import HomeIcon from 'remixicon-react/Home3LineIcon'
import SettingsIcon from 'remixicon-react/Settings2LineIcon' import SettingsIcon from 'remixicon-react/Settings2LineIcon'
@@ -17,6 +18,7 @@ import SideBarItem from './SideBarItem'
import SideBarStatus from './SideBarStatus' import SideBarStatus from './SideBarStatus'
import { BeeModes } from '@ethersphere/bee-js' import { BeeModes } from '@ethersphere/bee-js'
import { BEE_DOCS_HOST } from '../constants' import { BEE_DOCS_HOST } from '../constants'
import { GITHUB_BEE_DASHBOARD_URL } from '../constants'
const drawerWidth = 300 const drawerWidth = 300
@@ -126,6 +128,16 @@ export default function SideBar(): ReactElement {
/> />
</MUILink> </MUILink>
</List> </List>
<Divider className={classes.divider} />
<List>
<MUILink href={GITHUB_BEE_DASHBOARD_URL} target="_blank" className={classes.link}>
<SideBarItem
iconStart={<GithubIcon className={classes.icon} />}
iconEnd={<ExternalLinkIcon className={classes.icon} color="#595959" />}
label={<span>Github repository</span>}
/>
</MUILink>
</List>
</Grid> </Grid>
<Grid> <Grid>
<List> <List>
+1
View File
@@ -6,6 +6,7 @@ export const BLOCKCHAIN_EXPLORER_URL = 'https://blockscout.com/xdai/mainnet'
export const BEE_DOCS_HOST = 'https://docs.ethswarm.org/docs/' export const BEE_DOCS_HOST = 'https://docs.ethswarm.org/docs/'
export const BEE_DISCORD_HOST = 'https://discord.gg/eKr9XPv7' export const BEE_DISCORD_HOST = 'https://discord.gg/eKr9XPv7'
export const GITHUB_REPO_URL = 'https://api.github.com/repos/ethersphere/bee' export const GITHUB_REPO_URL = 'https://api.github.com/repos/ethersphere/bee'
export const GITHUB_BEE_DASHBOARD_URL = 'https://github.com/ethersphere/bee-dashboard.git'
export const BEE_DESKTOP_LATEST_RELEASE_PAGE = 'https://github.com/ethersphere/bee-desktop/releases/latest' export const BEE_DESKTOP_LATEST_RELEASE_PAGE = 'https://github.com/ethersphere/bee-desktop/releases/latest'
export const BEE_DESKTOP_LATEST_RELEASE_PAGE_API = export const BEE_DESKTOP_LATEST_RELEASE_PAGE_API =
'https://api.github.com/repos/ethersphere/bee-desktop/releases/latest' 'https://api.github.com/repos/ethersphere/bee-desktop/releases/latest'
+7 -2
View File
@@ -134,14 +134,17 @@ function getStatus(
error: Error | null, error: Error | null,
isDesktop: boolean, isDesktop: boolean,
startedAt: number, startedAt: number,
latestPublishedVersion: string | undefined,
latestUserVersion: string | undefined,
): Status { ): Status {
const status: Status = { ...initialValues.status } const status: Status = { ...initialValues.status }
// Version check // Version check
status.version.isEnabled = !isDesktop status.version.isEnabled = !isDesktop
status.version.checkState = status.version.checkState =
debugApiHealth && latestPublishedVersion &&
semver.satisfies(debugApiHealth.version, PackageJson.engines.bee, { latestUserVersion &&
semver.satisfies(latestPublishedVersion, latestUserVersion, {
includePrerelease: true, includePrerelease: true,
}) })
? CheckState.OK ? CheckState.OK
@@ -435,6 +438,8 @@ export function Provider({ children, isDesktop }: Props): ReactElement {
error, error,
Boolean(isDesktop), Boolean(isDesktop),
startedAt, startedAt,
latestPublishedVersion,
latestUserVersion,
) )
useEffect(() => { useEffect(() => {