mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-02 17:50:39 +00:00
* new button in footer * when clicked, forces a relayout that could help with degraded graphs * sets a store flag that will be unset on next nodes delta update * fixes #863
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
|
|
import NodesChart from '../charts/nodes-chart';
|
|
|
|
const navbarHeight = 160;
|
|
const marginTop = 0;
|
|
|
|
export default class Nodes extends React.Component {
|
|
constructor(props, context) {
|
|
super(props, context);
|
|
this.handleResize = this.handleResize.bind(this);
|
|
|
|
this.state = {
|
|
width: window.innerWidth,
|
|
height: window.innerHeight - navbarHeight - marginTop
|
|
};
|
|
}
|
|
|
|
componentDidMount() {
|
|
window.addEventListener('resize', this.handleResize);
|
|
}
|
|
|
|
componentWillUnmount() {
|
|
window.removeEventListener('resize', this.handleResize);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<NodesChart
|
|
highlightedEdgeIds={this.props.highlightedEdgeIds}
|
|
highlightedNodeIds={this.props.highlightedNodeIds}
|
|
selectedNodeId={this.props.selectedNodeId}
|
|
nodes={this.props.nodes}
|
|
width={this.state.width}
|
|
height={this.state.height}
|
|
forceRelayout={this.props.forceRelayout}
|
|
topologyId={this.props.topologyId}
|
|
detailsWidth={this.props.detailsWidth}
|
|
topMargin={this.props.topMargin}
|
|
/>
|
|
);
|
|
}
|
|
|
|
handleResize() {
|
|
this.setDimensions();
|
|
}
|
|
|
|
setDimensions() {
|
|
const width = window.innerWidth;
|
|
const height = window.innerHeight - navbarHeight - marginTop;
|
|
|
|
this.setState({height, width});
|
|
}
|
|
}
|