mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
feat(feature-create): Default strategy is actually default
Closes https://github.com/Unleash/unleash/issues/204
This commit is contained in:
parent
9338635337
commit
c0ed3b4007
@ -3,6 +3,8 @@ import { createFeatureToggles, validateName } from './../../../store/feature-act
|
||||
import { createMapper, createActions } from './../../input-helpers';
|
||||
import AddFeatureComponent from './form-add-feature-component';
|
||||
|
||||
const defaultStrategy = { name: 'default' };
|
||||
|
||||
const ID = 'add-feature-toggle';
|
||||
const mapStateToProps = createMapper({
|
||||
id: ID,
|
||||
@ -26,6 +28,8 @@ const prepare = (methods, dispatch, ownProps) => {
|
||||
input.strategies.forEach(s => {
|
||||
delete s.id;
|
||||
});
|
||||
} else {
|
||||
input.strategies = [defaultStrategy];
|
||||
}
|
||||
|
||||
createFeatureToggles(input)(dispatch)
|
||||
|
@ -18,7 +18,11 @@ class StrategiesList extends React.Component {
|
||||
const { strategies, configuredStrategies, moveStrategy, removeStrategy, updateStrategy } = this.props;
|
||||
|
||||
if (!configuredStrategies || configuredStrategies.length === 0) {
|
||||
return <i style={{ color: 'red' }}>No strategies added</i>;
|
||||
return (
|
||||
<p style={{ padding: '0 16px' }}>
|
||||
<i>No activation strategies selected.</i>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
const blocks = configuredStrategies.map((strategy, i) => (
|
||||
|
@ -8,9 +8,9 @@ import { HeaderTitle } from '../../common';
|
||||
class StrategiesSectionComponent extends React.Component {
|
||||
static propTypes = {
|
||||
strategies: PropTypes.array.isRequired,
|
||||
addStrategy: PropTypes.func,
|
||||
removeStrategy: PropTypes.func,
|
||||
updateStrategy: PropTypes.func,
|
||||
addStrategy: PropTypes.func.isRequired,
|
||||
removeStrategy: PropTypes.func.isRequired,
|
||||
updateStrategy: PropTypes.func.isRequired,
|
||||
fetchStrategies: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
@ -24,7 +24,7 @@ class StrategiesSectionComponent extends React.Component {
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div style={{ padding: '10px 0' }}>
|
||||
{this.props.addStrategy ? (
|
||||
<HeaderTitle title="Activation strategies" actions={<AddStrategy {...this.props} />} />
|
||||
) : (
|
||||
|
Loading…
Reference in New Issue
Block a user