import React, { PropTypes } from 'react'; import Feature from './feature-list-item-component'; import { Link } from 'react-router'; import { Icon, FABButton, Textfield, Menu, MenuItem, Card, CardActions, List } from 'react-mdl'; import { MenuItemWithIcon, DropdownButton, styles as commonStyles } from '../common'; import styles from './feature.scss'; export default class FeatureListComponent extends React.PureComponent { static propTypes = { features: PropTypes.array.isRequired, featureMetrics: PropTypes.object.isRequired, fetchFeatureToggles: PropTypes.func.isRequired, fetchFeatureMetrics: PropTypes.func.isRequired, updateSetting: PropTypes.func.isRequired, settings: React.PropTypes.object, } static contextTypes = { router: React.PropTypes.object, } componentDidMount () { this.props.fetchFeatureToggles(); this.props.fetchFeatureMetrics(); this.timer = setInterval(() => { this.props.fetchFeatureMetrics(); }, 5000); } componentWillUnmount () { clearInterval(this.timer); } toggleMetrics () { this.props.updateSetting('showLastHour', !this.props.settings.showLastHour); } setFilter (v) { this.props.updateSetting('filter', typeof v === 'string' ? v : ''); } setSort (v) { this.props.updateSetting('sort', typeof v === 'string' ? v.trim() : ''); } render () { const { features, toggleFeature, featureMetrics, settings } = this.props; return (
{ this.setFilter(e.target.value); }} label="Search" style={{ width: '100%' }} />
this.toggleMetrics()} style={{ width: '168px' }}> this.setSort(e.target.getAttribute('data-target'))} style={{ width: '168px' }}> Name Enabled Created Strategies Metrics
{features.map((feature, i) => () )}
); } }