1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

fix: minor strategy configure update

This commit is contained in:
Ivar Conradi Østhus 2020-12-14 21:39:22 +01:00
parent 6715ee8af0
commit 111b2353bf
2 changed files with 13 additions and 1 deletions

View File

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
The latest version of this document is always available in
[releases][releases-url].
# 3.8.1
- fix: minor CSS improvement for strategy configs
- fix: minor strategy configure update
# 3.8.0
- feat: Should update activation strategies immediately (#229)

View File

@ -31,6 +31,7 @@ export default class StrategyConfigureComponent extends React.Component {
constructor(props) {
super();
this.state = {
constraints: props.strategy.constraints ? [...props.strategy.constraints] : [],
parameters: { ...props.strategy.parameters },
edit: false,
dirty: false,
@ -39,12 +40,18 @@ export default class StrategyConfigureComponent extends React.Component {
}
updateParameters = parameters => {
const { constraints } = this.state;
const updatedStrategy = Object.assign({}, this.props.strategy, {
parameters,
constraints,
});
this.props.updateStrategy(updatedStrategy);
};
updateConstraints = constraints => {
this.setState({ constraints, dirty: true });
};
updateParameter = async (field, value, forceUp = false) => {
const { parameters } = this.state;
parameters[field] = value;
@ -106,7 +113,7 @@ export default class StrategyConfigureComponent extends React.Component {
const cardClasses = [styles.card];
if (dirty) {
cardClasses.push('mdl-color--pink-50');
cardClasses.push('mdl-color--purple-50');
}
if (isDragging) {
cardClasses.push(styles.isDragging);
@ -123,6 +130,7 @@ export default class StrategyConfigureComponent extends React.Component {
<Icon name="extension" />
&nbsp;
{name}
{dirty ? <small>&nbsp;(Unsaved)</small> : ''}
</CardTitle>
<CardText>