diff --git a/lotuspond/front/src/NodeList.js b/lotuspond/front/src/NodeList.js index 3da7a84e7..d220c55ec 100644 --- a/lotuspond/front/src/NodeList.js +++ b/lotuspond/front/src/NodeList.js @@ -2,6 +2,8 @@ import React from 'react'; import FullNode from "./FullNode"; import ConnMgr from "./ConnMgr"; import Consensus from "./Consensus"; +import {Cristal} from "react-cristal"; +import StorageNode from "./StorageNode"; class NodeList extends React.Component { constructor(props) { @@ -22,22 +24,41 @@ class NodeList extends React.Component { this.getNodes() } + mountNode(node) { + if (!node.Storage) { + this.props.mountWindow((onClose) => + this.setState(prev => ({ + nodes: { + ...prev.nodes, + [node.ID]: {...node, conn: conn, peerid: id} + } + }))} + mountWindow={this.props.mountWindow}/>) + } else { + this.props.mountWindow((onClose) => + ) + } + } + async getNodes() { const nds = await this.props.client.call('Pond.Nodes') const nodes = nds.reduce((o, i) => {o[i.ID] = i; return o}, {}) console.log('nds', nodes) + + Object.keys(nodes).map(n => nodes[n]).forEach(n => this.mountNode(n)) + this.setState({existingLoaded: true, nodes: nodes}) } async spawnNode() { const node = await this.props.client.call('Pond.Spawn') console.log(node) - this.props.mountWindow((onClose) => - this.setState(prev => ({nodes: {...prev.nodes, [node.ID]: {...node, conn: conn, peerid: id}}}))} - mountWindow={this.props.mountWindow}/>) + this.mountNode(node) this.setState(state => ({nodes: {...state.nodes, [node.ID]: node}})) } @@ -62,17 +83,24 @@ class NodeList extends React.Component { } return ( -
+
+
+ {Object.keys(this.state.nodes).map(n => { + return
+ {n} +
+ })} +
{connMgr} {consensus}
-
+ ); } } diff --git a/lotuspond/front/src/StorageNode.js b/lotuspond/front/src/StorageNode.js index bb7a19ff5..103501978 100644 --- a/lotuspond/front/src/StorageNode.js +++ b/lotuspond/front/src/StorageNode.js @@ -5,7 +5,7 @@ class StorageNode extends React.Component { render() { return + initialPosition={{x: this.props.node.ID*30, y: this.props.node.ID * 30}}>
I'm a node