mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-11 00:08:30 +01:00
parent
2318710c68
commit
9fb0db1912
@ -4,6 +4,14 @@ import Button from 'react-toolbox/lib/button';
|
|||||||
import Switch from 'react-toolbox/lib/switch';
|
import Switch from 'react-toolbox/lib/switch';
|
||||||
import StrategiesSection from './strategies-section-container';
|
import StrategiesSection from './strategies-section-container';
|
||||||
|
|
||||||
|
const trim = (value) => {
|
||||||
|
if (value && value.trim) {
|
||||||
|
return value.trim();
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class AddFeatureToggleComponent extends Component {
|
class AddFeatureToggleComponent extends Component {
|
||||||
|
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
@ -46,7 +54,7 @@ class AddFeatureToggleComponent extends Component {
|
|||||||
value={name}
|
value={name}
|
||||||
error={nameError}
|
error={nameError}
|
||||||
onBlur={(v) => validateName(v)}
|
onBlur={(v) => validateName(v)}
|
||||||
onChange={(v) => setValue('name', v)} />
|
onChange={(v) => setValue('name', trim(v))} />
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
multiline label="Description"
|
multiline label="Description"
|
||||||
|
@ -3,6 +3,14 @@ import React, { PropTypes } from 'react';
|
|||||||
import Input from 'react-toolbox/lib/input';
|
import Input from 'react-toolbox/lib/input';
|
||||||
import Button from 'react-toolbox/lib/button';
|
import Button from 'react-toolbox/lib/button';
|
||||||
|
|
||||||
|
const trim = (value) => {
|
||||||
|
if (value && value.trim) {
|
||||||
|
return value.trim();
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function gerArrayWithEntries (num) {
|
function gerArrayWithEntries (num) {
|
||||||
return Array.from(Array(num));
|
return Array.from(Array(num));
|
||||||
}
|
}
|
||||||
@ -33,7 +41,7 @@ const AddStrategy = ({
|
|||||||
<Input type="text" label="Strategy name"
|
<Input type="text" label="Strategy name"
|
||||||
name="name" required
|
name="name" required
|
||||||
pattern="^[0-9a-zA-Z\.\-]+$"
|
pattern="^[0-9a-zA-Z\.\-]+$"
|
||||||
onChange={(value) => setValue('name', value)}
|
onChange={(value) => setValue('name', trim(value))}
|
||||||
value={input.name}
|
value={input.name}
|
||||||
/>
|
/>
|
||||||
<Input type="text" multiline label="Description"
|
<Input type="text" multiline label="Description"
|
||||||
|
Loading…
Reference in New Issue
Block a user