diff --git a/frontend/src/component/feature/form-add-container.jsx b/frontend/src/component/feature/form-add-container.jsx index de88d3acb2..2fe90c51d6 100644 --- a/frontend/src/component/feature/form-add-container.jsx +++ b/frontend/src/component/feature/form-add-container.jsx @@ -5,7 +5,16 @@ import { createMapper, createActions } from '../input-helpers'; import FormComponent from './form'; const ID = 'add-feature-toggle'; -const mapStateToProps = createMapper({ id: ID }); +const mapStateToProps = createMapper({ + id: ID, + getDefault () { + let name; + try { + [, name] = document.location.hash.match(/name=([a-z0-9-_]+)/i); + } catch (e) {} + return { name }; + }, +}); const prepare = (methods, dispatch) => { methods.onSubmit = (input) => ( (e) => { diff --git a/frontend/src/component/strategies/add-container.js b/frontend/src/component/strategies/add-container.js index b7e865413b..53cf00f46b 100644 --- a/frontend/src/component/strategies/add-container.js +++ b/frontend/src/component/strategies/add-container.js @@ -11,9 +11,6 @@ const prepare = (methods, dispatch) => { methods.onSubmit = (input) => ( (e) => { e.preventDefault(); - - - // clean const parameters = input.parameters .filter((name) => !!name) @@ -56,4 +53,13 @@ const actions = createActions({ prepare, }); -export default connect(createMapper({ id: ID }), actions)(AddStrategy); +export default connect(createMapper({ + id: ID, + getDefault () { + let name; + try { + [, name] = document.location.hash.match(/name=([a-z0-9-_]+)/i); + } catch (e) {} + return { name }; + }, +}), actions)(AddStrategy); diff --git a/frontend/src/component/strategies/list-component.jsx b/frontend/src/component/strategies/list-component.jsx index 41aa438caf..e6eaa700a7 100644 --- a/frontend/src/component/strategies/list-component.jsx +++ b/frontend/src/component/strategies/list-component.jsx @@ -20,7 +20,7 @@ class StrategiesListComponent extends Component { return (