mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix(Features): Create/add feature toggle wants to change the current url.
This commit is contained in:
		
							parent
							
								
									59bcabe331
								
							
						
					
					
						commit
						b97480c01c
					
				| @ -16,7 +16,7 @@ const mapStateToProps = createMapper({ | |||||||
|         return { name }; |         return { name }; | ||||||
|     }, |     }, | ||||||
| }); | }); | ||||||
| const prepare = (methods, dispatch) => { | const prepare = (methods, dispatch, ownProps) => { | ||||||
|     methods.onSubmit = input => e => { |     methods.onSubmit = input => e => { | ||||||
|         e.preventDefault(); |         e.preventDefault(); | ||||||
| 
 | 
 | ||||||
| @ -30,13 +30,13 @@ const prepare = (methods, dispatch) => { | |||||||
| 
 | 
 | ||||||
|         createFeatureToggles(input)(dispatch) |         createFeatureToggles(input)(dispatch) | ||||||
|             .then(() => methods.clear()) |             .then(() => methods.clear()) | ||||||
|             .then(() => this.props.history.push(`/features/strategies/${input.name}`)); |             .then(() => ownProps.history.push(`/features/strategies/${input.name}`)); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     methods.onCancel = evt => { |     methods.onCancel = evt => { | ||||||
|         evt.preventDefault(); |         evt.preventDefault(); | ||||||
|         methods.clear(); |         methods.clear(); | ||||||
|         this.props.history.push('/features'); |         ownProps.history.push('/features'); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     methods.addStrategy = v => { |     methods.addStrategy = v => { | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ const mapStateToProps = createMapper({ | |||||||
|     }, |     }, | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| const prepare = (methods, dispatch) => { | const prepare = (methods, dispatch, ownProps) => { | ||||||
|     methods.onSubmit = (input, features) => e => { |     methods.onSubmit = (input, features) => e => { | ||||||
|         e.preventDefault(); |         e.preventDefault(); | ||||||
| 
 | 
 | ||||||
| @ -41,13 +41,13 @@ const prepare = (methods, dispatch) => { | |||||||
|         // TODO: should add error handling |         // TODO: should add error handling | ||||||
|         requestUpdateFeatureToggle(input)(dispatch) |         requestUpdateFeatureToggle(input)(dispatch) | ||||||
|             .then(() => methods.clear()) |             .then(() => methods.clear()) | ||||||
|             .then(() => this.props.history.push(`/features`)); |             .then(() => ownProps.history.push(`/features`)); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     methods.onCancel = evt => { |     methods.onCancel = evt => { | ||||||
|         evt.preventDefault(); |         evt.preventDefault(); | ||||||
|         methods.clear(); |         methods.clear(); | ||||||
|         this.props.history.push(`/features`); |         ownProps.history.push(`/features`); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     methods.addStrategy = v => { |     methods.addStrategy = v => { | ||||||
|  | |||||||
| @ -53,7 +53,9 @@ export default class ViewFeatureToggleComponent extends React.Component { | |||||||
|             return <HistoryComponent toggleName={featureToggleName} />; |             return <HistoryComponent toggleName={featureToggleName} />; | ||||||
|         } else if (TABS[activeTab] === TABS.strategies) { |         } else if (TABS[activeTab] === TABS.strategies) { | ||||||
|             if (this.isFeatureView) { |             if (this.isFeatureView) { | ||||||
|                 return <EditFeatureToggle featureToggle={featureToggle} features={features} />; |                 return ( | ||||||
|  |                     <EditFeatureToggle featureToggle={featureToggle} features={features} history={this.props.history} /> | ||||||
|  |                 ); | ||||||
|             } |             } | ||||||
|             return <ViewFeatureToggle featureToggle={featureToggle} />; |             return <ViewFeatureToggle featureToggle={featureToggle} />; | ||||||
|         } else { |         } else { | ||||||
|  | |||||||
| @ -1,6 +1,11 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import AddFeatureToggleForm from '../../component/feature/form/form-add-feature-container'; | import AddFeatureToggleForm from '../../component/feature/form/form-add-feature-container'; | ||||||
|  | import PropTypes from 'prop-types'; | ||||||
| 
 | 
 | ||||||
| const render = () => <AddFeatureToggleForm title="Create feature toggle" />; | const render = ({ history }) => <AddFeatureToggleForm title="Create feature toggle" history={history} />; | ||||||
|  | 
 | ||||||
|  | render.propTypes = { | ||||||
|  |     history: PropTypes.object.isRequired, | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
| export default render; | export default render; | ||||||
|  | |||||||
| @ -1,6 +1,11 @@ | |||||||
| import React from 'react'; | import React from 'react'; | ||||||
| import FeatureListContainer from './../../component/feature/list-container'; | import FeatureListContainer from './../../component/feature/list-container'; | ||||||
|  | import PropTypes from 'prop-types'; | ||||||
| 
 | 
 | ||||||
| const render = () => <FeatureListContainer />; | const render = ({ history }) => <FeatureListContainer history={history} />; | ||||||
|  | 
 | ||||||
|  | render.propTypes = { | ||||||
|  |     history: PropTypes.object.isRequired, | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
| export default render; | export default render; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user