ensure insights doesn't break load
This commit is contained in:
parent
20de2d202b
commit
a211bd0d08
|
@ -2,11 +2,12 @@ import Cytoscape from 'cytoscape'
|
||||||
import dagre from 'cytoscape-dagre'
|
import dagre from 'cytoscape-dagre'
|
||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
import CytoscapeComponent from 'react-cytoscapejs'
|
import CytoscapeComponent from 'react-cytoscapejs'
|
||||||
import { uniq } from 'ramda'
|
import { uniq, isNil } from 'ramda'
|
||||||
import { toEther } from '../utils/conversions'
|
import { toEther } from '../utils/conversions'
|
||||||
import { getTokenLabel } from '../utils/currencies'
|
import { getTokenLabel } from '../utils/currencies'
|
||||||
import { FundingContext } from '../context'
|
import { FundingContext } from '../context'
|
||||||
|
|
||||||
|
|
||||||
Cytoscape.use(dagre)
|
Cytoscape.use(dagre)
|
||||||
const layout = { name: 'dagre' }
|
const layout = { name: 'dagre' }
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ const stylesheet = [
|
||||||
|
|
||||||
const getAuthorizations = events => events.filter(event => event.event === 'AuthorizePayment')
|
const getAuthorizations = events => events.filter(event => event.event === 'AuthorizePayment')
|
||||||
const createElements = (transfers, vaultEvents) => {
|
const createElements = (transfers, vaultEvents) => {
|
||||||
|
if (isNil(transfers) || isNil(vaultEvents)) return []
|
||||||
const nodes = []
|
const nodes = []
|
||||||
const edges = []
|
const edges = []
|
||||||
const authorizations = getAuthorizations(vaultEvents)
|
const authorizations = getAuthorizations(vaultEvents)
|
||||||
|
@ -76,7 +78,7 @@ const TransfersGraph = () => {
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<CytoscapeComponent
|
<CytoscapeComponent
|
||||||
elements={createElements(transfers, vaultEvents)}
|
elements={createElements(transfers, vaultEvents)}
|
||||||
style={ { width: '100%', height: '600px', fontSize: '14px' } }
|
style={ { width: '800px', height: '100%', fontSize: '14px' } }
|
||||||
stylesheet={stylesheet}
|
stylesheet={stylesheet}
|
||||||
layout={layout}
|
layout={layout}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue