diff --git a/plugins/services/src/js/reducers/serviceForm/FormReducers/Constraints.js b/plugins/services/src/js/reducers/serviceForm/FormReducers/Constraints.js index 33400df1c5..c78fbfbdef 100644 --- a/plugins/services/src/js/reducers/serviceForm/FormReducers/Constraints.js +++ b/plugins/services/src/js/reducers/serviceForm/FormReducers/Constraints.js @@ -13,13 +13,22 @@ function processTransaction(state, { type, path, value }) { let newState = state.slice(); if (type === ADD_ITEM) { - newState.push({ fieldName: null, operator: null, value: null }); + let defaultValue = { fieldName: null, operator: null, value: null }; + + if (value != null && value.type != null) { + defaultValue = Object.assign({}, defaultValue, value); + } + + newState.push(defaultValue); } if (type === REMOVE_ITEM) { newState = newState.filter((item, index) => { return index !== value; }); } + if (type === SET && name === "type") { + newState[index].type = value; + } if ( type === SET && CONSTRAINT_FIELDS.includes(name) && diff --git a/src/js/components/PlacementConstraintsPartial.js b/src/js/components/PlacementConstraintsPartial.js index f0ed529347..9f980d6fc8 100644 --- a/src/js/components/PlacementConstraintsPartial.js +++ b/src/js/components/PlacementConstraintsPartial.js @@ -220,7 +220,8 @@ export default class PlacementSection extends Component { Add Placement Constraint