1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-15 17:50:48 +02:00

switch up selected strategies

This commit is contained in:
sveisvei 2016-12-10 13:11:05 +01:00
parent 9520458eee
commit 5537910a05
2 changed files with 35 additions and 14 deletions

View File

@ -31,7 +31,7 @@ class StrategiesList extends React.Component {
strategyDefinition={strategies.find(s => s.name === strat.name)} /> strategyDefinition={strategies.find(s => s.name === strat.name)} />
)); ));
return ( return (
<div> <div style={{ display: 'flex', flexWrap: 'wrap' }}>
{blocks} {blocks}
</div> </div>
); );

View File

@ -1,5 +1,5 @@
import React, { PropTypes } from 'react'; import React, { PropTypes } from 'react';
import { Textfield, Button } from 'react-mdl'; import { Textfield, Button, Card, CardTitle, CardText, CardActions, CardMenu, IconButton } from 'react-mdl';
class StrategyConfigure extends React.Component { class StrategyConfigure extends React.Component {
@ -28,9 +28,14 @@ class StrategyConfigure extends React.Component {
renderInputFields (strategyDefinition) { renderInputFields (strategyDefinition) {
if (strategyDefinition.parametersTemplate) { if (strategyDefinition.parametersTemplate) {
return Object.keys(strategyDefinition.parametersTemplate).map(field => ( const keys = Object.keys(strategyDefinition.parametersTemplate);
if (keys.length === 0) {
return null;
}
return keys.map(field => (
<Textfield <Textfield
floatingLabel floatingLabel
rows={2}
style={{ width: '100%' }} style={{ width: '100%' }}
key={field} key={field}
name={field} name={field}
@ -40,6 +45,7 @@ class StrategyConfigure extends React.Component {
/> />
)); ));
} }
return null;
} }
render () { render () {
@ -52,19 +58,34 @@ class StrategyConfigure extends React.Component {
); );
} }
const inputFields = this.renderInputFields(this.props.strategyDefinition) || []; const inputFields = this.renderInputFields(this.props.strategyDefinition);
const { name } = this.props.strategy;
return ( return (
<div style={{ padding: '5px 15px', backgroundColor: '#f7f8ff', marginBottom: '10px' }}> <Card shadow={0} style={{
<h6> flex: '1',
<strong>{this.props.strategy.name} </strong> minWidth: '300px',
(<a style={{ color: '#ff4081' }} onClick={this.handleRemove} href="#remove-strat">remove</a>) maxWidth: '100%',
</h6> // flexBasis: '1',
<small>{this.props.strategyDefinition.description}</small> margin: '5px 20px 15px 0px',
<div> }}>
{inputFields} <CardTitle style={{ color: '#fff', height: '65px', background: '#607d8b' }}>
</div> { name }
</div> </CardTitle>
<CardText>
{this.props.strategyDefinition.description}
</CardText>
{
inputFields && <CardActions border >
{inputFields}
</CardActions>
}
<CardMenu style={{ color: '#fff' }}>
<IconButton name="delete" onClick={this.handleRemove} />
</CardMenu>
</Card>
); );
} }
} }