mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +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 { createMapper, createActions } from './../../input-helpers'; | ||||||
| import AddFeatureComponent from './form-add-feature-component'; | import AddFeatureComponent from './form-add-feature-component'; | ||||||
| 
 | 
 | ||||||
|  | const defaultStrategy = { name: 'default' }; | ||||||
|  | 
 | ||||||
| const ID = 'add-feature-toggle'; | const ID = 'add-feature-toggle'; | ||||||
| const mapStateToProps = createMapper({ | const mapStateToProps = createMapper({ | ||||||
|     id: ID, |     id: ID, | ||||||
| @ -26,6 +28,8 @@ const prepare = (methods, dispatch, ownProps) => { | |||||||
|             input.strategies.forEach(s => { |             input.strategies.forEach(s => { | ||||||
|                 delete s.id; |                 delete s.id; | ||||||
|             }); |             }); | ||||||
|  |         } else { | ||||||
|  |             input.strategies = [defaultStrategy]; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         createFeatureToggles(input)(dispatch) |         createFeatureToggles(input)(dispatch) | ||||||
|  | |||||||
| @ -18,7 +18,11 @@ class StrategiesList extends React.Component { | |||||||
|         const { strategies, configuredStrategies, moveStrategy, removeStrategy, updateStrategy } = this.props; |         const { strategies, configuredStrategies, moveStrategy, removeStrategy, updateStrategy } = this.props; | ||||||
| 
 | 
 | ||||||
|         if (!configuredStrategies || configuredStrategies.length === 0) { |         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) => ( |         const blocks = configuredStrategies.map((strategy, i) => ( | ||||||
|  | |||||||
| @ -8,9 +8,9 @@ import { HeaderTitle } from '../../common'; | |||||||
| class StrategiesSectionComponent extends React.Component { | class StrategiesSectionComponent extends React.Component { | ||||||
|     static propTypes = { |     static propTypes = { | ||||||
|         strategies: PropTypes.array.isRequired, |         strategies: PropTypes.array.isRequired, | ||||||
|         addStrategy: PropTypes.func, |         addStrategy: PropTypes.func.isRequired, | ||||||
|         removeStrategy: PropTypes.func, |         removeStrategy: PropTypes.func.isRequired, | ||||||
|         updateStrategy: PropTypes.func, |         updateStrategy: PropTypes.func.isRequired, | ||||||
|         fetchStrategies: PropTypes.func.isRequired, |         fetchStrategies: PropTypes.func.isRequired, | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
| @ -24,7 +24,7 @@ class StrategiesSectionComponent extends React.Component { | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return ( |         return ( | ||||||
|             <div> |             <div style={{ padding: '10px 0' }}> | ||||||
|                 {this.props.addStrategy ? ( |                 {this.props.addStrategy ? ( | ||||||
|                     <HeaderTitle title="Activation strategies" actions={<AddStrategy {...this.props} />} /> |                     <HeaderTitle title="Activation strategies" actions={<AddStrategy {...this.props} />} /> | ||||||
|                 ) : ( |                 ) : ( | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user