diff --git a/src/simulator/select-simulator.js b/src/simulator/select-simulator.js deleted file mode 100644 index b91258c..0000000 --- a/src/simulator/select-simulator.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * File: selectSimulator.js - * Author: Markus Grigull - * Date: 10.05.2018 - * - * This file is part of VILLASweb. - * - * VILLASweb is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * VILLASweb is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with VILLASweb. If not, see . - ******************************************************************************/ - -import React from 'react'; -import { Container } from 'flux/utils'; -import { FormGroup, FormControl, FormLabel, Col } from 'react-bootstrap'; -import _ from 'lodash'; - -import SimulatorStore from './simulator-store'; - -class SelectSimulator extends React.Component { - static getStores() { - return [ SimulatorStore ]; - } - - static calculateState() { - return { - simulators: SimulatorStore.getState(), - selectedSimulator: '' - }; - } - - static getDerivedStateFromProps(props, state){ - if (props.value === state.selectedSimulator) { - return null; // no change - } - - let selectedSimulator = props.value; - if (selectedSimulator == null) { - if (state.simulators.length > 0) { - selectedSimulator = state.simulators[0].id; - } else { - selectedSimulator = ''; - } - } - - return { - selectedSimulator - }; - } - - handleChange = event => { - this.setState({ selectedSimulator: event.target.value }); - - // send complete simulator to callback - if (this.props.onChange != null) { - const simulator = this.state.simulators.find(s => s.id === event.target.value); - - this.props.onChange(simulator); - } - }; - - render() { - - const simulatorOptions = this.state.simulators.map(s => - - ); - console.log("simulator options: ", simulatorOptions); - - return - - Simulator - - - - this.handleChange(e)}> - {simulatorOptions} - - - ; - } -} - -let fluxContainerConverter = require('../common/FluxContainerConverter'); -export default Container.create(fluxContainerConverter.convert(SelectSimulator));