const React = require('react'); const _ = require('lodash'); const AppActions = require('../actions/app-actions'); const GROUPINGS = [{ id: 'none', iconClass: 'fa fa-th', needsTopology: false }, { id: 'grouped', iconClass: 'fa fa-th-large', needsTopology: 'grouped_url' }]; const Groupings = React.createClass({ onGroupingClick: function(ev) { ev.preventDefault(); AppActions.clickGrouping(ev.currentTarget.getAttribute('rel')); }, getGroupingsSupportedByTopology: function(topology) { return _.filter(GROUPINGS, _.partial(this.isGroupingSupportedByTopology, topology)); }, renderGrouping: function(grouping, activeGroupingId) { let className = 'groupings-item'; const isSupportedByTopology = this.isGroupingSupportedByTopology(this.props.currentTopology, grouping); if (grouping.id === activeGroupingId) { className += ' groupings-item-active'; } else if (!isSupportedByTopology) { className += ' groupings-item-disabled'; } else { className += ' groupings-item-default'; } return (