diff --git a/src/v1/app/credExplorer/pagerankTable.js b/src/v1/app/credExplorer/pagerankTable.js index ba0344a..624bd71 100644 --- a/src/v1/app/credExplorer/pagerankTable.js +++ b/src/v1/app/credExplorer/pagerankTable.js @@ -111,21 +111,16 @@ export class PagerankTable extends React.Component { throw new Error("Impossible."); } const {graph, pagerankResult} = this.props; - const nodesByScore = graph + const addresses = graph .nodes() - .slice() + .map((node) => node.address) .filter( - (n) => + (address) => this.state.topLevelFilter - ? n.address.pluginName === this.state.topLevelFilter.pluginName && - n.address.type === this.state.topLevelFilter.type + ? address.pluginName === this.state.topLevelFilter.pluginName && + address.type === this.state.topLevelFilter.type : true - ) - .sort((a, b) => { - const x = pagerankResult.get(a.address).probability; - const y = pagerankResult.get(b.address).probability; - return y - x; - }); + ); return ( @@ -136,15 +131,12 @@ export class PagerankTable extends React.Component { - {nodesByScore.map((node) => ( - - ))} +
); @@ -200,16 +192,37 @@ class RecursiveTable extends React.Component { graph.neighborhood(address).forEach(({neighbor}) => { neighborMap.add({address: neighbor}); }); - return neighborMap - .getAll() + return ( + address)} + graph={graph} + pagerankResult={pagerankResult} + depth={depth + 1} + /> + ); + } +} + +type RecursiveTablesProps = {| + +addresses: $ReadOnlyArray
, + +graph: Graph, + +pagerankResult: PagerankResult, + +depth: number, +|}; + +class RecursiveTables extends React.Component { + render() { + const {addresses, graph, pagerankResult, depth} = this.props; + return addresses + .slice() .sort((a, b) => { - const x = pagerankResult.get(a.address).probability; - const y = pagerankResult.get(b.address).probability; + const x = pagerankResult.get(a).probability; + const y = pagerankResult.get(b).probability; return y - x; }) - .map(({address}) => ( + .map((address) => (