1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-11 00:08:30 +01:00

Trim name inputs for feature toggle and strategy.

closes #12
This commit is contained in:
ivaosthu 2016-12-03 14:29:33 +01:00
parent 2318710c68
commit 9fb0db1912
2 changed files with 18 additions and 2 deletions

View File

@ -4,6 +4,14 @@ import Button from 'react-toolbox/lib/button';
import Switch from 'react-toolbox/lib/switch';
import StrategiesSection from './strategies-section-container';
const trim = (value) => {
if (value && value.trim) {
return value.trim();
} else {
return value;
}
};
class AddFeatureToggleComponent extends Component {
componentWillMount () {
@ -46,7 +54,7 @@ class AddFeatureToggleComponent extends Component {
value={name}
error={nameError}
onBlur={(v) => validateName(v)}
onChange={(v) => setValue('name', v)} />
onChange={(v) => setValue('name', trim(v))} />
<Input
type="text"
multiline label="Description"

View File

@ -3,6 +3,14 @@ import React, { PropTypes } from 'react';
import Input from 'react-toolbox/lib/input';
import Button from 'react-toolbox/lib/button';
const trim = (value) => {
if (value && value.trim) {
return value.trim();
} else {
return value;
}
};
function gerArrayWithEntries (num) {
return Array.from(Array(num));
}
@ -33,7 +41,7 @@ const AddStrategy = ({
<Input type="text" label="Strategy name"
name="name" required
pattern="^[0-9a-zA-Z\.\-]+$"
onChange={(value) => setValue('name', value)}
onChange={(value) => setValue('name', trim(value))}
value={input.name}
/>
<Input type="text" multiline label="Description"