mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 10:41:14 +00:00
- Change scrolling behaviour to lock headers in place
- Enable filtering (hitting enter in the search bar) in grid-mode
- Little more top-margin for k8s (can have 3 topos) + taller rows.
- Trying out rank-color + node.relatives in the grid-mode
- First pass at selecting rows.
- Needs a bit more a fiddle, colors + click areas
- Store grid sort direction (asc/desc) in url state
- Simplify node selection to one method. (over-ride existing card)
- Remove clicking on name directly (links) to overlay new cards for now.
- Playing w/ grid-mode-toggle icons and labels
- Improves rendering in ff, change of shortcut keys for grid-mode-toggle
- Playing w/ clearer selection colors for grid-mode
- Slight change to selection-ui
- Fixes showNodeInTopology button visibility on the details-panel
- Was using an old heuristic. Table-mode allows you to open child cards
before the parent.
- Make it clear what the default sort is in tables
- E.g. always show a sorting caret
- Sort grid-mode columns, first meta then metrics
- dancing-nodes rememdy #1: pause updates onRowHover
- Splits relatives out into their own columns
- Take into account scrollbar width for grid-mode col header position
- Tooltips on table column headers
- grid-mode: fixes first column headers (proc/container/c-by-image)
- Disable pause-on-hover, too aggresive
- reduce label column width a bit (33pc -> 25pc) for big tables
- Filter grid-mode onSearchChange
- Rather than previous behaviour of waiting for an <enter>
- Show label_minor on pseudo nodes, that might not have much other info
- grid-mode: further reduce width of id column.
- Fixes go tests, properly moves parents into node-summary
- Fixes sorting of string columns w/ missing fields.
- E.g. uptime. Where -1e-10 > '3days' doesn't work.
142 lines
4.3 KiB
JavaScript
142 lines
4.3 KiB
JavaScript
import React from 'react';
|
|
import { connect } from 'react-redux';
|
|
|
|
import NodesChart from '../charts/nodes-chart';
|
|
import NodesGrid from '../charts/nodes-grid';
|
|
import NodesError from '../charts/nodes-error';
|
|
import { DelayedShow } from '../utils/delayed-show';
|
|
import { Loading, getNodeType } from './loading';
|
|
import { isTopologyEmpty } from '../utils/topology-utils';
|
|
import { CANVAS_MARGINS } from '../constants/styles';
|
|
|
|
const navbarHeight = 194;
|
|
const marginTop = 0;
|
|
|
|
|
|
/**
|
|
* dynamic coords precision based on topology size
|
|
*/
|
|
function getLayoutPrecision(nodesCount) {
|
|
let precision;
|
|
if (nodesCount >= 50) {
|
|
precision = 0;
|
|
} else if (nodesCount > 20) {
|
|
precision = 1;
|
|
} else if (nodesCount > 10) {
|
|
precision = 2;
|
|
} else {
|
|
precision = 3;
|
|
}
|
|
|
|
return precision;
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
renderEmptyTopologyError(show) {
|
|
return (
|
|
<NodesError faIconClass="fa-circle-thin" hidden={!show}>
|
|
<div className="heading">Nothing to show. This can have any of these reasons:</div>
|
|
<ul>
|
|
<li>We haven't received any reports from probes recently.
|
|
Are the probes properly configured?</li>
|
|
<li>There are nodes, but they're currently hidden. Check the view options
|
|
in the bottom-left if they allow for showing hidden nodes.</li>
|
|
<li>Containers view only: you're not running Docker,
|
|
or you don't have any containers.</li>
|
|
</ul>
|
|
</NodesError>
|
|
);
|
|
}
|
|
|
|
render() {
|
|
const { nodes, topologyEmpty, selectedNodeId, gridMode, gridSortBy,
|
|
topologiesLoaded, nodesLoaded, topologies, topology,
|
|
gridSortedDesc, searchNodeMatches, searchQuery } = this.props;
|
|
const layoutPrecision = getLayoutPrecision(nodes.size);
|
|
|
|
return (
|
|
<div className="nodes-wrapper">
|
|
<DelayedShow delay={1000} show={!topologiesLoaded || (topologiesLoaded && !nodesLoaded)}>
|
|
<Loading itemType="topologies" show={!topologiesLoaded} />
|
|
<Loading
|
|
itemType={getNodeType(topology, topologies)}
|
|
show={topologiesLoaded && !nodesLoaded} />
|
|
</DelayedShow>
|
|
{this.renderEmptyTopologyError(topologiesLoaded && nodesLoaded && topologyEmpty)}
|
|
{gridMode ?
|
|
<NodesGrid {...this.state}
|
|
nodeSize="24"
|
|
nodes={nodes}
|
|
topology={this.props.currentTopology}
|
|
topologyId={this.props.currentTopologyId}
|
|
margins={CANVAS_MARGINS}
|
|
layoutPrecision={layoutPrecision}
|
|
selectedNodeId={selectedNodeId}
|
|
gridSortBy={gridSortBy}
|
|
gridSortedDesc={gridSortedDesc}
|
|
searchNodeMatches={searchNodeMatches}
|
|
searchQuery={searchQuery}
|
|
/> :
|
|
<NodesChart {...this.state}
|
|
nodes={nodes}
|
|
margins={CANVAS_MARGINS}
|
|
layoutPrecision={layoutPrecision}
|
|
/>}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
handleResize() {
|
|
this.setDimensions();
|
|
}
|
|
|
|
setDimensions() {
|
|
const width = window.innerWidth;
|
|
const height = window.innerHeight - navbarHeight - marginTop;
|
|
|
|
this.setState({height, width});
|
|
}
|
|
}
|
|
|
|
function mapStateToProps(state) {
|
|
return {
|
|
gridMode: state.get('gridMode'),
|
|
nodesLoaded: state.get('nodesLoaded'),
|
|
topologies: state.get('topologies'),
|
|
topologiesLoaded: state.get('topologiesLoaded'),
|
|
gridSortBy: state.get('gridSortBy'),
|
|
gridSortedDesc: state.get('gridSortedDesc'),
|
|
nodes: state.get('nodes').filter(node => !node.get('filtered')),
|
|
currentTopology: state.get('currentTopology'),
|
|
currentTopologyId: state.get('currentTopologyId'),
|
|
topologyEmpty: isTopologyEmpty(state),
|
|
topology: state.get('currentTopology'),
|
|
highlightedNodeIds: state.get('highlightedNodeIds')
|
|
searchNodeMatches: state.getIn(['searchNodeMatches', state.get('currentTopologyId')]),
|
|
searchQuery: state.get('searchQuery'),
|
|
selectedNodeId: state.get('selectedNodeId')
|
|
};
|
|
}
|
|
|
|
export default connect(
|
|
mapStateToProps
|
|
)(Nodes);
|