mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix: trimming strategy parameters (#2044)
This commit is contained in:
parent
18fc5eebd2
commit
03ddb0ad74
@ -38,6 +38,10 @@ export const StrategyParameter = ({
|
||||
updateParameter(name, event.target.value);
|
||||
};
|
||||
|
||||
const onChangeString = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
updateParameter(name, parseParameterString(event.target.value));
|
||||
};
|
||||
|
||||
const onChangePercentage = (event: Event, next: number | number[]) => {
|
||||
updateParameter(name, next.toString());
|
||||
};
|
||||
@ -46,6 +50,10 @@ export const StrategyParameter = ({
|
||||
updateParameter(name, String(checked));
|
||||
};
|
||||
|
||||
const onSetListConfig = (field: string, value: string) => {
|
||||
updateParameter(field, parseParameterStrings(value).join(','));
|
||||
};
|
||||
|
||||
if (type === 'percentage') {
|
||||
return (
|
||||
<div>
|
||||
@ -69,7 +77,7 @@ export const StrategyParameter = ({
|
||||
name={name}
|
||||
list={parseParameterStrings(parameters[name])}
|
||||
disabled={!editable}
|
||||
setConfig={updateParameter}
|
||||
setConfig={onSetListConfig}
|
||||
errors={errors}
|
||||
/>
|
||||
<InputCaption text={description} />
|
||||
@ -131,7 +139,7 @@ export const StrategyParameter = ({
|
||||
helperText={error}
|
||||
name={name}
|
||||
label={label}
|
||||
onChange={onChange}
|
||||
onChange={onChangeString}
|
||||
value={parseParameterString(parameters[name])}
|
||||
/>
|
||||
<InputCaption text={description} />
|
||||
|
Loading…
Reference in New Issue
Block a user