1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-13 11:17:26 +02:00
unleash.unleash/frontend/src/component/feature/form/strategies-section.jsx
Ivar Conradi Østhus 6e657314c2 fix: rename use of legacy react lifecyle methods
replaced with "UNSAFE_*" methods. Needs to be fixed at some point.
2020-04-18 21:50:01 +02:00

42 lines
1.2 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 StrategiesSectionComponent extends React.Component {
static propTypes = {
strategies: PropTypes.array.isRequired,
featureToggleName: PropTypes.string,
addStrategy: PropTypes.func,
removeStrategy: PropTypes.func,
updateStrategy: PropTypes.func,
fetchStrategies: PropTypes.func,
};
// eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
this.props.fetchStrategies();
}
render() {
if (!this.props.strategies || this.props.strategies.length === 0) {
return <ProgressBar indeterminate />;
}
return (
<div style={{ padding: '10px 0' }}>
{this.props.addStrategy ? (
<HeaderTitle title="Activation strategies" actions={<AddStrategy {...this.props} />} />
) : (
<span />
)}
<StrategiesList {...this.props} />
</div>
);
}
}
export default StrategiesSectionComponent;