mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
commit output, network output, keeper version output
This commit is contained in:
parent
8e9a4c1fd2
commit
512f06f7d4
@ -0,0 +1,22 @@
|
|||||||
|
@import '../../../styles/variables';
|
||||||
|
|
||||||
|
.spinner {
|
||||||
|
composes: spinner, small from '../../atoms/Spinner.module.scss';
|
||||||
|
margin-right: $spacer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commit {
|
||||||
|
margin-left: $spacer / 8;
|
||||||
|
|
||||||
|
code {
|
||||||
|
color: $brand-grey-light;
|
||||||
|
font-size: $font-size-mini;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.network {
|
||||||
|
color: $brand-grey-light;
|
||||||
|
text-transform: capitalize;
|
||||||
|
margin-left: $spacer / 8;
|
||||||
|
font-size: $font-size-mini;
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { OceanPlatformTechStatus } from '@oceanprotocol/squid'
|
||||||
|
import slugify from '@sindresorhus/slugify'
|
||||||
|
import Spinner from '../../atoms/Spinner'
|
||||||
|
import styles from './VersionNumber.module.scss'
|
||||||
|
|
||||||
|
const VersionNumber = ({
|
||||||
|
name,
|
||||||
|
version,
|
||||||
|
network,
|
||||||
|
status,
|
||||||
|
commit
|
||||||
|
}: {
|
||||||
|
name: string
|
||||||
|
version?: string
|
||||||
|
network?: string
|
||||||
|
status?: OceanPlatformTechStatus
|
||||||
|
commit?: string
|
||||||
|
}) =>
|
||||||
|
version ? (
|
||||||
|
<>
|
||||||
|
<a
|
||||||
|
href={`https://github.com/oceanprotocol/${slugify(
|
||||||
|
name
|
||||||
|
)}/releases/tag/v${version}`}
|
||||||
|
title="Go to release on GitHub"
|
||||||
|
>
|
||||||
|
<code>v{version}</code>
|
||||||
|
</a>
|
||||||
|
{commit && (
|
||||||
|
<a
|
||||||
|
href={`https://github.com/oceanprotocol/${slugify(
|
||||||
|
name
|
||||||
|
)}/commit/${commit}`}
|
||||||
|
className={styles.commit}
|
||||||
|
title={`Go to commit ${commit} on GitHub`}
|
||||||
|
>
|
||||||
|
<code>{commit.substring(0, 7)}</code>
|
||||||
|
</a>
|
||||||
|
)}
|
||||||
|
{network && <span className={styles.network}>{` ${network}`}</span>}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<span>
|
||||||
|
{status === OceanPlatformTechStatus.Loading ? (
|
||||||
|
<Spinner className={styles.spinner} small />
|
||||||
|
) : (
|
||||||
|
status || 'Could not get version'
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
|
||||||
|
export default VersionNumber
|
@ -33,4 +33,5 @@
|
|||||||
.indicatorLabel {
|
.indicatorLabel {
|
||||||
font-family: $font-family-title;
|
font-family: $font-family-title;
|
||||||
color: $brand-grey;
|
color: $brand-grey;
|
||||||
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,9 @@ const VersionStatus = ({
|
|||||||
>
|
>
|
||||||
{value}
|
{value}
|
||||||
</span>
|
</span>
|
||||||
<span className={styles.indicatorLabel}>{key}</span>
|
<span className={styles.indicatorLabel}>
|
||||||
|
{key === 'ok' ? 'components' : key}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
@ -23,12 +23,20 @@
|
|||||||
td {
|
td {
|
||||||
padding: $spacer / 6 $spacer / 2;
|
padding: $spacer / 6 $spacer / 2;
|
||||||
|
|
||||||
// stylelint-disable-next-line selector-max-compound-selectors
|
// stylelint-disable selector-max-compound-selectors
|
||||||
&,
|
&,
|
||||||
code {
|
code {
|
||||||
font-size: $font-size-mini;
|
font-size: $font-size-mini;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tr:first-child td {
|
||||||
|
&,
|
||||||
|
code {
|
||||||
|
font-size: $font-size-small;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// stylelint-enable selector-max-compound-selectors
|
||||||
}
|
}
|
||||||
|
|
||||||
td {
|
td {
|
||||||
|
@ -2,18 +2,32 @@ import React from 'react'
|
|||||||
import { VersionNumbersState } from '.'
|
import { VersionNumbersState } from '.'
|
||||||
import VersionTableRow from './VersionTableRow'
|
import VersionTableRow from './VersionTableRow'
|
||||||
import styles from './VersionTable.module.scss'
|
import styles from './VersionTable.module.scss'
|
||||||
|
import VersionNumber from './VersionNumber'
|
||||||
|
|
||||||
export const VersionTableContracts = ({
|
export const VersionTableContracts = ({
|
||||||
contracts,
|
contracts,
|
||||||
network
|
network,
|
||||||
|
keeperVersion
|
||||||
}: {
|
}: {
|
||||||
contracts: {
|
contracts: {
|
||||||
[contractName: string]: string
|
[contractName: string]: string
|
||||||
}
|
}
|
||||||
network: string
|
network: string
|
||||||
|
keeperVersion?: string
|
||||||
}) => (
|
}) => (
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<strong>Keeper Contracts</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<VersionNumber
|
||||||
|
name={'Keeper Contracts'}
|
||||||
|
version={keeperVersion}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
{contracts &&
|
{contracts &&
|
||||||
Object.keys(contracts)
|
Object.keys(contracts)
|
||||||
// sort alphabetically
|
// sort alphabetically
|
||||||
|
@ -12,8 +12,3 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: $brand-grey-light;
|
color: $brand-grey-light;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spinner {
|
|
||||||
composes: spinner, small from '../../atoms/Spinner.module.scss';
|
|
||||||
margin-right: $spacer;
|
|
||||||
}
|
|
||||||
|
@ -1,42 +1,9 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import useCollapse from 'react-collapsed'
|
import useCollapse from 'react-collapsed'
|
||||||
import { OceanPlatformTechStatus } from '@oceanprotocol/squid'
|
|
||||||
import slugify from '@sindresorhus/slugify'
|
import slugify from '@sindresorhus/slugify'
|
||||||
import Spinner from '../../atoms/Spinner'
|
|
||||||
import styles from './VersionTableRow.module.scss'
|
import styles from './VersionTableRow.module.scss'
|
||||||
import { VersionTableContracts } from './VersionTable'
|
import { VersionTableContracts } from './VersionTable'
|
||||||
|
import VersionNumber from './VersionNumber'
|
||||||
const VersionNumber = ({
|
|
||||||
name,
|
|
||||||
version,
|
|
||||||
network,
|
|
||||||
status
|
|
||||||
}: {
|
|
||||||
name: string
|
|
||||||
version?: string
|
|
||||||
network?: string
|
|
||||||
status: OceanPlatformTechStatus
|
|
||||||
}) =>
|
|
||||||
version ? (
|
|
||||||
<>
|
|
||||||
<a
|
|
||||||
href={`https://github.com/oceanprotocol/${slugify(
|
|
||||||
name
|
|
||||||
)}/releases/tag/v${version}`}
|
|
||||||
>
|
|
||||||
<code>v{version}</code>
|
|
||||||
</a>
|
|
||||||
{network && `(${network})`}
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<span>
|
|
||||||
{status === OceanPlatformTechStatus.Loading ? (
|
|
||||||
<Spinner className={styles.spinner} small />
|
|
||||||
) : (
|
|
||||||
status || 'Could not get version'
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
|
|
||||||
const VersionTableRow = ({ value }: { value: any }) => {
|
const VersionTableRow = ({ value }: { value: any }) => {
|
||||||
const collapseStyles = {
|
const collapseStyles = {
|
||||||
@ -79,6 +46,7 @@ const VersionTableRow = ({ value }: { value: any }) => {
|
|||||||
version={value.version}
|
version={value.version}
|
||||||
status={value.status}
|
status={value.status}
|
||||||
network={value.network}
|
network={value.network}
|
||||||
|
commit={value.commit}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -88,6 +56,7 @@ const VersionTableRow = ({ value }: { value: any }) => {
|
|||||||
<VersionTableContracts
|
<VersionTableContracts
|
||||||
contracts={value.contracts}
|
contracts={value.contracts}
|
||||||
network={value.network || ''}
|
network={value.network || ''}
|
||||||
|
keeperVersion={value.keeperVersion}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -8,14 +8,17 @@ import axios from 'axios'
|
|||||||
import { version } from '../../../../package.json'
|
import { version } from '../../../../package.json'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
import { faucetUri } from '../../../config'
|
import { nodeUri, faucetUri } from '../../../config'
|
||||||
import { User } from '../../../context'
|
import { User } from '../../../context'
|
||||||
|
|
||||||
import VersionTable from './VersionTable'
|
import VersionTable from './VersionTable'
|
||||||
import VersionStatus from './VersionStatus'
|
import VersionStatus from './VersionStatus'
|
||||||
|
|
||||||
|
// construct values which are not part of any response
|
||||||
export const commonsVersion =
|
export const commonsVersion =
|
||||||
process.env.NODE_ENV === 'production' ? version : `${version}-dev`
|
process.env.NODE_ENV === 'production' ? version : `${version}-dev`
|
||||||
|
const commonsNetwork = new URL(nodeUri).hostname.split('.')[0]
|
||||||
|
const faucetNetwork = new URL(faucetUri).hostname.split('.')[1]
|
||||||
|
|
||||||
interface VersionNumbersProps {
|
interface VersionNumbersProps {
|
||||||
minimal?: boolean
|
minimal?: boolean
|
||||||
@ -25,10 +28,12 @@ export interface VersionNumbersState extends OceanPlatformVersions {
|
|||||||
commons: {
|
commons: {
|
||||||
name: string
|
name: string
|
||||||
version: string
|
version: string
|
||||||
|
network: string
|
||||||
}
|
}
|
||||||
faucet: {
|
faucet: {
|
||||||
name: string
|
name: string
|
||||||
version: string
|
version: string
|
||||||
|
network: string
|
||||||
status: OceanPlatformTechStatus
|
status: OceanPlatformTechStatus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,9 +44,11 @@ export default class VersionNumbers extends PureComponent<
|
|||||||
> {
|
> {
|
||||||
public static contextType = User
|
public static contextType = User
|
||||||
|
|
||||||
|
// define a minimal default state to fill UI
|
||||||
public state: VersionNumbersState = {
|
public state: VersionNumbersState = {
|
||||||
commons: {
|
commons: {
|
||||||
name: 'Commons',
|
name: 'Commons',
|
||||||
|
network: commonsNetwork,
|
||||||
version: commonsVersion
|
version: commonsVersion
|
||||||
},
|
},
|
||||||
squid: {
|
squid: {
|
||||||
@ -54,12 +61,12 @@ export default class VersionNumbers extends PureComponent<
|
|||||||
},
|
},
|
||||||
brizo: {
|
brizo: {
|
||||||
name: 'Brizo',
|
name: 'Brizo',
|
||||||
network: 'Nile',
|
|
||||||
status: OceanPlatformTechStatus.Loading
|
status: OceanPlatformTechStatus.Loading
|
||||||
},
|
},
|
||||||
faucet: {
|
faucet: {
|
||||||
name: 'Faucet',
|
name: 'Faucet',
|
||||||
version: '',
|
version: '',
|
||||||
|
network: faucetNetwork,
|
||||||
status: OceanPlatformTechStatus.Loading
|
status: OceanPlatformTechStatus.Loading
|
||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user