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

fix(feature): get rid of the regression, create feature can have a name

This commit is contained in:
Corinne Krych 2018-02-12 09:23:50 +01:00
parent ae252a7ad3
commit 70e5d49a38
2 changed files with 29 additions and 2 deletions

View File

@ -5,6 +5,14 @@ import StrategiesSection from './strategies-section-container';
import { FormButtons } from '../../common';
const trim = value => {
if (value && value.trim) {
return value.trim();
} else {
return value;
}
};
class AddFeatureToggleComponent extends Component {
componentWillMount() {
// TODO unwind this stuff
@ -17,6 +25,7 @@ class AddFeatureToggleComponent extends Component {
const {
input,
setValue,
validateName,
addStrategy,
removeStrategy,
updateStrategy,
@ -26,12 +35,30 @@ class AddFeatureToggleComponent extends Component {
editmode = false,
} = this.props;
const { description, enabled } = input;
const {
name, // eslint-disable-line
nameError,
description,
enabled,
} = input;
const configuredStrategies = input.strategies || [];
return (
<form onSubmit={onSubmit(input)}>
<section style={{ padding: '16px' }}>
{!editmode && (
<Textfield
floatingLabel
label="Name"
name="name"
disabled={editmode}
required
value={name}
error={nameError}
onBlur={v => validateName(v.target.value)}
onChange={v => setValue('name', trim(v.target.value))}
/>
)}
<Textfield
floatingLabel
style={{ width: '100%' }}

View File

@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Tabs, Tab, ProgressBar, Button, Card, CardTitle, CardText, CardActions, Switch } from 'react-mdl';
import { Tabs, Tab, ProgressBar, Button, Card, CardTitle, CardActions, Switch } from 'react-mdl';
import { hashHistory, Link } from 'react-router';
import HistoryComponent from '../history/history-list-toggle-container';