import PropTypes from 'prop-types' import React from 'react' import Shapes from '../../../shapes' import Modal from '../Modal' class NewExperimentModalComponent extends React.Component { static propTypes = { show: PropTypes.bool.isRequired, topologies: PropTypes.arrayOf(Shapes.Topology), schedulers: PropTypes.arrayOf(Shapes.Scheduler), traces: PropTypes.arrayOf(Shapes.Trace), callback: PropTypes.func.isRequired, } reset() { this.textInput.value = '' this.topologySelect.selectedIndex = 0 this.traceSelect.selectedIndex = 0 this.schedulerSelect.selectedIndex = 0 } onSubmit() { this.props.callback( this.textInput.value, this.topologySelect.value, this.traceSelect.value, this.schedulerSelect.value, ) this.reset() } onCancel() { this.props.callback(undefined) this.reset() } render() { return (
{ e.preventDefault() this.onSubmit() }} >
(this.textInput = textInput)} />
) } } export default NewExperimentModalComponent