pond: display head info

This commit is contained in:
Łukasz Magiera 2019-07-25 00:14:09 +02:00
parent cc3f8a13ce
commit 5b6755f04a
2 changed files with 14 additions and 1 deletions

View File

@ -9,4 +9,5 @@
margin-bottom: 5px;
padding: 5px;
user-select: text;
font-family: monospace;
}

View File

@ -59,15 +59,27 @@ class FullNode extends React.Component {
const peers = await this.state.client.call("Filecoin.NetPeers", [])
this.setState(() => ({peers: peers.length}))
const tipset = await this.state.client.call("Filecoin.ChainHead", [])
this.setState(() => ({tipset: tipset}))
}
render() {
let runtime = <div></div>
if (this.state.state === stateConnected) {
let chainInfo = <div></div>
if (this.state.tipset !== undefined) {
chainInfo = (
<div>Head: {this.state.tipset.Cids.map(c => c['/'].substr(-8))} H:{this.state.tipset.Height}</div>
)
}
runtime = (
<div>
<div>v{this.state.version.Version}, {this.state.id.substr(-8)}, {this.state.peers} peers</div>
<div>{this.props.node.Repo}</div>
<div>Repo: LOTUS_PATH={this.props.node.Repo}</div>
{chainInfo}
</div>
)
}