mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-18 00:19:49 +01:00
fix(feature): get rid of the regression, create feature can have a name
This commit is contained in:
parent
ae252a7ad3
commit
70e5d49a38
@ -5,6 +5,14 @@ import StrategiesSection from './strategies-section-container';
|
|||||||
|
|
||||||
import { FormButtons } from '../../common';
|
import { FormButtons } from '../../common';
|
||||||
|
|
||||||
|
const trim = value => {
|
||||||
|
if (value && value.trim) {
|
||||||
|
return value.trim();
|
||||||
|
} else {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class AddFeatureToggleComponent extends Component {
|
class AddFeatureToggleComponent extends Component {
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
// TODO unwind this stuff
|
// TODO unwind this stuff
|
||||||
@ -17,6 +25,7 @@ class AddFeatureToggleComponent extends Component {
|
|||||||
const {
|
const {
|
||||||
input,
|
input,
|
||||||
setValue,
|
setValue,
|
||||||
|
validateName,
|
||||||
addStrategy,
|
addStrategy,
|
||||||
removeStrategy,
|
removeStrategy,
|
||||||
updateStrategy,
|
updateStrategy,
|
||||||
@ -26,12 +35,30 @@ class AddFeatureToggleComponent extends Component {
|
|||||||
editmode = false,
|
editmode = false,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const { description, enabled } = input;
|
const {
|
||||||
|
name, // eslint-disable-line
|
||||||
|
nameError,
|
||||||
|
description,
|
||||||
|
enabled,
|
||||||
|
} = input;
|
||||||
const configuredStrategies = input.strategies || [];
|
const configuredStrategies = input.strategies || [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={onSubmit(input)}>
|
<form onSubmit={onSubmit(input)}>
|
||||||
<section style={{ padding: '16px' }}>
|
<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
|
<Textfield
|
||||||
floatingLabel
|
floatingLabel
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
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 { hashHistory, Link } from 'react-router';
|
||||||
|
|
||||||
import HistoryComponent from '../history/history-list-toggle-container';
|
import HistoryComponent from '../history/history-list-toggle-container';
|
||||||
|
Loading…
Reference in New Issue
Block a user