diff --git a/frontend/src/component/feature/form/index.jsx b/frontend/src/component/feature/form/index.jsx index 1682ea1c79..37f73ab84b 100644 --- a/frontend/src/component/feature/form/index.jsx +++ b/frontend/src/component/feature/form/index.jsx @@ -74,7 +74,7 @@ class AddFeatureToggleComponent extends Component { onChange={() => { setValue('enabled', !enabled); }}>Enabled -
+
{ const parametersTemplate = {}; Object.keys(input).forEach(key => { if (key.startsWith(PARAM_PREFIX)) { - parametersTemplate[input[key]] = 'string'; + parametersTemplate[input[key]] = input[key.replace(PARAM_PREFIX, TYPE_PREFIX)] || 'string'; } }); input.parametersTemplate = parametersTemplate; diff --git a/frontend/src/component/strategies/add-strategy.jsx b/frontend/src/component/strategies/add-strategy.jsx index 576cfeb83e..c42848dbff 100644 --- a/frontend/src/component/strategies/add-strategy.jsx +++ b/frontend/src/component/strategies/add-strategy.jsx @@ -16,17 +16,29 @@ function gerArrayWithEntries (num) { return Array.from(Array(num)); } export const PARAM_PREFIX = 'param_'; +export const TYPE_PREFIX = 'type_'; const genParams = (input, num = 0, setValue) => (
{gerArrayWithEntries(num).map((v, i) => { const key = `${PARAM_PREFIX}${i + 1}`; + const typeKey = `${TYPE_PREFIX}${i + 1}`; return ( - setValue(key, target.value)} - value={input[key]} /> +
+ setValue(key, target.value)} + value={input[key]} /> + setValue(typeKey, target.value)} + value={input[typeKey]} /> + +
); })}
); @@ -63,10 +75,10 @@ const AddStrategy = ({
{genParams(input, input._params, setValue)} - { + { e.preventDefault(); incValue('_params'); - }}/> Add parameter + }}/> &nsbp;Add parameter