mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix: support custom stickiness for flexible strategies
This commit is contained in:
parent
37bd960133
commit
15ef4606b7
@ -22,6 +22,7 @@ const EditStrategyModal = ({
|
||||
saveStrategy,
|
||||
updateStrategy,
|
||||
strategyDefinition,
|
||||
context,
|
||||
}) => {
|
||||
const updateParameters = parameters => {
|
||||
const updatedStrategy = { ...strategy, parameters };
|
||||
@ -81,6 +82,7 @@ const EditStrategyModal = ({
|
||||
updateParameter={updateParameter}
|
||||
strategyDefinition={strategyDefinition}
|
||||
editable
|
||||
context={context}
|
||||
/>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
@ -105,7 +107,7 @@ EditStrategyModal.propTypes = {
|
||||
onCancel: PropTypes.func.isRequired,
|
||||
saveStrategy: PropTypes.func.isRequired,
|
||||
strategyDefinition: PropTypes.object.isRequired,
|
||||
context: PropTypes.array, // TODO: fix me
|
||||
context: PropTypes.array.isRequired,
|
||||
};
|
||||
|
||||
export default EditStrategyModal;
|
||||
|
@ -12,7 +12,7 @@ const builtInStickinessOptions = [
|
||||
{ key: 'random', label: 'random' },
|
||||
];
|
||||
|
||||
const FlexibleStrategy = ({ updateParameter, parameters, context = [] }) => {
|
||||
const FlexibleStrategy = ({ updateParameter, parameters, context }) => {
|
||||
const onUpdate = field => (_, newValue) => {
|
||||
updateParameter(field, newValue);
|
||||
};
|
||||
@ -63,7 +63,7 @@ const FlexibleStrategy = ({ updateParameter, parameters, context = [] }) => {
|
||||
FlexibleStrategy.propTypes = {
|
||||
parameters: PropTypes.object.isRequired,
|
||||
updateParameter: PropTypes.func.isRequired,
|
||||
context: PropTypes.array, // TODO: fix me
|
||||
context: PropTypes.array.isRequired,
|
||||
};
|
||||
|
||||
export default FlexibleStrategy;
|
||||
|
@ -8,4 +8,5 @@ export default {
|
||||
parameters: PropTypes.object.isRequired,
|
||||
updateParameter: PropTypes.func.isRequired,
|
||||
editable: PropTypes.bool.isRequired,
|
||||
context: PropTypes.array.isRequired,
|
||||
};
|
||||
|
@ -157,6 +157,7 @@ const StrategiesList = props => {
|
||||
editingStrategy.name
|
||||
)}
|
||||
onCancel={clearAll}
|
||||
context={props.context}
|
||||
/>
|
||||
) : null}
|
||||
<ConditionallyRender
|
||||
@ -238,6 +239,7 @@ StrategiesList.propTypes = {
|
||||
featureToggleName: PropTypes.string.isRequired,
|
||||
saveStrategies: PropTypes.func,
|
||||
editable: PropTypes.bool,
|
||||
context: PropTypes.array.isRequired,
|
||||
};
|
||||
|
||||
export default StrategiesList;
|
||||
|
@ -3,6 +3,7 @@ import StrategiesList from './strategies-list-component';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
strategies: state.strategies.get('list').toArray(),
|
||||
context: state.context.toJS(),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, undefined)(StrategiesList);
|
||||
|
Loading…
Reference in New Issue
Block a user