2016-11-10 14:26:24 +01:00
|
|
|
import React, { PropTypes } from 'react';
|
2016-12-12 13:48:14 +01:00
|
|
|
import { ProgressBar } from 'react-mdl';
|
2016-11-10 14:26:24 +01:00
|
|
|
import StrategiesList from './strategies-list';
|
|
|
|
import AddStrategy from './strategies-add';
|
2016-12-10 13:45:49 +01:00
|
|
|
import { HeaderTitle } from '../../common';
|
2016-11-10 14:26:24 +01:00
|
|
|
|
|
|
|
class StrategiesSection extends React.Component {
|
2017-07-10 23:38:44 +02:00
|
|
|
static propTypes = {
|
|
|
|
strategies: PropTypes.array.isRequired,
|
|
|
|
addStrategy: PropTypes.func.isRequired,
|
|
|
|
removeStrategy: PropTypes.func.isRequired,
|
|
|
|
updateStrategy: PropTypes.func.isRequired,
|
|
|
|
fetchStrategies: PropTypes.func.isRequired,
|
2016-11-10 14:26:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
componentWillMount () {
|
|
|
|
this.props.fetchStrategies();
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
if (!this.props.strategies || this.props.strategies.length === 0) {
|
2016-12-12 13:48:14 +01:00
|
|
|
return <ProgressBar indeterminate />;
|
2016-11-10 14:26:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
2016-12-10 13:45:49 +01:00
|
|
|
<HeaderTitle title="Activation strategies" actions={<AddStrategy {...this.props} />} />
|
2016-11-15 23:14:30 +01:00
|
|
|
<StrategiesList {...this.props} />
|
2016-11-10 14:26:24 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default StrategiesSection;
|