blob: c22a5046d6546fa1e6f1d78548e5614c09e7a1df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
import React from 'react'
import './GraphInfoMenu.css'
import PathBreadCrumb from './PathBreadCrumb'
import _ from 'underscore'
import ReactBasicTable from 'react-basic-table'
var getRows = function (nodeProps) {
return _.map(nodeProps, path => {
return (
[
<span>{path.propertyName}</span>,
<span>{path.propertyValue}</span>
]
)
})
}
class GraphInfoMenu extends React.Component {
constructor (props) {
super(props)
this.basicTable = React.createRef()
}
// ReactBasicTable does not reset pagination after
// changing data, we need to do it manually
componentDidUpdate (prevProps) {
this.basicTable.current.setPage(1)
}
render () {
var paths = this.props.paths
var callback = this.props.pathCallback
var showPaths = _.isArray(paths) && !_.isEmpty(paths)
var breadcrumbs = _.map(paths, (path, i) => <PathBreadCrumb key={i} index={i} pathCallback={callback} path={path}/>)
return (
<div className="node-property-list">
<div className="fixed-height-container" style={{ display: showPaths ? 'block' : 'none' }}>
<p className='path-heading'>Paths</p>
{breadcrumbs}
</div>
<div className="kv-table datatable">
<ReactBasicTable ref={this.basicTable} pageSize={3} rows={getRows(this.props.nodeProperties)} columns={['Property Name', 'Value']} />
</div>
</div>
)
}
}
export default GraphInfoMenu
|