1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

Make parameters editor abstract from simulation model

This commit is contained in:
Markus Grigull 2018-06-06 13:20:45 +02:00
parent bc5c66b218
commit a124a8d91e
2 changed files with 12 additions and 11 deletions

View file

@ -53,12 +53,7 @@ class ParametersEditor extends React.Component {
border: '1px solid lightgray'
};
return <div>
<Col componentClass={ControlLabel} sm={3} md={2}>
{this.props.name}
</Col>
<Col sm={9} md={10} style={containerStyle}>
return <div style={containerStyle}>
<JsonView
src={this.props.content}
name={false}
@ -67,19 +62,16 @@ class ParametersEditor extends React.Component {
onEdit={this.onEdit}
onDelete={this.onDelete}
/>
</Col>
</div>;
}
}
ParametersEditor.PropTypes = {
name: PropTypes.string,
content: PropTypes.object,
onChange: PropTypes.func
};
ParametersEditor.defaultProps = {
name: "Parameters",
content: {}
};

View file

@ -21,7 +21,7 @@
import React from 'react';
import { Container } from 'flux/utils';
import { Button, Col, Form } from 'react-bootstrap';
import { Button, Col, Form, ControlLabel } from 'react-bootstrap';
import SimulationModelStore from '../stores/simulation-model-store';
import UserStore from '../stores/user-store';
@ -139,7 +139,16 @@ class SimulationModel extends React.Component {
<SelectFile disabled type='configuration' name='Configuration' onChange={this.handleConfigurationChange} value={this.state.simulationModel.configuration} />
<ParametersEditor name='Start Parameters' content={this.state.simulationModel.startParameters} onChange={this.handleStartParametersChange} />
<div>
<Col componentClass={ControlLabel} sm={3} md={2}>
Start Parameters
</Col>
<Col sm={9} md={10}>
<ParametersEditor content={this.state.simulationModel.startParameters} onChange={this.handleStartParametersChange} />
</Col>
</div>
</Col>
<Col xs={12} sm={6}>