mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-05 11:11:13 +00:00
- 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
50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
const React = require('react');
|
|
const _ = require('lodash');
|
|
|
|
const AppActions = require('../actions/app-actions');
|
|
const AppStore = require('../stores/app-store');
|
|
|
|
const Topologies = React.createClass({
|
|
|
|
onTopologyClick: function(ev) {
|
|
ev.preventDefault();
|
|
AppActions.clickTopology(ev.currentTarget.getAttribute('rel'));
|
|
},
|
|
|
|
renderTopology: function(topology) {
|
|
const isActive = topology.name === this.props.currentTopology.name;
|
|
const className = isActive ? 'topologies-item topologies-item-active' : 'topologies-item';
|
|
const topologyId = AppStore.getTopologyIdForUrl(topology.url);
|
|
const 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() {
|
|
const 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;
|