diff --git a/frontend/src/component/feature/form/strategy-configure.jsx b/frontend/src/component/feature/form/strategy-configure.jsx index 0bd5397ec2..67bc688da3 100644 --- a/frontend/src/component/feature/form/strategy-configure.jsx +++ b/frontend/src/component/feature/form/strategy-configure.jsx @@ -1,6 +1,18 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Textfield, Button, Card, CardTitle, CardText, CardActions, CardMenu, IconButton, Icon } from 'react-mdl'; +import { + Textfield, + Button, + Card, + CardTitle, + CardText, + CardActions, + CardMenu, + IconButton, + Icon, + Switch, + Tooltip, +} from 'react-mdl'; import { DragSource, DropTarget } from 'react-dnd'; import { Link } from 'react-router-dom'; import StrategyInputPercentage from './strategy-input-percentage'; @@ -60,6 +72,11 @@ class StrategyConfigure extends React.Component { this.setConfig(key, e.target.value); }; + handleSwitchChange = (key, currentValue) => { + const value = currentValue === 'false' ? 'true' : 'false'; + this.setConfig(key, value); + }; + setConfig = (key, value) => { const parameters = this.props.strategy.parameters || {}; parameters[key] = value; @@ -130,6 +147,25 @@ class StrategyConfigure extends React.Component { {description &&
{description}
} ); + } else if (type === 'boolean') { + if (!value) { + this.handleSwitchChange(name, value); + } + return ( +