mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-15 17:50:48 +02:00
pick up name from hash query when no input data
This commit is contained in:
parent
83a71902e9
commit
53909f9ca0
@ -5,7 +5,16 @@ import { createMapper, createActions } from '../input-helpers';
|
|||||||
import FormComponent from './form';
|
import FormComponent from './form';
|
||||||
|
|
||||||
const ID = 'add-feature-toggle';
|
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) => {
|
const prepare = (methods, dispatch) => {
|
||||||
methods.onSubmit = (input) => (
|
methods.onSubmit = (input) => (
|
||||||
(e) => {
|
(e) => {
|
||||||
|
@ -11,9 +11,6 @@ const prepare = (methods, dispatch) => {
|
|||||||
methods.onSubmit = (input) => (
|
methods.onSubmit = (input) => (
|
||||||
(e) => {
|
(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// clean
|
// clean
|
||||||
const parameters = input.parameters
|
const parameters = input.parameters
|
||||||
.filter((name) => !!name)
|
.filter((name) => !!name)
|
||||||
@ -56,4 +53,13 @@ const actions = createActions({
|
|||||||
prepare,
|
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);
|
||||||
|
@ -20,7 +20,7 @@ class StrategiesListComponent extends Component {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<HeaderTitle title="Strategies"
|
<HeaderTitle title="Strategies"
|
||||||
actions={<IconButton mini raised name="add" onClick={() => this.context.router.push('/strategies/create')} title="Add new strategy" />} />
|
actions={<IconButton raised name="add" onClick={() => this.context.router.push('/strategies/create')} title="Add new strategy" />} />
|
||||||
<List>
|
<List>
|
||||||
{strategies.length > 0 ? strategies.map((strategy, i) => {
|
{strategies.length > 0 ? strategies.map((strategy, i) => {
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user