Files
weave-scope/client/app/scripts/components/topologies.js
David Kaltschmidt 66d66a4d01 Fix grouping bar for topologies that don't support grouping
- fixes #61
- dont clear nodes cache if topo is the same
- combined stores that were interdependent
- dont show topology grouping menu if unsupported
- also harmonized some variable names
- removed old grouping switcher
- moved topo actions to app actions, removed search
- get correct topology url
- first JS test using Jest
- make tests run on circle using the build container.
- replaced jest test runner with karma/jasmine
- Use debian for UI build and test container.
- updated karma-browserify
2015-05-22 16:41:48 +00:00

52 lines
1.3 KiB
JavaScript

/** @jsx React.DOM */
var React = require('react');
var _ = require('lodash');
var AppActions = require('../actions/app-actions');
var AppStore = require('../stores/app-store');
var Topologies = React.createClass({
onTopologyClick: function(ev) {
ev.preventDefault();
AppActions.clickTopology(ev.currentTarget.getAttribute('rel'));
},
renderTopology: function(topology, active) {
var isActive = topology.name === this.props.currentTopology.name,
className = isActive ? "topologies-item topologies-item-active" : "topologies-item",
topologyId = AppStore.getTopologyIdForUrl(topology.url),
title = ['Topology: ' + topology.name,
'Nodes: ' + topology.stats.node_count,
'Connections: ' + topology.stats.node_count].join('\n');
return (
<div className={className} key={topologyId} rel={topologyId} onClick={this.onTopologyClick}>
<div title={title}>
<div className="topologies-item-label">
{topology.name}
</div>
</div>
</div>
);
},
render: function() {
var topologies = _.sortBy(this.props.topologies, function(topology) {
return topology.name;
});
return (
<div className="topologies">
{this.props.currentTopology && topologies.map(function(topology) {
return this.renderTopology(topology);
}, this)}
</div>
);
}
});
module.exports = Topologies;