mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-04 13:48:56 +02:00
fix: list parameters should be trimmed
see https://github.com/Unleash/unleash/issues/629
This commit is contained in:
parent
96bcee8d2b
commit
ece95f87be
@ -3,7 +3,13 @@
|
|||||||
exports[`renders correctly when disabled 1`] = `
|
exports[`renders correctly when disabled 1`] = `
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
featureName
|
<i>
|
||||||
|
Please specify the list of
|
||||||
|
<code>
|
||||||
|
featureName
|
||||||
|
</code>
|
||||||
|
:
|
||||||
|
</i>
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div
|
||||||
style={
|
style={
|
||||||
@ -39,7 +45,13 @@ exports[`renders correctly when disabled 1`] = `
|
|||||||
exports[`renders strategy with empty list as param 1`] = `
|
exports[`renders strategy with empty list as param 1`] = `
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
featureName
|
<i>
|
||||||
|
Please specify the list of
|
||||||
|
<code>
|
||||||
|
featureName
|
||||||
|
</code>
|
||||||
|
:
|
||||||
|
</i>
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div
|
||||||
style={
|
style={
|
||||||
@ -58,7 +70,7 @@ exports[`renders strategy with empty list as param 1`] = `
|
|||||||
>
|
>
|
||||||
<react-mdl-Textfield
|
<react-mdl-Textfield
|
||||||
floatingLabel={true}
|
floatingLabel={true}
|
||||||
label="Add list entry"
|
label="Enter value (val1, val2)"
|
||||||
name="featureName_input"
|
name="featureName_input"
|
||||||
onBlur={[Function]}
|
onBlur={[Function]}
|
||||||
onFocus={[Function]}
|
onFocus={[Function]}
|
||||||
@ -88,7 +100,13 @@ exports[`renders strategy with empty list as param 1`] = `
|
|||||||
exports[`renders strategy with list as param 1`] = `
|
exports[`renders strategy with list as param 1`] = `
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
featureName
|
<i>
|
||||||
|
Please specify the list of
|
||||||
|
<code>
|
||||||
|
featureName
|
||||||
|
</code>
|
||||||
|
:
|
||||||
|
</i>
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div
|
||||||
style={
|
style={
|
||||||
@ -128,7 +146,7 @@ exports[`renders strategy with list as param 1`] = `
|
|||||||
>
|
>
|
||||||
<react-mdl-Textfield
|
<react-mdl-Textfield
|
||||||
floatingLabel={true}
|
floatingLabel={true}
|
||||||
label="Add list entry"
|
label="Enter value (val1, val2)"
|
||||||
name="featureName_input"
|
name="featureName_input"
|
||||||
onBlur={[Function]}
|
onBlur={[Function]}
|
||||||
onFocus={[Function]}
|
onFocus={[Function]}
|
||||||
|
@ -37,9 +37,10 @@ export default class InputList extends Component {
|
|||||||
|
|
||||||
const { name, list, setConfig } = this.props;
|
const { name, list, setConfig } = this.props;
|
||||||
if (this.textInput && this.textInput.inputRef && this.textInput.inputRef.value) {
|
if (this.textInput && this.textInput.inputRef && this.textInput.inputRef.value) {
|
||||||
list.push(this.textInput.inputRef.value);
|
const newValues = this.textInput.inputRef.value.split(/,\s*/);
|
||||||
|
const newList = list.concat(newValues).filter(a => a);
|
||||||
this.textInput.inputRef.value = '';
|
this.textInput.inputRef.value = '';
|
||||||
setConfig(name, list.join(','));
|
setConfig(name, newList.join(','));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -53,7 +54,11 @@ export default class InputList extends Component {
|
|||||||
const { name, list, disabled } = this.props;
|
const { name, list, disabled } = this.props;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>{name}</p>
|
<p>
|
||||||
|
<i>
|
||||||
|
Please specify the list of <code>{name}</code>:
|
||||||
|
</i>
|
||||||
|
</p>
|
||||||
|
|
||||||
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
||||||
{list.map((entryValue, index) => (
|
{list.map((entryValue, index) => (
|
||||||
@ -75,7 +80,7 @@ export default class InputList extends Component {
|
|||||||
name={`${name}_input`}
|
name={`${name}_input`}
|
||||||
style={{ width: '100%', flex: 1 }}
|
style={{ width: '100%', flex: 1 }}
|
||||||
floatingLabel
|
floatingLabel
|
||||||
label="Add list entry"
|
label="Enter value (val1, val2)"
|
||||||
onFocus={this.onFocus.bind(this)}
|
onFocus={this.onFocus.bind(this)}
|
||||||
onBlur={this.onBlur.bind(this)}
|
onBlur={this.onBlur.bind(this)}
|
||||||
ref={input => {
|
ref={input => {
|
||||||
|
Loading…
Reference in New Issue
Block a user