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

36 lines
1.0 KiB
React
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
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';
import { HeaderTitle } from '../../common';
2016-11-10 14:26:24 +01:00
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,
};
2016-11-10 14:26:24 +01:00
componentWillMount() {
2016-11-10 14:26:24 +01:00
this.props.fetchStrategies();
}
render() {
2016-11-10 14:26:24 +01:00
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>
2017-08-28 21:40:44 +02: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;