Files
weave-scope/client/app/scripts/components/nodes.js
David Kaltschmidt 7d1ee40a2b Fixed lint errors in all js files
- Also added linter configuration, and make linter fail on error
- fixing ES6 errors and added ES6 transformer
- gulp target to try local build
- linted gulpfile
- cant hook into gulp lint yet, because gulp does currently not support
  ES6 which some rules demand, since gulp cant transpile itself, we have a
  chicken and egg problem.
- ES6 transpiler for test runner
- removed old linter config
- adapted editorconfig to reflect linter config
2015-05-28 15:07:13 +00:00

58 lines
1.2 KiB
JavaScript

const React = require('react');
const NodesChart = require('../charts/nodes-chart');
const AppActions = require('../actions/app-actions');
const navbarHeight = 160;
const marginTop = 0;
const Nodes = React.createClass({
getInitialState: function() {
return {
width: window.innerWidth,
height: window.innerHeight - navbarHeight - marginTop
};
},
componentDidMount: function() {
window.addEventListener('resize', this.handleResize);
},
componentWillUnmount: function() {
window.removeEventListener('resize', this.handleResize);
},
onNodeClick: function(ev) {
AppActions.clickNode(ev.currentTarget.id);
},
render: function() {
return (
<div id="nodes">
<NodesChart
onNodeClick={this.onNodeClick}
nodes={this.props.nodes}
width={this.state.width}
height={this.state.height}
context="view"
/>
</div>
);
},
handleResize: function() {
this.setDimensions();
},
setDimensions: function() {
this.setState({
height: window.innerHeight - navbarHeight - marginTop,
width: window.innerWidth
});
}
});
module.exports = Nodes;