Updating port, types, and data imports

This commit is contained in:
Jamie Hewitt 2022-10-05 14:15:54 +03:00
parent d67db95c42
commit 1a95924eb5
6 changed files with 52 additions and 47 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
NEXT_STATUS_API_URI='http://localhost:8080'

1
.env.example Normal file
View File

@ -0,0 +1 @@
NEXT_STATUS_API_URI='http://localhost:8080'

4
@types/index.d.ts vendored
View File

@ -30,8 +30,9 @@ export interface ProviderStatus {
export interface AquariusStatus { export interface AquariusStatus {
status?: State status?: State
response?: number response?: number
chain?: boolean validChainList?: boolean
version?: string version?: string
monitorVersion?: string
latestRelease?: string latestRelease?: string
block?: number block?: number
validQuery?: boolean validQuery?: boolean
@ -77,6 +78,7 @@ export interface dbRow {
aquariusResponse: number aquariusResponse: number
aquariusChain: number aquariusChain: number
aquariusVersion: string aquariusVersion: string
aquariusMonitorVersion: string
aquariusLatestRelease: string aquariusLatestRelease: string
aquariusBlock: number aquariusBlock: number
aquariusValidQuery: number aquariusValidQuery: number

View File

@ -1,3 +1,3 @@
module.exports = { module.exports = {
statusServiceUri: process.env.NEXT_STATUS_API_URI || 'http://localhost:3000' statusServiceUri: process.env.NEXT_STATUS_API_URI || 'http://localhost:8080'
} }

View File

@ -1,19 +1,19 @@
import type { NextPage } from 'next'
import Head from 'next/head' import Head from 'next/head'
import Image from 'next/image' import React, { ReactElement, useEffect, useState } from 'react'
import { ReactElement, useEffect, useState } from 'react'
import { Status } from '../@types' import { Status } from '../@types'
import styles from '../styles/Home.module.css' import styles from '../styles/Home.module.css'
import { getData } from '../utils/getData' import { getData } from '../utils/getData'
export default function HomePage(): ReactElement { export default function HomePage(): ReactElement {
const [statuses, setStatuses] = useState<Status[]>() const [statuses, setStatuses] = useState<Status[]>()
const [network, setNetwork] = useState<number>(1)
useEffect(() => { useEffect(() => {
async function getStatuses() { async function getStatuses() {
const data = await getData() const data = await getData()
data && setStatuses(data) data && setStatuses(data)
console.log('statuses', statuses) // console.log('statuses', statuses)
// console.log('statuses?[1].aquarius.status', statuses[1].aquarius.status)
} }
getStatuses() getStatuses()
}, []) }, [])
@ -25,54 +25,56 @@ export default function HomePage(): ReactElement {
<meta name="description" content="Generated by create next app" /> <meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
</Head> </Head>
<main className={styles.main}> <main className={styles.main}>
<h1 className={styles.title}>Ocean Status</h1> <h1 className={styles.title}>Ocean Status</h1>
<p className={styles.description}> <p className={styles.description}>
Current Status of Ocean Components{' '} Current Status of Ocean Components{' '}
</p> </p>
<div className={styles.grid}> <div className={styles.grid}>
<div className={styles.card}> {statuses && (
<h2>Aquarius</h2> <>
<p>UP</p> <div className={styles.card}>
</div> <h2>Aquarius</h2>
<p>{statuses[network].aquarius.status}</p>
</div>
<div className={styles.card}>
<h2>Provider</h2>
<p>{statuses[network].provider.status}</p>
</div>
<div className={styles.card}> <div className={styles.card}>
<h2>Provider</h2> <h2>Subgraph</h2>
<p>UP</p> <p>{statuses[network].subgraph.status}</p>
</div> </div>
<div className={styles.card}> <div className={styles.card}>
<h2>Subgraph</h2> <h2>Market</h2>
<p>UP</p> <p>{statuses[network].market}</p>
</div> </div>
<div className={styles.card}>
<div className={styles.card}> <h2>Port</h2>
<h2>Market</h2> <p>{statuses[network].port}</p>
<p>UP</p> </div>
</div> <div className={styles.card}>
<div className={styles.card}> <h2>Data Farming</h2>
<h2>Port</h2> <p>{statuses[network].dataFarming}</p>
<p>UP</p> </div>
</div> <div className={styles.card}>
<div className={styles.card}> <h2>Operator Service</h2>
<h2>Data Farming</h2> <p>{statuses[network].operator.status}</p>
<p>UP</p> </div>
</div> {statuses[network].faucet.status && (
<div className={styles.card}> <div className={styles.card}>
<h2>Operator Service</h2> <h2>Faucet</h2>
<p>UP</p> <p>{statuses[network].faucet.status}</p>
</div> </div>
<div className={styles.card}> )}
<h2>Faucet</h2> <div className={styles.card}>
<p>UP</p> <h2>DAO Grants</h2>
</div> <p>{statuses[network].daoGrants}</p>
<div className={styles.card}> </div>
<h2>DAO Grants</h2> </>
<p>UP</p> )}
</div>
</div> </div>
</main> </main>

View File

@ -51,4 +51,3 @@
"exclude": ["node_modules", ".next", "*.js"], "exclude": ["node_modules", ".next", "*.js"],
"include": ["./src/**/*", "./tests/**/*", "./next-env.d.ts", "./content/**/*"] "include": ["./src/**/*", "./tests/**/*", "./next-env.d.ts", "./content/**/*"]
} }