diff --git a/data/sidebars/concepts.yml b/data/sidebars/concepts.yml index 5eee2503..776e586d 100644 --- a/data/sidebars/concepts.yml +++ b/data/sidebars/concepts.yml @@ -8,6 +8,8 @@ link: /concepts/architecture/ - title: Supported Networks link: /concepts/networks/ + - title: Deployments + link: /concepts/deployments/ - title: Projects using Ocean link: /concepts/projects-using-ocean/ diff --git a/gatsby-node.js b/gatsby-node.js index 1a765c90..330d4fa9 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -128,9 +128,11 @@ exports.createPages = ({ graphql, actions }) => { }) }) - // API: brizo, aquarius + // API: aquarius await createSwaggerPages(createPage) + await createDeploymentsPage(createPage) + // API: ocean.js const lastRelease = result.data.oceanJs.repository.releases.edges.filter( @@ -176,6 +178,15 @@ exports.createPages = ({ graphql, actions }) => { }) } +const createDeploymentsPage = async (createPage) => { + const template = path.resolve('./src/components/Deployments.jsx') + const slug = `/concepts/deployments/` + + createPage({ + path: slug, + component: template + }) +} // // Create pages from TypeDoc json files // diff --git a/src/components/Deployments.jsx b/src/components/Deployments.jsx new file mode 100644 index 00000000..9387c84a --- /dev/null +++ b/src/components/Deployments.jsx @@ -0,0 +1,151 @@ +import React, { useState, useEffect } from 'react' +import { Helmet } from 'react-helmet' +import Layout from '../components/Layout' +import Content from '../components/Content' +import HeaderSection from '../components/HeaderSection' +import Sidebar from '../components/Sidebar' +import stylesDoc from '../templates/Doc.module.scss' +import Seo from './Seo' +import PropTypes from 'prop-types' +import { graphql } from 'gatsby' + +export default function Deployments({ data, location }) { + const [content, setContent] = useState(undefined) + const [loading, setLoading] = useState(true) + + const networks = { + 'Ethereum Mainnet': { + aquarius: 'https://aquarius.mainnet.oceanprotocol.com', + provider: 'https://provider.mainnet.oceanprotocol.com' + }, + 'Polygon Mainnet': { + aquarius: 'https://aquarius.polygon.oceanprotocol.com', + provider: 'https://provider.polygon.oceanprotocol.com' + }, + 'Binance Smart Chain': { + aquarius: 'https://aquarius.bsc.oceanprotocol.com', + provider: 'https://provider.bsc.oceanprotocol.com' + }, + Ropsten: { + aquarius: 'https://aquarius.ropsten.oceanprotocol.com', + provider: 'https://provider.ropsten.oceanprotocol.com' + }, + Rinkeby: { + aquarius: 'https://aquarius.rinkeby.oceanprotocol.com', + provider: 'https://provider.rinkeby.oceanprotocol.com' + }, + Mumbai: { + aquarius: 'https://aquarius.mumbai.oceanprotocol.com', + provider: 'https://provider.mumbai.oceanprotocol.com' + } + } + + useEffect(async () => { + const table = await getTable(networks) + setContent(table) + setLoading(false) + }, []) + + const getAquariusVersion = async (url) => { + if (!url) return + try { + const data = await fetch(url) + const { version } = await data.json() + return version + } catch { + return '-' + } + } + + const getProviderVersion = async (url) => { + if (!url) return + try { + const data = await fetch(url) + const { version } = await data.json() + return version + } catch { + return '-' + } + } + + const getTable = async (networks) => { + const objs = [] + + for (const key of Object.keys(networks)) { + const aquariusVerison = await getAquariusVersion(networks[key].aquarius) + const providerVerison = await getProviderVersion(networks[key].provider) + objs.push( + + {key} + {aquariusVerison} + {providerVerison} + + ) + } + + return ( +
+ {' '} + + + + + + + + + {objs} +
NetworkAquariusProvider
+
+ ) + } + + return ( + <> + + + + + + + + + +
+ +
+
{loading ? <>Fetching versions : content}
+
+
+
+
+ + ) +} + +Deployments.propTypes = { + data: PropTypes.object.isRequired, + location: PropTypes.object.isRequired +} + +export const DeploymentsQuery = graphql` + query { + allSectionsYaml { + edges { + node { + title + description + link + } + } + } + } +`