mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +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 };
|
||||
},
|
||||
});
|
||||
const prepare = (methods, dispatch) => {
|
||||
const prepare = (methods, dispatch, ownProps) => {
|
||||
methods.onSubmit = input => e => {
|
||||
e.preventDefault();
|
||||
|
||||
@ -30,13 +30,13 @@ const prepare = (methods, dispatch) => {
|
||||
|
||||
createFeatureToggles(input)(dispatch)
|
||||
.then(() => methods.clear())
|
||||
.then(() => this.props.history.push(`/features/strategies/${input.name}`));
|
||||
.then(() => ownProps.history.push(`/features/strategies/${input.name}`));
|
||||
};
|
||||
|
||||
methods.onCancel = evt => {
|
||||
evt.preventDefault();
|
||||
methods.clear();
|
||||
this.props.history.push('/features');
|
||||
ownProps.history.push('/features');
|
||||
};
|
||||
|
||||
methods.addStrategy = v => {
|
||||
|
@ -24,7 +24,7 @@ const mapStateToProps = createMapper({
|
||||
},
|
||||
});
|
||||
|
||||
const prepare = (methods, dispatch) => {
|
||||
const prepare = (methods, dispatch, ownProps) => {
|
||||
methods.onSubmit = (input, features) => e => {
|
||||
e.preventDefault();
|
||||
|
||||
@ -41,13 +41,13 @@ const prepare = (methods, dispatch) => {
|
||||
// TODO: should add error handling
|
||||
requestUpdateFeatureToggle(input)(dispatch)
|
||||
.then(() => methods.clear())
|
||||
.then(() => this.props.history.push(`/features`));
|
||||
.then(() => ownProps.history.push(`/features`));
|
||||
};
|
||||
|
||||
methods.onCancel = evt => {
|
||||
evt.preventDefault();
|
||||
methods.clear();
|
||||
this.props.history.push(`/features`);
|
||||
ownProps.history.push(`/features`);
|
||||
};
|
||||
|
||||
methods.addStrategy = v => {
|
||||
|
@ -53,7 +53,9 @@ export default class ViewFeatureToggleComponent extends React.Component {
|
||||
return <HistoryComponent toggleName={featureToggleName} />;
|
||||
} else if (TABS[activeTab] === TABS.strategies) {
|
||||
if (this.isFeatureView) {
|
||||
return <EditFeatureToggle featureToggle={featureToggle} features={features} />;
|
||||
return (
|
||||
<EditFeatureToggle featureToggle={featureToggle} features={features} history={this.props.history} />
|
||||
);
|
||||
}
|
||||
return <ViewFeatureToggle featureToggle={featureToggle} />;
|
||||
} else {
|
||||
|
@ -1,6 +1,11 @@
|
||||
import React from 'react';
|
||||
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;
|
||||
|
@ -1,6 +1,11 @@
|
||||
import React from 'react';
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user