Plato on Github
Report Home
src/components/Instrument/InstrumentSlitWidget.js
Maintainability
81.12
Lines of code
84
Difficulty
19.08
Estimated Errors
0.51
Function weight
By Complexity
By SLOC
import React from 'react'; import { Panel, Grid, Row, Col } from 'react-bootstrap'; import { getDatasetParameterByName, getDatasetParameterByPrefixName } from '../../helpers/DatasetHelper.js'; class InstrumentSlitWidget extends React.Component { constructor(props) { super(props); } getParameter(parameterName){ return getDatasetParameterByName(this.props.dataset, parameterName); } render(){ var parameters = getDatasetParameterByPrefixName(this.props.dataset, "InstrumentSlit"); return <div class="container-fluid"> <h3>Slits</h3> <div class="row"> <div class="col-sm-2"> <table class="table table-condensed"> <thead> <tr> <th colSpan="2">Primary slit</th> </tr> </thead> <tbody> <tr><td>Blade Front</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_blade_front")}</td></tr> <tr><td>Blade Back</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_blade_back")}</td></tr> <tr><td>Blade Up</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_blade_up")}</td></tr> <tr><td>Blade Down</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_blade_down")}</td></tr> <tr><td>Horizontal Gap</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_horizontal_gap")}</td></tr> <tr><td>Horizontal Offset</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_horizontal_offset")}</td></tr> <tr><td>Vertical Gap</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_vertical_gap")}</td></tr> <tr><td>Vertical Offset</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitPrimary_vertical_offset")}</td></tr> </tbody> </table> </div> <div class="col-sm-2"> <table class="table table-condensed"> <thead> <tr> <th colSpan="2">Secondary slit</th> </tr> </thead> <tbody> <tr><td>Blade Front</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_blade_front")}</td></tr> <tr><td>Blade Back</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_blade_back")}</td></tr> <tr><td>Blade Up</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_blade_up")}</td></tr> <tr><td>Blade Down</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_blade_down")}</td></tr> <tr><td>Horizontal Gap</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_horizontal_gap")}</td></tr> <tr><td>Horizontal Offset</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_horizontal_offset")}</td></tr> <tr><td>Vertical Gap</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_vertical_gap")}</td></tr> <tr><td>Vertical Offset</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlitSecondary_vertical_offset")}</td></tr> </tbody> </table> </div> <div class="col-sm-8"> <table class="table table-condensed"> <thead> <tr> <th colSpan="2">Slits</th> </tr> </thead> <tbody> <tr><td>Blade Front</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_blade_front")}</td></tr> <tr><td>Blade Back</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_blade_back")}</td></tr> <tr><td>Blade Up</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_blade_up")}</td></tr> <tr><td>Blade Down</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_blade_down")}</td></tr> <tr><td>Horizontal Gap</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_horizontal_gap")}</td></tr> <tr><td>Horizontal Offset</td><td>{getDatasetParameterByName(this.props.dataset, "InstrumentSlits_horizontal_offset")}</td></tr> </tbody> </table> </div> </div> </div>; } } export default InstrumentSlitWidget;