1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/component/feature/form/strategies-section.jsx
2017-08-28 21:40:44 +02:00

36 lines
1.0 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { ProgressBar } from 'react-mdl';
import StrategiesList from './strategies-list';
import AddStrategy from './strategies-add';
import { HeaderTitle } from '../../common';
class StrategiesSection extends React.Component {
static propTypes = {
strategies: PropTypes.array.isRequired,
addStrategy: PropTypes.func.isRequired,
removeStrategy: PropTypes.func.isRequired,
updateStrategy: PropTypes.func.isRequired,
fetchStrategies: PropTypes.func.isRequired,
};
componentWillMount() {
this.props.fetchStrategies();
}
render() {
if (!this.props.strategies || this.props.strategies.length === 0) {
return <ProgressBar indeterminate />;
}
return (
<div>
<HeaderTitle title="Activation strategies" actions={<AddStrategy {...this.props} />} />
<StrategiesList {...this.props} />
</div>
);
}
}
export default StrategiesSection;