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, paths: PropTypes.arrayOf(Shapes.Path), schedulers: PropTypes.arrayOf(Shapes.Scheduler), traces: PropTypes.arrayOf(Shapes.Trace), callback: PropTypes.func.isRequired, }; reset() { this.textInput.value = ""; this.pathSelect.selectedIndex = 0; this.traceSelect.selectedIndex = 0; this.schedulerSelect.selectedIndex = 0; } onSubmit() { this.props.callback(this.textInput.value, this.pathSelect.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;